36 using namespace Utilities;
40 namespace ContinentalPlateModels
46 min_depth(NaN::
DSNAN),
51 this->
name =
"random uniform distribution";
63 "Random uniform distribution grains model. The size of the grains can be independently set " 64 "to a single value or to a random distribution.");
68 "The depth in meters from which the composition of this feature is present.");
70 "The depth in meters to which the composition of this feature is present.");
73 "A list with the integer labels of the composition which are present there.");
76 "Whether the value should replace any value previously defined at this location (replace) or " 77 "add the value to the previously define value (add, not implemented). Replacing implies that all values not " 78 "explicitly defined are set to zero.");
82 "A list of the size of all of the grains in each composition. If set to <0, the size will be randomized between 0 and 1.");
86 "A list of whether the sizes of the grains should be normalized or not. If normalized, the total of the grains of a composition will be equal to 1.");
101 operation = prm.
get<std::string>(
"orientation operation");
107 "There are not the same amount of compositions (" <<
compositions.size()
108 <<
") and grain_sizes (" << grain_sizes.size() <<
").");
110 "There are not the same amount of compositions (" <<
compositions.size()
111 <<
") and normalize_grain_sizes (" << normalize_grain_sizes.size() <<
").");
119 const unsigned int composition_number,
125 if (depth <= max_depth && depth >=
min_depth)
129 if (depth <= max_depth_local && depth >= min_depth_local)
135 std::uniform_real_distribution<> dist(0.0,1.0);
159 const double z = 2.0* three;
167 const double r = std::sqrt( z );
168 const double Vx =
std::sin( phi ) * r;
169 const double Vy =
std::cos( phi ) * r;
170 const double Vz = std::sqrt( 2.F - z );
176 const double st =
std::sin( theta );
177 const double ct =
std::cos( theta );
178 const double Sx = Vx * ct - Vy * st;
179 const double Sy = Vx * st + Vy * ct;
184 it_rotation_matrices[0][0] = Vx * Sx - ct;
185 it_rotation_matrices[0][1] = Vx * Sy - st;
186 it_rotation_matrices[0][2] = Vx * Vz;
188 it_rotation_matrices[1][0] = Vy * Sx + st;
189 it_rotation_matrices[1][1] = Vy * Sy - ct;
190 it_rotation_matrices[1][2] = Vy * Vz;
192 it_rotation_matrices[2][0] = Vz * Sx;
193 it_rotation_matrices[2][1] = Vz * Sy;
194 it_rotation_matrices[2][2] = 1.0 - z;
197 double total_size = 0;
198 for (
auto &&it_sizes : grains_local.
sizes)
201 total_size += it_sizes;
206 const double one_over_total_size = 1/total_size;
207 std::transform(grains_local.
sizes.begin(), grains_local.
sizes.end(), grains_local.
sizes.begin(),
208 [one_over_total_size](
double sizes) ->
double {
return sizes *one_over_total_size; });
std::mt19937 & get_random_number_engine()
std::vector< double > sizes
double cos(const double angle)
Point< 2 > get_surface_point() const
#define WBAssertThrow(condition, message)
SurfaceValueInfo local_value(const Point< 2 > &check_point) const
double sin(const double raw_angle)
std::vector< std::array< std::array< double, 3 >, 3 > > rotation_matrices
WorldBuilder::World * world
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)
#define WB_REGISTER_FEATURE_CONTINENTAL_PLATE_GRAINS_MODEL(classname, name)