DFNgen
2.0
DFN Model Generator
|
#include <iostream>
#include <numeric>
#include <algorithm>
#include "mathFunctions.h"
#include <math.h>
#include "structures.h"
#include "vectorFunctions.h"
#include <iomanip>
Go to the source code of this file.
Functions | |
double | sumDeviation (const double *v, int n) |
double * | sumDevAry3 (double *v) |
int | maxElmtIdx (double *v, int n) |
int * | sortedIndex (const double *v, int n) |
double | getArea (struct Poly &poly) |
int | indexFromProb (float *CDF, double roll, int size) |
int | indexFromProb_and_P32Status (float *CDF, double roll, int famSize, int cdfSize, int &cdfIdx) |
int | cdfIdxFromFamNum (float *CDF, bool *p32Status, int famIdx) |
float * | createCDF (float *famProb, int size) |
void | adjustCDF_and_famProb (float *&CDF, float *&famProbability, int &cdfSize, int idx2Remove) |
void adjustCDF_and_famProb | ( | float *& | CDF, |
float *& | famProbability, | ||
int & | cdfSize, | ||
int | idx2Remove | ||
) |
Adjusts the CDF and the famProb array. Used with P32 stopping contdition (see input file) When a family's P32 requrement is met, the CDF is adjusted to remove that family from the array. The famProb is also adjusted in the same way. Arg 1: Pointer to CDF array Arg 2: Pointer to famProb array Arg 3: Number of elements in CDF array Arg 4: Index to the element in the famProb array which is being removed
Definition at line 269 of file mathFunctions.cpp.
int cdfIdxFromFamNum | ( | float * | CDF, |
bool * | p32Status, | ||
int | famIdx | ||
) |
Given a family number, return its corresponding CDF array index Arg 1: CDF array Arg 2: p32Status array Arg 3: Family index of family whos CDF index to return Return: Index of CDF which belongs to shapeFamily[famIdx]
Definition at line 221 of file mathFunctions.cpp.
float* createCDF | ( | float * | famProb, |
int | size | ||
) |
Creates CDF from famProb[] Arg 1: Pointer to famProb array (see input file, and readInput()) Arg 2: Size of array
Definition at line 244 of file mathFunctions.cpp.
double getArea | ( | struct Poly & | poly | ) |
Calculate exact area of polygon (after truncation) Summar of algorithm: 1: Creates a point on the inside of the polygon (insidePt) 2: Uses 'insidePt' to create vectors to all outside vertices, breaking the polygon into triangles 3: Uses .5 * (magnitude of cross product) for each triangle for area calculation 4: Sums the areas for each trianlge for total area of polygon Arg 1: Polygon Return: Area of polygon
Definition at line 110 of file mathFunctions.cpp.
int indexFromProb | ( | float * | CDF, |
double | roll, | ||
int | size | ||
) |
CDF is 1 to 1 and algined with the stochastic family shapes array (std vector). This chooses the family index based on a random roll (random number between 0 and 1) and 'famProb' Arg 1: CDF of shape families based on famProb array in input file Arg 2: Random number between 0 and 1 Arg 3: Number of elements in 'CDF' array Return: Index to family based on the probability famProb
Definition at line 166 of file mathFunctions.cpp.
int indexFromProb_and_P32Status | ( | float * | CDF, |
double | roll, | ||
int | famSize, | ||
int | cdfSize, | ||
int & | cdfIdx | ||
) |
Use with fracture intensity (p32) stopping option Arg 1: Pointer to CDF array Arg 2: Random variable between 0 and 1 Arg 3: Number of stochastic families Arg 4: Number of elements in CDF array Arg 5: OUTPUT, index of CDF element which was chosen randomly Return: Index of chosen family based on its family probability, and p32Status (avoids inserting a fracture from a family which has already met it's fracture intensity requrement)
Definition at line 187 of file mathFunctions.cpp.
int maxElmtIdx | ( | double * | v, |
int | n | ||
) |
Used to find index of element with max value from array4 Used in intersectionChecking() Arg 1: Array of doubles Arg 2: Size of array Return: Max element's array index
If elements happen to be equal, returns the first one
Definition at line 68 of file mathFunctions.cpp.
int* sortedIndex | ( | const double * | v, |
int | n | ||
) |
Similar to mathematica's Ordering[] funct. Arg 1: Pointer to array of doubles Arg 2: Size of array, number of elements Return: Array of sorted indicies to elements in 'v' sorted smallest to largest
Definition at line 88 of file mathFunctions.cpp.
double* sumDevAry3 | ( | double * | v | ) |
Used in intersectionChecking() How function is used: v is a pointer to an array of 4 points, each point contains x, y, and z coordinates The 4 sumDeviation is computed on all points' x, y, and z coord. An array of three elements is returned containing the sum deviation of all x's, all y's, and all z's
Arg 1: Array of 12 elements: 4 points, {x1, y1, z1, ... , x4, y4, z4} Return: Array of 3 elements x,y,z with each stdDev, respectively
Definition at line 46 of file mathFunctions.cpp.
double sumDeviation | ( | const double * | v, |
int | n | ||
) |
There are several spots in the code which used to use standard deviation to know how to sort a list of points. To increase performance, the standard deviation is now calculated without the square root and division by N elements. Arg 1: Pointer to array which we need the sum deviation of Arg 2: Number of elements in array pointed to by arg 1 Return: The sum-deviation of array 'v'
Definition at line 19 of file mathFunctions.cpp.