35 using namespace Utilities;
45 min_depth(NaN::
DSNAN),
50 this->
name =
"random uniform distribution";
62 "Random uniform distribution grains model. The size of the grains can be independently set " 63 "to a single value or to a random distribution.");
67 "The distance from the fault center in meters from which the composition of this feature is present.");
69 "The distance from the fault 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 "Whether the value should replace any value previously defined at this location (replace) or " 76 "add the value to the previously define value (add, not implemented). Replacing implies that all values not " 77 "explicitly defined are set to zero.");
81 "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.");
85 "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.");
94 min_depth = prm.
get<
double>(
"min distance fault center");
95 max_depth = prm.
get<
double>(
"max distance fault center");
98 operation = prm.
get<std::string>(
"orientation operation");
104 "There are not the same amount of compositions (" << compositions.size()
105 <<
") and grain_sizes (" << grain_sizes.size() <<
").");
106 WBAssertThrow(compositions.size() == normalize_grain_sizes.size(),
107 "There are not the same amount of compositions (" << compositions.size()
108 <<
") and normalize_grain_sizes (" << normalize_grain_sizes.size() <<
").");
115 const unsigned int composition_number,
129 std::uniform_real_distribution<> dist(0.0,1.0);
153 const double z = 2.0* three;
161 const double r = std::sqrt( z );
162 const double Vx =
std::sin( phi ) * r;
163 const double Vy =
std::cos( phi ) * r;
164 const double Vz = std::sqrt( 2.F - z );
170 const double st =
std::sin( theta );
171 const double ct =
std::cos( theta );
172 const double Sx = Vx * ct - Vy * st;
173 const double Sy = Vx * st + Vy * ct;
178 it_rotation_matrices[0][0] = Vx * Sx - ct;
179 it_rotation_matrices[0][1] = Vx * Sy - st;
180 it_rotation_matrices[0][2] = Vx * Vz;
182 it_rotation_matrices[1][0] = Vy * Sx + st;
183 it_rotation_matrices[1][1] = Vy * Sy - ct;
184 it_rotation_matrices[1][2] = Vy * Vz;
186 it_rotation_matrices[2][0] = Vz * Sx;
187 it_rotation_matrices[2][1] = Vz * Sy;
188 it_rotation_matrices[2][2] = 1.0 - z;
191 double total_size = 0;
192 for (
auto &&it_sizes : grains_local.
sizes)
195 total_size += it_sizes;
200 const double one_over_total_size = 1/total_size;
201 std::transform(grains_local.
sizes.begin(), grains_local.
sizes.end(), grains_local.
sizes.begin(),
202 [one_over_total_size](
double sizes) ->
double {
return sizes *one_over_total_size; });
std::mt19937 & get_random_number_engine()
std::vector< double > sizes
WorldBuilder::World * world
#define WB_REGISTER_FEATURE_FAULT_GRAINS_MODEL(classname, name)
double cos(const double angle)
double distance_from_plane
#define WBAssertThrow(condition, message)
double sin(const double raw_angle)
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)