36 using namespace Utilities;
40 namespace OceanicPlateModels
46 min_depth(NaN::
DSNAN),
51 this->
name =
"uniform";
63 "Uniform grains model. All grains start exactly the same.");
67 "The depth in meters from which the composition of this feature is present.");
69 "The depth in meters to which the composition of this feature is present.");
72 "A list with the integer labels of the composition which are present there.");
75 "A list with the labels of the grains which are present there for each compositions.");
78 "A list with the z-x-z Euler angles of the grains which are present there for each compositions.");
81 "Whether the value should replace any value previously defined at this location (replace) or " 82 "add the value to the previously define value (add, not implemented). Replacing implies that all values not " 83 "explicitly defined are set to zero.");
87 "A list of the size of all of the grains in each composition. If set to <0, the size will be set so that the total is equal to 1.");
101 const bool set_euler_angles = prm.
check_entry(
"Euler angles z-x-z");
102 const bool set_rotation_matrices = prm.
check_entry(
"rotation matrices");
104 WBAssertThrow(!(set_euler_angles ==
true && set_rotation_matrices ==
true),
105 "Only Euler angles or Rotation matrices may be set, but both are set for " << prm.
get_full_json_path());
108 WBAssertThrow(!(set_euler_angles ==
false && set_rotation_matrices ==
false),
109 "Euler angles or Rotation matrices have to be set, but neither are set for " << prm.
get_full_json_path());
111 if (set_euler_angles)
113 std::vector<std::array<double,3> > euler_angles_vector = prm.
get_vector<std::array<double,3> >(
"Euler angles z-x-z");
115 for (
size_t i = 0; i<euler_angles_vector.size(); ++i)
125 operation = prm.
get<std::string>(
"orientation operation");
130 "There are not the same amount of compositions (" <<
compositions.size()
133 "There are not the same amount of compositions (" <<
compositions.size()
134 <<
") and grain_sizes (" << grain_sizes.size() <<
").");
142 const unsigned int composition_number,
148 if (depth <= max_depth && depth >=
min_depth)
152 if (depth <= max_depth_local && depth >= min_depth_local)
161 std::fill(grains_local.
sizes.begin(),grains_local.
sizes.end(),size);
bool check_entry(const std::string &name) const
#define WB_REGISTER_FEATURE_OCEANIC_PLATE_GRAINS_MODEL(classname, name)
WorldBuilder::World * world
std::vector< double > sizes
std::string get_full_json_path(size_t max_size=std::numeric_limits< size_t >::max()) const
Point< 2 > get_surface_point() const
#define WBAssertThrow(condition, message)
SurfaceValueInfo local_value(const Point< 2 > &check_point) const
std::array< std::array< double, 3 >, 3 > euler_angles_to_rotation_matrix(double phi1_d, double theta_d, double phi2_d)
std::vector< std::array< std::array< double, 3 >, 3 > > rotation_matrices
void declare_entry(const std::string &name, const Types::Interface &type, const std::string &documentation)
std::vector< T > get_vector(const std::string &name)
T get(const std::string &name)