World Builder  1.1.0-pre
A geodynamic initial conditions generator
fault.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2018-2024 by the authors of the World Builder code.
3 
4  This file is part of the World Builder.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef WORLD_BUILDER_FEATURES_FAULT_H
21 #define WORLD_BUILDER_FEATURES_FAULT_H
22 
23 
31 
32 
33 namespace WorldBuilder
34 {
35  class Parameters;
36  class World;
37 
38  namespace Features
39  {
40  namespace FaultModels
41  {
42  namespace Composition
43  {
44  class Interface;
45  } // namespace Composition
46  namespace Grains
47  {
48  class Interface;
49  } // namespace Grains
50  namespace Temperature
51  {
52  class Interface;
53  } // namespace Temperature
54  namespace Velocity
55  {
56  class Interface;
57  } // namespace Temperature
58  } // namespace FaultModels
59 
66  class Fault final: public Interface
67  {
68  public:
72  Fault(WorldBuilder::World *world);
73 
77  ~Fault() override final;
78 
82  static
83  void declare_entries(Parameters &prm,
84  const std::string &parent_name = "",
85  const std::vector<std::string> &required_entries = {});
86 
90  static
91  void make_snippet(Parameters &prm);
92 
96  void parse_entries(Parameters &prm) override final;
97 
98 
107  const BoundingBox<2> &get_surface_bounding_box () const;
108 
135  void
136  properties(const Point<3> &position_in_cartesian_coordinates,
137  const Objects::NaturalCoordinate &position_in_natural_coordinates,
138  const double depth,
139  const std::vector<std::array<unsigned int,3>> &properties,
140  const double gravity,
141  const std::vector<size_t> &entry_in_output,
142  std::vector<double> &output) const override final;
143 
149  distance_to_feature_plane(const Point<3> &position_in_cartesian_coordinates,
150  const Objects::NaturalCoordinate &position_in_natural_coordinates,
151  const double depth) const override;
152 
153  private:
154  std::vector<std::shared_ptr<Features::FaultModels::Temperature::Interface> > default_temperature_models;
155  std::vector<std::shared_ptr<Features::FaultModels::Composition::Interface> > default_composition_models;
156  std::vector<std::shared_ptr<Features::FaultModels::Grains::Interface> > default_grains_models;
157  std::vector<std::shared_ptr<Features::FaultModels::Velocity::Interface> > default_velocity_models;
158 
163 
164  std::vector< std::vector<Objects::Segment<Features::FaultModels::Temperature::Interface,
165  Features::FaultModels::Composition::Interface,
166  Features::FaultModels::Grains::Interface,
168 
169  // This vector stores segments to this coordinate/section.
170  //First used (raw) pointers to the segment relevant to this coordinate/section,
171  // but I do not trust it won't fail when memory is moved. So storing the all the data now.
172  std::vector<std::vector<Objects::Segment<Features::FaultModels::Temperature::Interface,
173  Features::FaultModels::Composition::Interface,
174  Features::FaultModels::Grains::Interface,
176 
177  // todo: the memory of this can be greatly improved by
178  // or using a plugin system for the submodules, or
179  // putting the variables in a union. Although the memory
180  // used by this program is in real cases expected to be
181  // insignificant compared to what a calling program may
182  // use, a smaller amount of memory used in here, could
183  // theoretically speed up the computation, because more
184  // relevant data could be stored in the cache. But this
185  // not a urgent problem, and would require testing.
186 
193 
202 
212 
217 
218  std::vector<std::vector<double> > fault_segment_lengths;
219  std::vector<std::vector<Point<2> > > fault_segment_thickness;
220  std::vector<std::vector<Point<2> > > fault_segment_top_truncation;
221  std::vector<std::vector<Point<2> > > fault_segment_angles;
222  std::vector<double> total_fault_length;
225 
226  double min_along_x;
227  double max_along_x;
228  double min_along_y;
229  double max_along_y;
233 
234  };
235  } // namespace Features
236 } // namespace WorldBuilder
237 
238 #endif
std::vector< std::shared_ptr< Features::FaultModels::Grains::Interface > > default_grains_models
Definition: fault.h:156
std::vector< std::vector< Point< 2 > > > fault_segment_top_truncation
Definition: fault.h:220
BoundingBox< 2 > surface_bounding_box
Definition: fault.h:211
std::vector< std::vector< Objects::Segment< Features::FaultModels::Temperature::Interface, Features::FaultModels::Composition::Interface, Features::FaultModels::Grains::Interface, Features::FaultModels::Velocity::Interface > > > segment_vector
Definition: fault.h:175
WorldBuilder::Point< 2 > reference_point
Definition: fault.h:216
std::vector< std::vector< double > > fault_segment_lengths
Definition: fault.h:218
std::vector< std::shared_ptr< Features::FaultModels::Velocity::Interface > > default_velocity_models
Definition: fault.h:157
std::vector< std::shared_ptr< Features::FaultModels::Composition::Interface > > default_composition_models
Definition: fault.h:155
double buffer_around_fault_cartesian
Definition: fault.h:232
std::vector< Objects::Segment< Features::FaultModels::Temperature::Interface, Features::FaultModels::Composition::Interface, Features::FaultModels::Grains::Interface, Features::FaultModels::Velocity::Interface > > default_segment_vector
Definition: fault.h:162
std::vector< std::vector< Objects::Segment< Features::FaultModels::Temperature::Interface, Features::FaultModels::Composition::Interface, Features::FaultModels::Grains::Interface, Features::FaultModels::Velocity::Interface > > > sections_segment_vector
Definition: fault.h:167
std::vector< std::vector< Point< 2 > > > fault_segment_thickness
Definition: fault.h:219
std::vector< std::vector< Point< 2 > > > fault_segment_angles
Definition: fault.h:221
std::vector< double > total_fault_length
Definition: fault.h:222
std::vector< std::shared_ptr< Features::FaultModels::Temperature::Interface > > default_temperature_models
Definition: fault.h:154