DFNgen
2.0
DFN Model Generator
|
#include "output.h"
#include <fstream>
#include <stdlib.h>
#include <algorithm>
#include "input.h"
#include <iostream>
#include "structures.h"
#include "vectorFunctions.h"
#include "insertShape.h"
#include "mathFunctions.h"
#include "generatingPoints.h"
#include "computationalGeometry.h"
#include <cmath>
#include <sys/stat.h>
#include <iomanip>
#include "readInputFunctions.h"
Go to the source code of this file.
Functions | |
void | writeOutput (char *outputFolder, std::vector< Poly > &acceptedPoly, std::vector< IntPoints > &intPts, std::vector< Point > &triplePoints, struct Stats &pstats, std::vector< unsigned int > &finalFractures, std::vector< Shape > &shapeFamilies) |
void | writePoints (std::ostream &output, std::vector< Point > &points, int start, unsigned int &count) |
void | finishWritingIntFile (std::ostream &fractIntFile, int fract1, int numPoints, int numIntersections, std::vector< unsigned int > &intStart, std::vector< unsigned int > &intersectingFractures) |
bool | DIR_exists (const char *path) |
void | adjustIntFractIDs (std::vector< unsigned int > &finalFractures, std::vector< Poly > &allPolys, std::vector< IntPoints > &intPts) |
void | writeIntersectionFiles (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< IntPoints > &intPts, std::vector< Point > &triplePoints, std::string intersectionFolder, struct Stats &pstats) |
void | rotateFractures (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly) |
void | writePolysInp_old (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writePolysInp (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeParamsFile (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< Shape > &shapeFamilies, Stats &pstats, std::vector< Point > &triplePoints, std::string &output) |
void | writeApertureFile (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writePermFile (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeRadiiFile (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeFractureTranslations (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeFinalPolyRadii (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeAllAcceptedRadii (std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeAllAcceptedRadii_OfFamily (int familyNum, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeFinalRadii_OfFamily (std::vector< unsigned int > &finalFractures, int familyNum, std::vector< Poly > &acceptedPoly, std::string &output) |
void | writeTriplePts (std::vector< Point > &triplePoints, std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< IntPoints > &intPts, std::string &output) |
void | writeRejectionStats (Stats &pstats, std::string &output) |
void | writeShapeFams (std::vector< Shape > &shapeFamilies, std::string &output) |
void | makeDIR (const char *dir) |
void | writeConnectivity (std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< IntPoints > &intPts, std::string &output) |
void | writeRotationData (std::vector< Poly > &acceptedPoly, std::vector< unsigned int > &finalFractures, std::vector< Shape > &shapeFamilies, std::string output) |
void | writeRejectsPerAttempt (Stats &pstats, std::string &output) |
void adjustIntFractIDs | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | allPolys, | ||
std::vector< IntPoints > & | intPts | ||
) |
Adjust the intersectins fracture numbers. The finalFracture list is the indexes of the final polygons. If finalFractures = {4, 2, 8}, the fracture ID's must be 1, 2, 3 respectively. Easiest way is to adjust the fracture ID's in the corresponding intersections first, before writing output files Use the negative value to keep to not loose track of what fracture id's are what (prevent aliasing).
EXAMPLE: For triple intersections, each intersection lists three fractures which intersect. Say fractures 1, 5, and 6 intersect and once adjusted the the fracture IDs become 1, 4, and 5. We access the intersection structure through the polygons, so for this particular intersection structure, it will be accessed three times (once for each polygon). If we adjust ID 5 to be id 4 during the second access, then during the thrid access, ID 4 may be aliasing another ID and be adjusted again. To prevent this, we use the negative value to prevent aliasing. Arg 1: std::vector of indices to allPolys array of fractures left after isolated fracture removal Arg 2: std::vector of all accepted polygons Arg 3: std::vector of all intersections
Definition at line 218 of file output.cpp.
bool DIR_exists | ( | const char * | path | ) |
Checks if a directory already exists. Used for error checking. If DFN generation completes but user entered output folder incorrectly, the error check will let them re-enter an output folder so they wont lose the DFN data/output Arg 1: Path to directory Return: true if the directory exists, false otherwise
Definition at line 193 of file output.cpp.
void finishWritingIntFile | ( | std::ostream & | fractIntFile, |
int | fract1, | ||
int | numPoints, | ||
int | numIntersections, | ||
std::vector< unsigned int > & | intStart, | ||
std::vector< unsigned int > & | intersectingFractures | ||
) |
Helper function for writing discretized intersection points Writes header and line connections after points have been written Arg 1: Output file stream object (intersection file) Arg 2: Number, or index, of fracture whos intersection is being written Arg 3: Number of intersection points on fracture Arg 4: Number of intersections on fracture Arg 5: std:vector array of node numbers which start an intersection. Used to generate "line" connections in intersection inp files Arg 6: std::vector array of fracture id's (indices) who intersect fract1 (arg 2)
Definition at line 152 of file output.cpp.
void makeDIR | ( | const char * | dir | ) |
Creates a directory If dir already exists, the directoy will not be overwritten Arg 1: Path to directory to be created
Definition at line 991 of file output.cpp.
void rotateFractures | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly | ||
) |
Rotates all fractures to x-y plane. Used only for reduced mesh, otherwise fractures are rotated while writing intersections Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures
Definition at line 437 of file output.cpp.
void writeAllAcceptedRadii | ( | std::vector< Poly > & | acceptedPoly, |
std::string & | output | ||
) |
Deprecated Function Writes radii file (radii_AllAccepted.dat) for all accepted fractures before isolated fracture removal Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 723 of file output.cpp.
void writeAllAcceptedRadii_OfFamily | ( | int | familyNum, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Writes radii file (radii_AllAccepted_Fam_#.dat) for all accepted fractures BEFORE isolated fracture removal (one file per family) Arg 1: Family number for which radii file will be written for -2 - User Rectangles, -1 - User Ellipses, Family# >= 0 - Family in order of 'FamProb' in input file Arg 2: std::vector array of indices of fractures left after isolated fracture removal Arg 3: std::vector array of all accetped fractures Arg 4: Path to output folder
Definition at line 747 of file output.cpp.
void writeApertureFile | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Writes aperture.dat Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 573 of file output.cpp.
void writeConnectivity | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::vector< IntPoints > & | intPts, | ||
std::string & | output | ||
) |
Writes fracture connectivity edge graph Arg 1: Array of indices to polys in 'acceptedPoly' which are left after isolated fracture removal Arg 2: Array off all polygons in DFN before isolated fracture removal Arg 3: Array of all intersections in DFN Arg 4: Path to output folder
Definition at line 1021 of file output.cpp.
void writeFinalPolyRadii | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Deprecated Function Writes final radii file (after isoloated fractures have been removed) Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 699 of file output.cpp.
void writeFinalRadii_OfFamily | ( | std::vector< unsigned int > & | finalFractures, |
int | familyNum, | ||
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Writes radii file (radii_AllAccepted_Fam_#.dat) for all accepted fractures AFTER isolated fracture removal (one file per family) Arg 1: Family number for which radii file will be written for -2 - User Rectangles, -1 - User Ellipses, Family# >= 0 - Family in order of 'FamProb' in input file Arg 2: std::vector array of indices of fractures left after isolated fracture removal Arg 3: std::vector array of all accetped fractures Arg 4: Path to output folder
Definition at line 772 of file output.cpp.
void writeFractureTranslations | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Wrtes translations file (translations.dat) Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 659 of file output.cpp.
void writeIntersectionFiles | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::vector< IntPoints > & | intPts, | ||
std::vector< Point > & | triplePoints, | ||
std::string | intersectionFolder, | ||
struct Stats & | pstats | ||
) |
Writes intersection inp files to output folder Rotates intersections, and triple intersection points to x-y plane Also rotates polygons to x-y plane to save on computation during writePolysInp() Rotating polygons here increases performance as we do not need to recalculate rotation matricies Arg 1: std::vector array of indices to fractures (Arg 2) remaining after isolated fracture removal Arg 2: std::vector array of all accepted fractures (before isolated fracture removal) Arg 3: std::vector array of all intersections Arg 4: std::vector array all triple intersection points Arg 5: Path to intersections folder Arg 6: Stats strcture. DFNGen running program stats (keeps track of total intersecion node count)
Definition at line 248 of file output.cpp.
void writeOutput | ( | char * | outputFolder, |
std::vector< Poly > & | acceptedPoly, | ||
std::vector< IntPoints > & | intPts, | ||
std::vector< Point > & | triplePoints, | ||
struct Stats & | pstats, | ||
std::vector< unsigned int > & | finalFractures, | ||
std::vector< Shape > & | shapeFamilies | ||
) |
Writes all output for DFNGen Arg 1: c syle string (char array) path to output folder Arg 2: std::vector Poly array of all accepted polygons Arg 3: std::vector Intersection array of all intersections from accepted polygons Arg 4: std::vector Point array of all accpeted triple intersection points Arg 5: Stats strcuture, running program statistucs (see definition in structures.h) Arg 6: std::vector of unsigned int - indices into the Poly array of accepted polgons which remain after isolated fractures (polys) were removed Arg 7: std::vector Shape - Family structure array of all stocastic families defined by user input
Definition at line 31 of file output.cpp.
void writeParamsFile | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::vector< Shape > & | shapeFamilies, | ||
Stats & | pstats, | ||
std::vector< Point > & | triplePoints, | ||
std::string & | output | ||
) |
Writes params.txt Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: std::vector array of fracture families Arg 4: Path to output folder
Definition at line 551 of file output.cpp.
void writePermFile | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Writes perm.dat (Permeability Data) Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 594 of file output.cpp.
void writePoints | ( | std::ostream & | output, |
std::vector< Point > & | points, | ||
int | start, | ||
unsigned int & | count | ||
) |
Helper function for writing discretized intersections Function writes n points to file Arg 1: Output file stream object (file we are writing to) Arg 2: std::vector Point array (discretized points) Arg 3: Index to point to start output to file. ARG 3 USAGE EAMPLE: When discretizing points, the program can discretize from an end point to a triple intersection point, and then from the triple intersection point to another end point. This means you have two arrays of points. The last point in the first array will be the same as the first point in the second array. In this situation, you would set start = 1 while writing the second array to avoid duplicate points in the output Arg 4: Counter of poitns written. Used to rember at which node a new intersection starts
Definition at line 133 of file output.cpp.
void writePolysInp | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Parses and writes all poly_x.inp files containing polygon (fracture) vertice and connectivity data Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 510 of file output.cpp.
void writePolysInp_old | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Writes polys.inp file containing all polygon (fracture) vertice and connectivity data Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 457 of file output.cpp.
void writeRadiiFile | ( | std::vector< unsigned int > & | finalFractures, |
std::vector< Poly > & | acceptedPoly, | ||
std::string & | output | ||
) |
Writes radii.dat (Radii Data) Arg 1: std::vector array of indices of fractures left after isolated fracture removal Arg 2: std::vector array of all accetped fractures Arg 3: Path to output folder
Definition at line 617 of file output.cpp.
void writeRejectionStats | ( | Stats & | pstats, |
std::string & | output | ||
) |
Write rejections.dat, rejection statistics Arg 1: Stats structure of program statistics Arg 2: Path to output folder
Definition at line 859 of file output.cpp.
void writeRejectsPerAttempt | ( | Stats & | pstats, |
std::string & | output | ||
) |
Writes rejectsPerAttempt.dat Outputs a file that contains a list of integers of the number of attempts per fracture. For example, if the 5th number in the list is 100, it means that it took 100 fracture insertion attemps for before the 5th fracture was accepted. Arg 1: Stats structure, program statistics Arg 2: Path to output
Definition at line 1147 of file output.cpp.
void writeRotationData | ( | std::vector< Poly > & | acceptedPoly, |
std::vector< unsigned int > & | finalFractures, | ||
std::vector< Shape > & | shapeFamilies, | ||
std::string | output | ||
) |
Writes poly_info.dat Writes fracture rotation data. Also includes shape families each fracture belongs to. Arg 1: Array off all polygons in DFN before isolated fracture removal Arg 2: Array of indices to polys in 'acceptedPoly' which are left after isolated fracture removal Arg 3: Array of all fracture shape families Arg 4: Path to output folder
Definition at line 1067 of file output.cpp.
void writeShapeFams | ( | std::vector< Shape > & | shapeFamilies, |
std::string & | output | ||
) |
Writes families.dat, Shape families definition file Arg 1: std::vector array of all fracture shape families Arg 2: Path to output folder
Definition at line 882 of file output.cpp.
void writeTriplePts | ( | std::vector< Point > & | triplePoints, |
std::vector< unsigned int > & | finalFractures, | ||
std::vector< Poly > & | acceptedPoly, | ||
std::vector< IntPoints > & | intPts, | ||
std::string & | output | ||
) |
Writes triple intersection points to file (triple_Points.dat) Arg 1: std::vector array of all triple intersection points Arg 2: std::vector array of indices of fractures left after isolated fracture removal Arg 3: std::vector array of all accetped fractures Arg 4: std::vector array of all intersections Arg 5: Path to output folder
Definition at line 797 of file output.cpp.