17 for (
unsigned int i = 0; i < shapeFam.size(); i++) {
18 std::sort(shapeFam[i].radiiList.begin(),
33 std::cout <<
"\nBuilding radii lists for nPoly option...\n";
36 for (
unsigned int i = 0; i < shapeFamilies.size(); i++) {
38 shapeFamilies[i].radiiList.push_back(radius);
42 for (
unsigned int i = 0; i < shapeFamilies.size(); i++) {
45 amountToAdd = std::ceil(famProb[i] * (
nPoly - shapeFamilies.size()));
48 amountToAdd = std::ceil(famProb[i] *
nPoly);
51 addRadii(amountToAdd, i, shapeFamilies[i],
52 generator, distributions);
65 std::cout <<
"\nWARNING: " <<
shapeType(shapeFam) <<
" Family " 67 <<
" is attepting to populate fracture radii lists, however " 68 <<
"many fractures are being generated with radii less than 3*h (Minimum radius). " 69 <<
"Consider adjusting distribution parameters.\n";
84 for (
unsigned int i = 0; i < shapeFamilies.size(); i++) {
85 int amountToAdd = std::ceil(shapeFamilies[i].radiiList.size() * percent);
86 addRadii(amountToAdd, i, shapeFamilies[i], generator, distributions);
104 double minRadius = 3*
h;
106 std::uniform_real_distribution<double> uniformDist(0,1);
111 std::lognormal_distribution<double> logDistribution(shapeFam.
mean, shapeFam.
sd);
113 for (
int k = 0; k < amountToAdd; k++) {
116 radius = logDistribution(generator);
118 if (count % 1000 == 0) {
121 }
while (radius < minRadius);
128 for (
int k = 0; k < amountToAdd; k++) {
134 if (count % 1000 == 0) {
137 }
while (radius < minRadius);
144 for (
int k = 0; k < amountToAdd; k++) {
150 if (count % 1000 == 0) {
153 }
while (radius < minRadius);
174 void dryRun(std::vector<Shape> &shapeFamilies,
float *shapeProb, std::mt19937_64 &generator,
Distributions &distributions) {
176 std::cout <<
"\nEstimating number of fractures per family for defined fracture intensities (P32)...\n";
179 int totalFamilies = shapeFamilies.size();
180 int cdfSize = totalFamilies;
185 float *famProbability =
new float[totalFamilies];
186 std::copy(shapeProb, shapeProb + totalFamilies, famProbability);
189 std::uniform_real_distribution<double> uniformDist(0,1);
192 float *CDF =
createCDF(famProbability, cdfSize);
195 unsigned int forceLargeFractCount = 0;
201 int rejectCounter = 0;
207 familyIndex = forceLargeFractCount;
209 newPoly =
generatePoly_withRadius(radius, shapeFamilies[forceLargeFractCount], generator, distributions, familyIndex);
210 forceLargeFractCount++;
218 newPoly =
generatePoly(shapeFamilies[familyIndex], generator, distributions, familyIndex,
false);
240 if (reject ==
true) {
250 if (shapeFamilies[familyIndex].layer == 0) {
251 shapeFamilies[familyIndex].currentP32 += newPoly.
area*2/domVol;
254 shapeFamilies[familyIndex].currentP32 += newPoly.
area*2/
layerVol[shapeFamilies[familyIndex].layer-1];
258 shapeFamilies[familyIndex].radiiList.push_back(newPoly.
xradius);
262 if (shapeFamilies[familyIndex].currentP32 >= shapeFamilies[familyIndex].p32Target ) {
285 for (
int i = 0; i < totalFamilies; i++) {
287 shapeFamilies[i].currentP32 = 0;
std::vector< double > radiiList
void adjustCDF_and_famProb(float *&CDF, float *&famProbability, int &cdfSize, int idx2Remove)
void dryRun(std::vector< Shape > &shapeFamilies, float *shapeProb, std::mt19937_64 &generator, Distributions &distributions)
bool p32Complete(int size)
bool greaterThan(float i, float j)
double getValue(double lambda, double rv)
std::string shapeType(struct Shape &shapeFam)
float truncatedPowerLaw(float randomNum, float min, float max, float alpha)
double getArea(struct Poly &poly)
float * createCDF(float *famProb, int size)
int getFamilyNumber(int familyIndex, int familyShape)
void addRadiiToLists(float percent, std::vector< Shape > &shapeFamilies, std::mt19937_64 &generator, Distributions &distributions)
int cdfIdxFromFamNum(float *CDF, bool *p32Status, int famIdx)
struct Poly generatePoly_withRadius(double radius, struct Shape &shapeFam, std::mt19937_64 &generator, Distributions &distributions, int familyIndex)
void generateRadiiLists_nPolyOption(std::vector< Shape > &shapeFamilies, float *famProb, std::mt19937_64 &generator, Distributions &distributions)
bool domainTruncation(Poly &newPoly, double *domainSize)
void reTranslatePoly(struct Poly &newPoly, struct Shape &shapeFam, std::mt19937_64 &generator)
struct Poly generatePoly(struct Shape &shapeFam, std::mt19937_64 &generator, Distributions &distributions, int familyIndex, bool useList)
void printGeneratingFracturesLessThanHWarning(int famIndex, Shape &shapeFam)
double getLargestFractureRadius(Shape &shapeFam)
void addRadii(int amountToAdd, int famIdx, Shape &shapeFam, std::mt19937_64 &generator, Distributions &distributions)
int indexFromProb_and_P32Status(float *CDF, double roll, int famSize, int cdfSize, int &cdfIdx)
void sortRadii(std::vector< Shape > &shapeFam)