35 using namespace Utilities;
45 min_depth(NaN::
DSNAN),
50 this->
name =
"uniform";
62 "Uniform grains model. All grains start exactly the same.");
66 "The depth in meters from which the grains of this feature are present.");
68 "The depth in meters to which the grains of this feature are present.");
71 "A list with the integer labels of the composition which are present there.");
74 "A list with the rotation matrices of the grains which are present there for each compositions.");
77 "A list with the z-x-z Euler angles of the grains which are present there for each compositions.");
80 "Whether the value should replace any value previously defined at this location (replace) or " 81 "add the value to the previously define value (add, not implemented). Replacing implies that all values not " 82 "explicitly defined are set to zero.");
86 "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.");
98 const bool set_euler_angles = prm.
check_entry(
"Euler angles z-x-z");
99 const bool set_rotation_matrices = prm.
check_entry(
"rotation matrices");
101 WBAssertThrow(!(set_euler_angles ==
true && set_rotation_matrices ==
true),
102 "Only Euler angles or Rotation matrices may be set, but both are set for " << prm.
get_full_json_path());
105 WBAssertThrow(!(set_euler_angles ==
false && set_rotation_matrices ==
false),
106 "Euler angles or Rotation matrices have to be set, but neither are set for " << prm.
get_full_json_path());
108 if (set_euler_angles)
110 std::vector<std::array<double,3> > euler_angles_vector = prm.
get_vector<std::array<double,3> >(
"Euler angles z-x-z");
112 for (
size_t i = 0; i<euler_angles_vector.size(); ++i)
123 operation = prm.
get<std::string>(
"orientation operation");
128 "There are not the same amount of compositions (" << compositions.size()
131 "There are not the same amount of compositions (" << compositions.size()
132 <<
") and grain_sizes (" << grain_sizes.size() <<
").");
140 const unsigned int composition_number,
146 if (depth <= max_depth && depth >=
min_depth)
155 std::fill(grains_local.
sizes.begin(),grains_local.
sizes.end(),size);
bool check_entry(const std::string &name) const
std::vector< double > sizes
#define WB_REGISTER_FEATURE_PLUME_GRAINS_MODEL(classname, name)
std::string get_full_json_path(size_t max_size=std::numeric_limits< size_t >::max()) const
WorldBuilder::World * world
#define WBAssertThrow(condition, message)
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)