|
World Builder
1.1.0-pre
A geodynamic initial conditions generator
|
#include <parameters.h>

Public Member Functions | |
| Parameters (World &world) | |
| ~Parameters () | |
| void | initialize (std::string &filename, bool has_output_dir=false, const std::string &output_dir="") |
| template<class T > | |
| T | get (const std::string &name) |
| template<class T > | |
| std::vector< T > | get_vector (const std::string &name) |
| std::vector< std::vector< double > > | get_vector_or_double (const std::string &name) |
| std::pair< std::vector< double >, std::vector< double > > | get (const std::string &name, const std::vector< Point< 2 > > &addition_points={}) |
| std::pair< std::vector< double >, std::vector< double > > | get_value_at_array (const std::string &name) |
| template<class T , class A , class B , class C , class D > | |
| std::vector< T > | get_vector (const std::string &name, std::vector< std::shared_ptr< A > > &, std::vector< std::shared_ptr< B > > &, std::vector< std::shared_ptr< C > > &, std::vector< std::shared_ptr< D > > &) |
| template<class T > | |
| std::unique_ptr< T > | get_unique_pointer (const std::string &name) |
| template<class T > | |
| bool | get_unique_pointers (const std::string &name, std::vector< std::unique_ptr< T > > &vector) |
| template<class T > | |
| bool | get_shared_pointers (const std::string &name, std::vector< std::shared_ptr< T > > &) |
| bool | check_entry (const std::string &name) const |
| void | declare_entry (const std::string &name, const Types::Interface &type, const std::string &documentation) |
| void | enter_subsection (const std::string &name) |
| void | leave_subsection () |
| void | declare_model_entries (const std::string &model_group_name, const std::string &parent_name, const std::map< std::string, void(*)(Parameters &, const std::string &)> &declare_map, const std::vector< std::string > &required_entries={}, const std::vector< std::tuple< std::string, const WorldBuilder::Types::Interface &, std::string > > &extra_declarations={}) |
| std::string | get_full_json_path (size_t max_size=std::numeric_limits< size_t >::max()) const |
| std::string | get_full_json_schema_path () const |
| template<> | |
| std::string | get (const std::string &name) |
| template<> | |
| double | get (const std::string &name) |
| template<> | |
| size_t | get (const std::string &name) |
| template<> | |
| unsigned int | get (const std::string &name) |
| template<> | |
| int | get (const std::string &name) |
| template<> | |
| bool | get (const std::string &name) |
| template<> | |
| Point< 2 > | get (const std::string &name) |
| template<> | |
| std::vector< bool > | get_vector (const std::string &name) |
| template<> | |
| std::vector< Point< 2 > > | get_vector (const std::string &name) |
| template<> | |
| std::vector< std::array< double, 3 > > | get_vector (const std::string &name) |
| template<> | |
| std::vector< std::array< std::array< double, 3 >, 3 > > | get_vector (const std::string &name) |
| template<> | |
| std::vector< std::vector< Point< 2 > > > | get_vector (const std::string &name) |
| template<> | |
| std::vector< Objects::Segment< Features::SubductingPlateModels::Temperature::Interface, Features::SubductingPlateModels::Composition::Interface, Features::SubductingPlateModels::Grains::Interface, Features::SubductingPlateModels::Velocity::Interface > > | get_vector (const std::string &name, std::vector< std::shared_ptr< Features::SubductingPlateModels::Temperature::Interface > > &default_temperature_models, std::vector< std::shared_ptr< Features::SubductingPlateModels::Composition::Interface > > &default_composition_models, std::vector< std::shared_ptr< Features::SubductingPlateModels::Grains::Interface > > &default_grains_models, std::vector< std::shared_ptr< Features::SubductingPlateModels::Velocity::Interface > > &default_velocity_models) |
| template<> | |
| std::vector< Objects::Segment< Features::FaultModels::Temperature::Interface, Features::FaultModels::Composition::Interface, Features::FaultModels::Grains::Interface, Features::FaultModels::Velocity::Interface > > | get_vector (const std::string &name, std::vector< std::shared_ptr< Features::FaultModels::Temperature::Interface > > &default_temperature_models, std::vector< std::shared_ptr< Features::FaultModels::Composition::Interface > > &default_composition_models, std::vector< std::shared_ptr< Features::FaultModels::Grains::Interface > > &default_grains_models, std::vector< std::shared_ptr< Features::FaultModels::Velocity::Interface > > &default_velocity_models) |
| template<> | |
| std::vector< double > | get_vector (const std::string &name) |
| template<> | |
| std::vector< size_t > | get_vector (const std::string &name) |
| template<> | |
| std::vector< unsigned int > | get_vector (const std::string &name) |
| template<> | |
| bool | get_unique_pointers (const std::string &name, std::vector< std::unique_ptr< Features::SubductingPlate > > &vector) |
| template<> | |
| bool | get_unique_pointers (const std::string &name, std::vector< std::unique_ptr< Features::Fault > > &vector) |
Public Attributes | |
| World & | world |
| const std::string | path_separator = "." |
| std::vector< std::string > | path |
| rapidjson::Document | declarations |
| rapidjson::Document | parameters |
| std::vector< std::unique_ptr< WorldBuilder::Features::Interface > > | features |
| std::unique_ptr< WorldBuilder::CoordinateSystems::Interface > | coordinate_system |
| std::unique_ptr< WorldBuilder::GravityModel::Interface > | gravity_model |
Private Member Functions | |
| std::string | get_relative_path () const |
| std::string | get_relative_path_without_arrays () const |
Private Attributes | |
| size_t | path_level |
A class to hold all the parameters needed by the world builder. Internally it holds all values in the form of vectors of class Types. Values can be entered in two ways into this class. The first way is through the load_entry function which load the value from the provided world builder file. The second way is through the set_entry function, through which values can be directly entered into the parameter class. Values can be retrieved through the get functions which take the name of the value with which it was set. It is also required for bot loading, setting and getting values to do it in the correct subsection. Subsections can be entered with the enter_subsection function and left with the leave_subsection function. The current path can be retrieved through the function get_current_path() and get_current_path_without_arrays().
Definition at line 78 of file parameters.h.
| WorldBuilder::Parameters::Parameters | ( | World & | world | ) |
Constructor
| world | A reference to the World class |
Definition at line 79 of file parameters.cc.

|
default |
Destructor

| bool WorldBuilder::Parameters::check_entry | ( | const std::string & | name | ) | const |
Checks for the existence of an entry in the parameter file. Return true when an entry is specified and false when it is not. This is independent of whether an entry has been declared or not. The main intended usage is to check whether the user has provided the specified entry in the user supplied parameters file, since the get functions may use default values.
| name | The name of the entry to be checked. |
Definition at line 205 of file parameters.cc.


| void WorldBuilder::Parameters::declare_entry | ( | const std::string & | name, |
| const Types::Interface & | type, | ||
| const std::string & | documentation | ||
| ) |
Declares the existence an entry in the parameters class. Default values are supplied by the type.
| name | The name of the entry to be declared |
| type | The type of entry (e.g. Double, Array, etc.) |
| documentation | A string containing information about this parameter. |
Definition at line 197 of file parameters.cc.

| void WorldBuilder::Parameters::declare_model_entries | ( | const std::string & | model_group_name, |
| const std::string & | parent_name, | ||
| const std::map< std::string, void(*)(Parameters &, const std::string &)> & | declare_map, | ||
| const std::vector< std::string > & | required_entries = {}, |
||
| const std::vector< std::tuple< std::string, const WorldBuilder::Types::Interface &, std::string > > & | extra_declarations = {} |
||
| ) |
A utilities function for declaring plugin model entries. This always contains a model declaration entry with the plugin name.
| model_group_name | The name of the model group which is declared. |
| parent_name | The name of the parent declaration group. |
| declaration_map | A map containing plugin names and plugin declaration functions |
| required_entries | A vector containing what entries should be required from the user. Default value is empty. |
| extra_declarations | A vector containing extra declarations common to all plugins in this group. Default value is empty. |
Definition at line 1886 of file parameters.cc.


| void WorldBuilder::Parameters::enter_subsection | ( | const std::string & | name | ) |
This function is used to enter a subsection. It appends to the path variable. This action is revesed by the leave subsection function.
| name | The name of the subsection to be entered. |
Definition at line 1871 of file parameters.cc.

| T WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
A generic get function to retrieve setting from the parameter file. Note that this is dependent on the current path/subsection which you are in.
| name | The name of the entry to retrieved |
| std::pair< std::vector< double >, std::vector< double > > WorldBuilder::Parameters::get | ( | const std::string & | name, |
| const std::vector< Point< 2 > > & | addition_points = {} |
||
| ) |
A specialized version of get which can return a value at points type.
| name | The name of the entry to retrieved |
| name | additional points to be added to the list at either the default value or at the value of a single value array in the list |
Definition at line 512 of file parameters.cc.

| std::string WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| double WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| size_t WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| unsigned int WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| int WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| bool WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| Point<2> WorldBuilder::Parameters::get | ( | const std::string & | name | ) |
| std::string WorldBuilder::Parameters::get_full_json_path | ( | size_t | max_size = std::numeric_limits<size_t>::max() | ) | const |
This function return the current path as stored in the path variable as a string in json pointer format.
Definition at line 1933 of file parameters.cc.

| std::string WorldBuilder::Parameters::get_full_json_schema_path | ( | ) | const |
todo: Warning: do not use before declarations is filled. This function return the current path as stored in the path variable as a string in json pointer format.
Definition at line 1944 of file parameters.cc.


|
private |
A function which returns the relative path, which is the full path minus the path_level top entries..
|
private |
A function which returns the relative path, which is the full path minus the path_level top entries., without names for the arrays.
| bool WorldBuilder::Parameters::get_shared_pointers | ( | const std::string & | name, |
| std::vector< std::shared_ptr< T > > & | vector | ||
| ) |
A specialized version of get which can return shared pointers as an argument and returns a bool to indicate whether it was successful or not. Note that this function will erase all information in the vector.
| name | The name of the entry to retrieved |
| vector | A vector of shared pointers. |
Definition at line 1845 of file parameters.cc.


| std::unique_ptr< T > WorldBuilder::Parameters::get_unique_pointer | ( | const std::string & | name | ) |
A specialized version of get which can return unique pointers.
| name | The name of the entry to retrieved |
Definition at line 1738 of file parameters.cc.


| bool WorldBuilder::Parameters::get_unique_pointers | ( | const std::string & | name, |
| std::vector< std::unique_ptr< T > > & | vector | ||
| ) |
A specialized version of get which can return unique pointers as an argument and returns a bool to indicate whether it was successful or not. Note that this function will erase all information in the vector.
| name | The name of the entry to retrieved |
| vector | A vector of unique pointers. |
Definition at line 1770 of file parameters.cc.


| bool WorldBuilder::Parameters::get_unique_pointers | ( | const std::string & | name, |
| std::vector< std::unique_ptr< Features::SubductingPlate > > & | vector | ||
| ) |
| bool WorldBuilder::Parameters::get_unique_pointers | ( | const std::string & | name, |
| std::vector< std::unique_ptr< Features::Fault > > & | vector | ||
| ) |
| std::pair< std::vector< double >, std::vector< double > > WorldBuilder::Parameters::get_value_at_array | ( | const std::string & | name | ) |
A specialized version of get which can return a values at times type.
| name | The name of the entry to retrieved |
Definition at line 719 of file parameters.cc.


| std::vector<T> WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
A specialized version of get which can return vectors/arrays.
| name | The name of the entry to retrieved |

| std::vector<T> WorldBuilder::Parameters::get_vector | ( | const std::string & | name, |
| std::vector< std::shared_ptr< A > > & | , | ||
| std::vector< std::shared_ptr< B > > & | , | ||
| std::vector< std::shared_ptr< C > > & | , | ||
| std::vector< std::shared_ptr< D > > & | |||
| ) |
A specialized version of get which can return vectors/arrays. This version is designed for the plugin system.
| name | The name of the entry to retrieved |
| std::vector<bool> WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<Point<2> > WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<std::array<double,3> > WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<std::array<std::array<double,3>,3> > WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<std::vector<Point<2> > > WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<Objects::Segment<Features::SubductingPlateModels::Temperature::Interface, Features::SubductingPlateModels::Composition::Interface, Features::SubductingPlateModels::Grains::Interface, Features::SubductingPlateModels::Velocity::Interface> > WorldBuilder::Parameters::get_vector | ( | const std::string & | name, |
| std::vector< std::shared_ptr< Features::SubductingPlateModels::Temperature::Interface > > & | default_temperature_models, | ||
| std::vector< std::shared_ptr< Features::SubductingPlateModels::Composition::Interface > > & | default_composition_models, | ||
| std::vector< std::shared_ptr< Features::SubductingPlateModels::Grains::Interface > > & | default_grains_models, | ||
| std::vector< std::shared_ptr< Features::SubductingPlateModels::Velocity::Interface > > & | default_velocity_models | ||
| ) |
| std::vector<Objects::Segment<Features::FaultModels::Temperature::Interface,Features::FaultModels::Composition::Interface, Features::FaultModels::Grains::Interface, Features::FaultModels::Velocity::Interface> > WorldBuilder::Parameters::get_vector | ( | const std::string & | name, |
| std::vector< std::shared_ptr< Features::FaultModels::Temperature::Interface > > & | default_temperature_models, | ||
| std::vector< std::shared_ptr< Features::FaultModels::Composition::Interface > > & | default_composition_models, | ||
| std::vector< std::shared_ptr< Features::FaultModels::Grains::Interface > > & | default_grains_models, | ||
| std::vector< std::shared_ptr< Features::FaultModels::Velocity::Interface > > & | default_velocity_models | ||
| ) |
| std::vector<double> WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<size_t> WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector<unsigned int> WorldBuilder::Parameters::get_vector | ( | const std::string & | name | ) |
| std::vector< std::vector< double > > WorldBuilder::Parameters::get_vector_or_double | ( | const std::string & | name | ) |
Definition at line 920 of file parameters.cc.


| void WorldBuilder::Parameters::initialize | ( | std::string & | filename, |
| bool | has_output_dir = false, |
||
| const std::string & | output_dir = "" |
||
| ) |
Initializes the parameter file
| filename | A string with the path to the world builder file |
| has_output_dir | A bool indicating whether the world builder may write out information. |
| output_dir | A string with the path to the directory where it can output information if allowed by has_output_dir |
Definition at line 88 of file parameters.cc.


| void WorldBuilder::Parameters::leave_subsection | ( | ) |
This function is used to leave a subsection by removing the last element of the path variable. It reverses the action of the enter subsection function.
Definition at line 1878 of file parameters.cc.

| std::unique_ptr<WorldBuilder::CoordinateSystems::Interface> WorldBuilder::Parameters::coordinate_system |
A pointers to the corodinate system. This variable is responsible for the coordinate system and has ownership over it. Therefore a unique pointer are used.
Definition at line 268 of file parameters.h.
| rapidjson::Document WorldBuilder::Parameters::declarations |
Definition at line 248 of file parameters.h.
| std::vector<std::unique_ptr<WorldBuilder::Features::Interface> > WorldBuilder::Parameters::features |
A vector containing all the pointers to the features. This vector is responsible for the features and has ownership over them. Therefore unique pointers are used.
Definition at line 260 of file parameters.h.
| std::unique_ptr<WorldBuilder::GravityModel::Interface> WorldBuilder::Parameters::gravity_model |
A pointers to the gravity model. This variable is responsible for the gravity model and has ownership over it. Therefore a unique pointer are used.
Definition at line 276 of file parameters.h.
| rapidjson::Document WorldBuilder::Parameters::parameters |
Definition at line 249 of file parameters.h.
| std::vector<std::string> WorldBuilder::Parameters::path |
This variable stores the path in a vector of strings.
Definition at line 246 of file parameters.h.
|
private |
This function return the current path as stored in the path variable as a string.
Definition at line 315 of file parameters.h.
| const std::string WorldBuilder::Parameters::path_separator = "." |
This variable stores what path separator is used in the property tree and in this class.
Definition at line 239 of file parameters.h.
| World& WorldBuilder::Parameters::world |
A reference to the World class. This is needed to create the features.
Definition at line 233 of file parameters.h.