World Builder  1.1.0-pre
A geodynamic initial conditions generator
subducting_plate.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_SUBDUCTING_PLATE_H
21 #define WORLD_BUILDER_FEATURES_SUBDUCTING_PLATE_H
22 
23 
31 
32 
33 namespace WorldBuilder
34 {
35  class Parameters;
36  class World;
37 
38  namespace Features
39  {
40  using namespace FeatureUtilities;
41  namespace SubductingPlateModels
42  {
43  namespace Composition
44  {
45  class Interface;
46  } // namespace Composition
47  namespace Grains
48  {
49  class Interface;
50  } // namespace Grains
51  namespace Temperature
52  {
53  class Interface;
54  } // namespace Temperature
55  namespace Velocity
56  {
57  class Interface;
58  } // namespace Velocity
59  } // namespace SubductingPlateModels
60 
67  class SubductingPlate final: public Interface
68  {
69  public:
74 
78  ~SubductingPlate() override final;
79 
83  static
84  void declare_entries(Parameters &prm,
85  const std::string &parent_name = "",
86  const std::vector<std::string> &required_entries = {});
87 
91  static
92  void make_snippet(Parameters &prm);
93 
97  void parse_entries(Parameters &prm) override final;
98 
99 
108  const BoundingBox<2> &get_surface_bounding_box () const;
109 
136  void
137  properties(const Point<3> &position_in_cartesian_coordinates,
138  const Objects::NaturalCoordinate &position_in_natural_coordinates,
139  const double depth,
140  const std::vector<std::array<unsigned int,3>> &properties,
141  const double gravity,
142  const std::vector<size_t> &entry_in_output,
143  std::vector<double> &output) const override final;
144 
150  distance_to_feature_plane(const Point<3> &position_in_cartesian_coordinates,
151  const Objects::NaturalCoordinate &position_in_natural_coordinates,
152  const double depth) const override;
153 
154 
155  private:
156  std::vector<std::shared_ptr<Features::SubductingPlateModels::Temperature::Interface> > default_temperature_models;
157  std::vector<std::shared_ptr<Features::SubductingPlateModels::Composition::Interface> > default_composition_models;
158  std::vector<std::shared_ptr<Features::SubductingPlateModels::Grains::Interface> > default_grains_models;
159  std::vector<std::shared_ptr<Features::SubductingPlateModels::Velocity::Interface> > default_velocity_models;
160 
165 
166  std::vector< std::vector<Objects::Segment<Features::SubductingPlateModels::Temperature::Interface,
167  Features::SubductingPlateModels::Composition::Interface,
168  Features::SubductingPlateModels::Grains::Interface,
170 
171  // This vector stores segments to this coordinate/section.
172  //First used (raw) pointers to the segment relevant to this coordinate/section,
173  // but I do not trust it won't fail when memory is moved. So storing the all the data now.
174  std::vector<std::vector<Objects::Segment<Features::SubductingPlateModels::Temperature::Interface,
175  Features::SubductingPlateModels::Composition::Interface,
176  Features::SubductingPlateModels::Grains::Interface,
178 
179  // todo: the memory of this can be greatly improved by
180  // or using a plugin system for the submodules, or
181  // putting the variables in a union. Although the memory
182  // used by this program is in real cases expected to be
183  // Insignificant compared to what a calling program may
184  // use, a smaller amount of memory used in here, could
185  // theoretically speed up the computation, because more
186  // relevant data could be stored in the cache. But this
187  // not a urgent problem, and would require testing.
188 
195 
204 
214 
219 
220  std::vector<std::vector<double> > slab_segment_lengths;
221  std::vector<std::vector<Point<2> > > slab_segment_thickness;
222  std::vector<std::vector<Point<2> > > slab_segment_top_truncation;
223  std::vector<std::vector<Point<2> > > slab_segment_angles;
224  std::vector<double> total_slab_length;
227 
228  double min_along_x;
229  double max_along_x;
230  double min_along_y;
231  double max_along_y;
235  };
236  } // namespace Features
237 } // namespace WorldBuilder
238 
239 #endif
std::vector< std::shared_ptr< Features::SubductingPlateModels::Grains::Interface > > default_grains_models
std::vector< std::vector< Point< 2 > > > slab_segment_angles
std::vector< std::shared_ptr< Features::SubductingPlateModels::Composition::Interface > > default_composition_models
std::vector< std::vector< Point< 2 > > > slab_segment_top_truncation
std::vector< std::vector< Objects::Segment< Features::SubductingPlateModels::Temperature::Interface, Features::SubductingPlateModels::Composition::Interface, Features::SubductingPlateModels::Grains::Interface, Features::SubductingPlateModels::Velocity::Interface > > > segment_vector
std::vector< std::shared_ptr< Features::SubductingPlateModels::Velocity::Interface > > default_velocity_models
std::vector< Objects::Segment< Features::SubductingPlateModels::Temperature::Interface, Features::SubductingPlateModels::Composition::Interface, Features::SubductingPlateModels::Grains::Interface, Features::SubductingPlateModels::Velocity::Interface > > default_segment_vector
std::vector< std::vector< Objects::Segment< Features::SubductingPlateModels::Temperature::Interface, Features::SubductingPlateModels::Composition::Interface, Features::SubductingPlateModels::Grains::Interface, Features::SubductingPlateModels::Velocity::Interface > > > sections_segment_vector
std::vector< std::vector< Point< 2 > > > slab_segment_thickness
std::vector< std::vector< double > > slab_segment_lengths
std::vector< std::shared_ptr< Features::SubductingPlateModels::Temperature::Interface > > default_temperature_models