World Builder  1.1.0-pre
A geodynamic initial conditions generator
world.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_WORLD_H
21 #define WORLD_BUILDER_WORLD_H
22 
23 #include "world_builder/grains.h"
27 
28 #include <random>
29 
33 namespace WorldBuilder
34 {
35 
36  namespace Features
37  {
38  class Interface;
39  } // namespace Features
40 
41  class World
42  {
43  public:
63  World(std::string filename, bool has_output_dir = false, const std::string &output_dir = "", unsigned long random_number_seed = 1, const bool limit_debug_consistency_checks = true);
64 
68  ~World();
69 
70 
74  static void declare_entries(Parameters &prm);
75 
79  void parse_entries(Parameters &prm);
80 
88  unsigned int properties_output_size(const std::vector<std::array<unsigned int,3>> &properties) const;
89 
123  std::vector<double> properties(const std::array<double, 2> &point,
124  const double depth,
125  const std::vector<std::array<unsigned int,3>> &properties) const;
126 
160  std::vector<double> properties(const std::array<double, 3> &point,
161  const double depth,
162  const std::vector<std::array<unsigned int,3>> &properties) const;
163 
168  double temperature(const std::array<double, 2> &point, const double depth) const;
169 
174  double temperature(const std::array<double, 3> &point, const double depth) const;
175 
181  [[deprecated("Replaced by a temperature function without the gravity. This function will be removed in future versions.")]]
182  double temperature(const std::array<double, 2> &point, const double depth, const double gravity_norm) const;
183 
189  [[deprecated("Replaced by a temperature function without the gravity. This function will be removed in future versions.")]]
190  double temperature(const std::array<double, 3> &point, const double depth, const double gravity_norm) const;
191 
196  double composition(const std::array<double, 2> &point, const double depth, const unsigned int composition_number) const;
197 
202  double composition(const std::array<double, 3> &point, const double depth, const unsigned int composition_number) const;
203 
208  WorldBuilder::grains grains(const std::array<double, 2> &point,
209  const double depth,
210  const unsigned int composition_number,
211  size_t number_of_grains) const;
212 
217  WorldBuilder::grains grains(const std::array<double, 3> &point,
218  const double depth,
219  const unsigned int composition_number,
220  size_t number_of_grains) const;
229  distance_to_plane(const std::array<double, 3> &point,
230  const double depth,
231  const std::string &name) const;
232 
236  int MPI_RANK;
237 
241  int MPI_SIZE;
242 
247  std::mt19937 &get_random_number_engine();
248 
254 
258  std::vector<Point<2> > cross_section;
259 
264 
269 
274 
279 
284 
289 
294 
299 
303  std::string interpolation;
304 
308  std::vector<std::string> feature_tags;
309 
310  private:
317  unsigned int dim;
318 
319 
323  std::mt19937 random_number_engine;
324 
333 
334 
335 
336  };
337 } // namespace WorldBuilder
338 
339 #endif
unsigned int dim
Definition: world.h:317
double maximum_distance_between_coordinates
Definition: world.h:298
double potential_mantle_temperature
Definition: world.h:268
bool limit_debug_consistency_checks
Definition: world.h:332
Point< 2 > surface_coord_conversions
Definition: world.h:263
std::mt19937 random_number_engine
Definition: world.h:323
double thermal_diffusivity
Definition: world.h:293
double specific_heat
Definition: world.h:288
double surface_temperature
Definition: world.h:273
std::vector< std::string > feature_tags
Definition: world.h:308
bool force_surface_temperature
Definition: world.h:278
std::string interpolation
Definition: world.h:303
double thermal_expansion_coefficient
Definition: world.h:283
unsigned int properties_output_size(void *ptr_ptr_world, const unsigned int properties_[][3], const unsigned int n_properties)
Definition: wrapper_c.cc:56
std::vector< Point< 2 > > cross_section
Definition: world.h:258
Parameters parameters
Definition: world.h:253