DFNgen  2.0
DFN Model Generator
output.cpp
Go to the documentation of this file.
1 #include "output.h"
2 #include <fstream>
3 #include <stdlib.h> // remove dir
4 #include <algorithm>
5 #include "input.h"
6 #include <iostream>
7 #include "structures.h"
8 #include "vectorFunctions.h"
9 #include "insertShape.h" // getFamilyNum()
10 #include "mathFunctions.h"
11 #include "generatingPoints.h"
12 #include "computationalGeometry.h" // Rotation matrix functions
13 #include <cmath>
14 #include <sys/stat.h> // Checking if output directory exists DIR_exists(dir)
15 #include <iomanip> // std::setprecision()
16 #include <sys/stat.h> // mkdir system call
17 #include "readInputFunctions.h" // error check for file open checkIfOpen()
18 
19 //NOTE: do not use std::endl for new lines when writing to files. This will flush the output buffer. Use '\n'
20 
21 /* void writeOutput() ************************************************************************/
31 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) {
32 
33  std::string output = outputFolder;
34 
35  // Define Output Files:
36  std::string permOutputFile = output + "/perm.dat";
37  std::string aperture = output + "/aperture.dat";
38  std::string intersectionFolder = output + "/intersections";
39  std::string radiiFolder = output + "/radii/";
40 
41  // Create intersections folder
42  //makeDIR(intersectionFolder.c_str());
43  // Write intersection files (must be first file written, rotates polys to x-y plane)
44  writeIntersectionFiles(finalFractures, acceptedPoly, intPts, triplePoints, intersectionFolder, pstats);
45  // Write polys.inp
46  writePolysInp(finalFractures, acceptedPoly, output);
47  // Write params.txt
48  writeParamsFile(finalFractures, acceptedPoly, shapeFamilies, pstats, triplePoints, output);
49  // Write aperture file
50  writeApertureFile(finalFractures, acceptedPoly, output);
51  // Write permability file
52  writePermFile(finalFractures, acceptedPoly, output);
53  // Write radii file
54  writeRadiiFile(finalFractures, acceptedPoly, output);
55  // Write rejection stats file
56  writeRejectionStats(pstats, output);
57  // Write families to output Files
58  writeShapeFams(shapeFamilies, output);
59  // Write fracture translations file
60  writeFractureTranslations(finalFractures, acceptedPoly, output);
61  // Write fracture connectivity (edge graph) file
62  writeConnectivity(finalFractures, acceptedPoly, intPts, output);
63  // Write rotation data
64  writeRotationData(acceptedPoly, finalFractures, shapeFamilies, output);
65  // Write rejects per fracture insertion attempt data
66  writeRejectsPerAttempt(pstats, output);
67  // Write all accepted radii, for Nataliia
68  writeFinalPolyRadii(finalFractures, acceptedPoly, output);
69 
71  std::cout << "Writing Accepted Radii Files Per Family\n";
72  // Creates radii files per family, before isolated fracture removal.
73  int size = shapeFamilies.size();
74  for (int i = 0; i < size; i++) {
75  writeAllAcceptedRadii_OfFamily(i, acceptedPoly, radiiFolder);
76  }
77 
78  if (userRectanglesOnOff) {
79  // Fractures are marked -2 for user rects
80  writeAllAcceptedRadii_OfFamily(-2, acceptedPoly, radiiFolder);
81  }
82 
83  if (userEllipsesOnOff) {
84  // Fractures are marked -1 for user ellipses
85  writeAllAcceptedRadii_OfFamily(-1, acceptedPoly, radiiFolder);
86  }
87  }
88 
89 
91 
92  std::cout << "Writing Final Radii Files Per Family\n";
93 
94  int size = shapeFamilies.size();
95  for (int i = 0; i < size; i++) {
96  writeFinalRadii_OfFamily(finalFractures, i, acceptedPoly, radiiFolder);
97  }
98 
99  if (userRectanglesOnOff) {
100  writeFinalRadii_OfFamily(finalFractures, -2, acceptedPoly, radiiFolder);
101  }
102 
103  if (userEllipsesOnOff) {
104  writeFinalRadii_OfFamily(finalFractures, -1, acceptedPoly, radiiFolder);
105  }
106  }
107 
108  // If triple intersections are on, write triple intersection points file
109  if (tripleIntersections) {
110  std::cout << "Writing Triple Intersection Points File\n";
111  writeTriplePts(triplePoints, finalFractures, acceptedPoly, intPts, output);
112  }
113 
114 } // End writeOutput()
115 
116 
117 /*================================= OUTPUT.CPP FUNCTIONS ================================*/
118 /*===========================================================================================*/
119 
120 
121 /* void writePoints() ************************************************************************/
133 void writePoints(std::ostream &output, std::vector<Point> &points, int start, unsigned int &count){
134  int n=points.size();
135  for (int i = start; i < n; i++) {
136  output << std::setprecision(13) << count << " " << points[i].x
137  << " " << points[i].y << " " << points[i].z<< "\n";
138  count++;
139  }
140 }
141 
142 /* finishWritingIntFile() ********************************************************************/
152 void finishWritingIntFile(std::ostream &fractIntFile, int fract1, int numPoints, int numIntersections,
153  std::vector<unsigned int> &intStart, std::vector<unsigned int> &intersectingFractures){
154 
155  unsigned int count=1;
156  int idx = 0;
157 
158  // Lines
159  for (int i = 0; i<numPoints-numIntersections; i++){
160  if(intStart[idx] == count+1){
161  count++;
162  idx++;
163  }
164  fractIntFile<< i+1 << " " <<fract1<< " line " <<count<< " " <<count+1<< "\n";
165  count++;
166  }
167 
168  fractIntFile<< "2 1 1\n";
169  fractIntFile<< "a_b, integer\n";
170  fractIntFile<< "b_a, integer\n";
171  idx=0;
172  for (int i=0; i<numPoints; i++){
173  if(intStart[idx] == (unsigned) i+1){
174  idx++;
175  }
176  fractIntFile<<i+1<< " " <<fract1<< " " <<intersectingFractures[idx]<< "\n";
177  }
178 
179  // Move to header postion
180  fractIntFile.seekp(0);
181  fractIntFile<<numPoints<< " " <<numPoints - numIntersections<< " " <<2<< " " << "0 0";
182 }
183 
184 
185 
186 /* bool DIR_exists() *************************************************************************/
193 bool DIR_exists(const char *path){
194  struct stat sb;
195 
196  if ((stat(path, &sb) == 0 && S_ISDIR(sb.st_mode))) {
197  return 1;
198  }
199 return 0;
200 }
201 
202 
203 /* adjustIntFractIds() **********************************************************************/
218 void adjustIntFractIDs(std::vector<unsigned int> &finalFractures, std::vector<Poly> &allPolys, std::vector<IntPoints> &intPts){
219  //go through all final fractures
220  for (unsigned int i = 0; i < finalFractures.size(); i++){
221  //go through each final fractures intersections
222  for (unsigned int j = 0; j < allPolys[finalFractures[i]].intersectionIndex.size(); j++){
223  //change matching fracture numbers to new number (order of finalFractures list) for output
224  unsigned int intIdx = allPolys[finalFractures[i]].intersectionIndex[j];
225  if (intPts[intIdx].fract1 == finalFractures[i]){
226  intPts[intIdx].fract1 = -( (long int) i+1);
227  }
228  else if (intPts[intIdx].fract2 == finalFractures[i]){
229  intPts[intIdx].fract2 = -( (long int) i+1);
230  }
231  }
232  }
233 }
234 
235 
236 /* writeIntersectionFiles() ******************************************************************/
248 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) {
249 
250  Point tempPoint1, tempPoint2; // Keeps track of current un-rotated points we are working with
251 
252  std::cout << "\nWriting Intersection Files\n";
253 
254  adjustIntFractIDs(finalFractures,acceptedPoly, intPts);
255 
256  std::ofstream fractIntFile;
257 
258  // Go through finalFractures. Rotate poly, intersections, and triple intersection points
259  // to XY plane. Discretize and write to file
260  for (unsigned int i = 0; i < finalFractures.size(); i++){
261 
262  // Starting positions for each intersection. Lets us know how to make the line connections
263  std::vector<unsigned int> intStart;
264  unsigned int count = 1;
265 
266  // Counter for intersection header number of points
267  unsigned int numIntPts = 0;
268  // Used in wiring which nodes belong to which two fractures in finishWritingOutput()
269  std::vector<unsigned int> intersectingFractures;
270 
271  // Make new intersection file in intersections folder
272  std::string file = intersectionFolder + "/intersections_" + std::to_string(i+1) + ".inp";
273  fractIntFile.open(file.c_str(), std::ofstream::out | std::ofstream::trunc);
274 
275  checkIfOpen(fractIntFile, file);
276 
277  // Buffer first line to leave space to write header
278  fractIntFile<< " \n";
279 
280  // Go through each final fracture's intersections and write to output
281  unsigned int size = acceptedPoly[finalFractures[i]].intersectionIndex.size();
282  for (unsigned int j = 0; j < size; j++){
283 
284  // tempTripPts holds rotated triple points for an intersection. Triple pts must be rotated 3 different
285  // ways so we cannot change the original data
286  std::vector<Point> tempTripPts;
287 
288  // Used to measure current length before rotation (used to calculate number of points
289  // to discretize) based on original intersection. This fixes any precision errors we
290  // when calculating length after rotation, both rotations for the same intersection will
291  // always have the same step size and same number of discretized points.
292  double curLength = 0;
293 
294  unsigned int polyIntIdx = acceptedPoly[finalFractures[i]].intersectionIndex[j];
295 
296  // Similarly to above, the intersection must be rotated two different ways,
297  // one for each intersecting poly. We can't change the original data so we must use temp data
298  IntPoints tempIntersection = polyAndIntersection_RotationToXY(intPts[polyIntIdx],
299  acceptedPoly[finalFractures[i]], triplePoints, tempTripPts);
300  // poly and intersection now rotated
301 
302  int triplePtsSize = tempTripPts.size();
303 
304  // fracture 1 is i
305  // fracture 2 is the other intersecting fracture
306  unsigned int fract2;
307  if (intPts[polyIntIdx].fract1 == -(i+1)){
308  fract2 = -intPts[polyIntIdx].fract2;
309  intersectingFractures.push_back(fract2);
310  }
311  else {
312  fract2 = -intPts[polyIntIdx].fract1;
313  intersectingFractures.push_back(fract2);
314  }
315  // If triple points exist on intersection, discretize from endpoint to closest triple point,
316  // from triple to next triple point, and finally to other end point
317  if (triplePtsSize != 0) {
318 
319  // Keep track of number of triple points which will be in the
320  // DFN (this is after isolated fracture removal)
321  // NOTE: This will need to be divided by six to get correct value.
322  // Division by six was determined through testing.
323  pstats.tripleNodeCount += triplePtsSize;
324 
325  // Order the triple points by distances to know to discretize from point to next closest point
326  double *distances = new double[triplePtsSize];
327 
328  double pt1[3] = {tempIntersection.x1, tempIntersection.y1, tempIntersection.z1};
329  tempPoint1.x = intPts[polyIntIdx].x1;
330  tempPoint1.y = intPts[polyIntIdx].y1;
331  tempPoint1.z = intPts[polyIntIdx].z1;
332  // Create array of distances first end point to triple points
333  for (int k = 0; k < triplePtsSize; k++) { //loop through triple points on intersection i
334  double point[3] = {tempTripPts[k].x, tempTripPts[k].y, tempTripPts[k].z};//triple pt
335  distances[k] = euclideanDistance(pt1, point);//create array of distances
336  }
337 
338  // Order the indices of the distances array shortest to largest distance
339  // this lets us know which point to discritize to next
340  int *s = sortedIndex(distances, triplePtsSize);
341 
342  // Discretize from end point1 to first triple pt
343  // pt1 already = enpoint1
344  double pt2[3] = {tempTripPts[s[0]].x, tempTripPts[s[0]].y, tempTripPts[s[0]].z};
345  tempPoint2 = triplePoints[intPts[polyIntIdx].triplePointsIdx[s[0]]];
346  curLength = euclideanDistance(tempPoint1, tempPoint2);
347  std::vector<Point> points = discretizeLineOfIntersection(pt1, pt2, curLength);
348 
349  // Write points to file
350  numIntPts += points.size();
351  writePoints(fractIntFile, points, 0, count);
352 
353  // If one trip pt, set up points to discretize from only triple pt to other end point
354  if (triplePtsSize == 1){
355  pt1[0] = pt2[0]; pt1[1]=pt2[1]; pt1[2]=pt2[2];
356  pt2[0]=tempIntersection.x2; pt2[1]=tempIntersection.y2; pt2[2]=tempIntersection.z2;
357 
358  tempPoint1 = tempPoint2;
359  tempPoint2.x = intPts[polyIntIdx].x2;
360  tempPoint2.y = intPts[polyIntIdx].y2;
361  tempPoint2.z = intPts[polyIntIdx].z2;
362  }
363  else { // More than 1 triple point
364  for (int jj=0; jj < (triplePtsSize-1); jj++){
365 
366  pt1[0] = tempTripPts[s[jj]].x; pt1[1]=tempTripPts[s[jj]].y; pt1[2]=tempTripPts[s[jj]].z;
367  pt2[0] = tempTripPts[s[jj+1]].x; pt2[1]=tempTripPts[s[jj+1]].y; pt2[2]=tempTripPts[s[jj+1]].z;
368 
369  tempPoint1 = triplePoints[intPts[polyIntIdx].triplePointsIdx[s[jj]]];
370  tempPoint2 = triplePoints[intPts[polyIntIdx].triplePointsIdx[s[jj+1]]];
371  curLength = euclideanDistance(tempPoint1, tempPoint2);
372  points = discretizeLineOfIntersection(pt1, pt2, curLength);
373 
374  // Write points for first fracture to file, save second set of points to temp
375  numIntPts += points.size()-1;
376  writePoints(fractIntFile, points, 1, count);
377  }
378  // Set up points to go from last triple point to last endpoint
379  pt1[0]=pt2[0]; pt1[1]=pt2[1]; pt1[2]=pt2[2];
380  pt2[0]=tempIntersection.x2; pt2[1]=tempIntersection.y2; pt2[2]=tempIntersection.z2;
381 
382  tempPoint1 = tempPoint2;
383  tempPoint2.x = intPts[polyIntIdx].x2;
384  tempPoint2.y = intPts[polyIntIdx].y2;
385  tempPoint2.z = intPts[polyIntIdx].z2;
386 
387  }
388  curLength = euclideanDistance(tempPoint1, tempPoint2);
389  points = discretizeLineOfIntersection(pt1, pt2, curLength);
390 
391  numIntPts += points.size()-1;
392  writePoints(fractIntFile, points, 1, count);
393 
394  delete[] s; // Need to delete these manually. created with new[]
395  delete[] distances;
396  }
397  else { // No triple intersection points on intersection line
398  double pt1[3] = {tempIntersection.x1, tempIntersection.y1, tempIntersection.z1};
399  double pt2[3] = {tempIntersection.x2, tempIntersection.y2, tempIntersection.z2};
400  tempPoint1.x = intPts[polyIntIdx].x1;
401  tempPoint1.y = intPts[polyIntIdx].y1;
402  tempPoint1.z = intPts[polyIntIdx].z1;
403 
404  tempPoint2.x = intPts[polyIntIdx].x2;
405  tempPoint2.y = intPts[polyIntIdx].y2;
406  tempPoint2.z = intPts[polyIntIdx].z2;
407 
408  curLength = euclideanDistance(tempPoint1, tempPoint2);
409  std::vector<Point> points = discretizeLineOfIntersection(pt1, pt2, curLength);
410  numIntPts += points.size();
411  writePoints(fractIntFile, points, 0, count);
412  }
413 
414  intStart.push_back(count);
415  }
416  // Done with fracture and intersections
417 
418  pstats.intersectionNodeCount += numIntPts;
419 
420 
421  // Write line connectivity and header
422  finishWritingIntFile(fractIntFile, i+1, numIntPts, size, intStart, intersectingFractures);
423  intersectingFractures.clear();
424  intStart.clear();
425  fractIntFile.close();
426  }
427 
428  //Divide by 6 to remove the duplicate counts
429  pstats.tripleNodeCount /= 6;
430 }
431 
432 /* rotateFractures() **************************************************************************/
437 void rotateFractures(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly) {
438 
439  for (unsigned int i = 0; i < finalFractures.size(); i++) {
440 
441  if (acceptedPoly[finalFractures[i]].XYPlane == true) {
442  continue; // Go to next interation of loop
443  }
444 
445  acceptedPoly[finalFractures[i]].XYPlane = true;
446 
447  double normalB[3] = {0,0,1};
448  applyRotation3D(acceptedPoly[finalFractures[i]], normalB);
449  }
450 }
451 
452 /* writePolysInp() ****************************************************************************/
457 void writePolysInp_old(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output){
458 
459  std::ofstream polyOutput;
460  std::string polyOutputFile = output+"/polys.inp";
461  polyOutput.open(polyOutputFile.c_str(), std::ofstream::out | std::ofstream::trunc);
462  checkIfOpen(polyOutput, polyOutputFile);
463  std::cout << "Writing " << polyOutputFile << "\n";
464 
465  unsigned long long int vertexCount = 0;
466 
467  //HEADER
468  for (unsigned int j = 0; j < finalFractures.size(); j++){ // Count vertices
469  vertexCount += acceptedPoly[finalFractures[j]].numberOfNodes;
470  }
471 
472  polyOutput << vertexCount << " " << vertexCount - finalFractures.size() << " 0" << " 0" << " 0" << "\n";
473 
474  int count = 1;
475  int polyCount = finalFractures.size();
476  for (int j = 0; j<polyCount; j++){
477 
478  // Write vertices
479  for (int i = 0; i < acceptedPoly[finalFractures[j]].numberOfNodes; i++) {
480  int idx = i*3;
481  polyOutput << std::setprecision(15) << count << " "
482  << acceptedPoly[finalFractures[j]].vertices[idx] << " "
483  << acceptedPoly[finalFractures[j]].vertices[idx+1] << " "
484  << acceptedPoly[finalFractures[j]].vertices[idx+2] << "\n";
485  count++;
486  }
487  }
488 
489  // Write line connectivity
490  count = 1;// Counter for node numbers
491  int count2 = 1;// Counter for lines written
492  int j;
493  for (j = 0; j<polyCount; j++){
494  for (int i = 0; i < acceptedPoly[finalFractures[j]].numberOfNodes-1; i++) {
495  polyOutput << count2<< " " << j+1 << " line " << count << " " <<count+1<< "\n";
496  count++;
497  count2++;
498  }
499  count++;
500  }
501 
502  polyOutput.close(); // Done with polygons inp file
503 }
504 
505 /* writePolysInp() ****************************************************************************/
510 void writePolysInp(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output) {
511 
512  std::ofstream polyOutput;
513  std::cout << "Writing poly inp files\n";
514 
515  int polyCount = finalFractures.size();
516 
517  for (int j = 0; j < polyCount; j++) {
518  std::string polyOutputFile = output + "/polys/poly_" + std::to_string(j+1) + ".inp";
519  polyOutput.open(polyOutputFile.c_str(), std::ofstream::out | std::ofstream::trunc);
520 
521  // Write header
522  polyOutput << acceptedPoly[finalFractures[j]].numberOfNodes << " "
523  << acceptedPoly[finalFractures[j]].numberOfNodes-1 << " 0" << " 0" << " 0 " << "\n";
524 
525  // Write vertices
526  int numberOfNodes = acceptedPoly[finalFractures[j]].numberOfNodes;
527  for (int i = 0; i < numberOfNodes; i++) {
528  int idx = i*3;
529  polyOutput << std::setprecision(15) << i+1 << " "
530  << acceptedPoly[finalFractures[j]].vertices[idx] << " "
531  << acceptedPoly[finalFractures[j]].vertices[idx+1] << " "
532  << acceptedPoly[finalFractures[j]].vertices[idx+2] << "\n";
533  }
534 
535  // Write line connectivity
536  for (int i = 1; i < numberOfNodes; i++) {
537  polyOutput << i << " " << j+1 << " line " << i << " " << i+1 << "\n";
538  }
539  polyOutput.close();
540  }
541 
542 
543 }
544 
545 /* writeParamsFile() **************************************************************************/
551 void writeParamsFile(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::vector<Shape> &shapeFamilies, Stats &pstats, std::vector<Point> &triplePoints, std::string &output) {
552 
553  std::ofstream params;
554  std::string paramsOutputFile = output+"/params.txt";
555  params.open(paramsOutputFile.c_str(), std::ofstream::out | std::ofstream::trunc);
556  checkIfOpen(params, paramsOutputFile);
557  std::cout << "Writing " << paramsOutputFile << "\n";
558  params << finalFractures.size() << "\n";
559  params << h << "\n";
560 
561  params << visualizationMode << "\n"; // Production mode
562  params << pstats.intersectionNodeCount/2 - pstats.tripleNodeCount << "\n";
563 
564  params.close();
565 }
566 
567 
568 /* writeApertureFile() ************************************************************************/
573 void writeApertureFile(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output) {
574  std::string file = output+"/aperture.dat";
575  std::ofstream ap;
576  ap.open(file.c_str(), std::ofstream::out | std::ofstream::trunc);
577  checkIfOpen(ap, file);
578  std::cout << "Writing aperture.dat\n";
579  ap<< "aperture.dat" << "\n";
580 
581  int size = finalFractures.size();
582  for (int i = 0; i < size; i++) {
583  ap << -(7+i) << " 0 0 " << std::setprecision(10) << acceptedPoly[finalFractures[i]].aperture << "\n";
584  }
585 
586  ap.close();
587 }
588 
589 /* writePermFile() ****************************************************************************/
594 void writePermFile(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output) {
595  std::string file = output+"/perm.dat";
596  std::ofstream perm;
597  perm.open(file.c_str(), std::ofstream::out | std::ofstream::trunc);
598  checkIfOpen(perm, file);
599  std::cout << "Writing perm.dat\n";
600  perm<< "permeabiliy" << "\n";
601 
602  int size = finalFractures.size();
603  for (int i = 0; i < size; i++) {
604  perm << -(7+i) << " 0 0 " << std::setprecision(10) << acceptedPoly[finalFractures[i]].permeability << " " <<acceptedPoly[finalFractures[i]].permeability<< " " <<acceptedPoly[finalFractures[i]].permeability<< "\n";
605 
606  }
607 
608  perm.close();
609 }
610 
611 
612 /* writeRadiiFile() ***************************************************************************/
617 void writeRadiiFile(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output) {
618 
619  std::cout << "Writing Radii File (radii.dat)\n";
620 
621  std::string file = output+"/radii.dat";
622  std::ofstream radii;
623  radii.open(file.c_str(), std::ofstream::out | std::ofstream::trunc);
624  checkIfOpen(radii, file);
625  radii << "Format: xRadius yRadius Family# Removed (-1 = userRectangle, 0 = userEllipse, > 0 is family in order of famProb)\n";
626 
627  unsigned int finalFractLimit = finalFractures.size() - 1;
628  unsigned int size = acceptedPoly.size();
629  unsigned int curFinalIdx = 0;
630 
631  if (finalFractures.size() <= 0) return;
632 
633  for (unsigned int i = 0; i < size; i++) {
634  radii << std::setprecision(8) << acceptedPoly[i].xradius << " " << acceptedPoly[i].yradius
635  << " " << acceptedPoly[i].familyNum+1;
636 
637  // If poly is not in finalFractures list
638  // mark that is was removed
639  if (i != finalFractures[curFinalIdx]) {
640  radii << " R\n";
641  }
642  else {
643  if (curFinalIdx < finalFractLimit) {
644  curFinalIdx++;
645  }
646  radii << "\n";
647  }
648 
649  }
650  radii.close();
651 }
652 
653 
654 /* writeFractureTranslations() ****************************************************************/
659 void writeFractureTranslations(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output) {
660 
661  std::cout << "Writing Fracture Translations File (translations.dat)\n";
662  std::string filePath = output + "/translations.dat";
663  std::ofstream file;
664  file.open(filePath.c_str(), std::ofstream::out | std::ofstream::trunc);
665  checkIfOpen(file, filePath);
666  file << "Format: x y z (R = removed from domain due to fracture isolation)\n";
667 
668  unsigned int finalFractLimit = finalFractures.size() - 1;
669  unsigned int size = acceptedPoly.size();
670  unsigned int curFinalIdx = 0;
671 
672  if (finalFractures.size() <= 0) return;
673 
674  for (unsigned int i = 0; i < size; i++) {
675  file << std::setprecision(10) << acceptedPoly[i].translation[0] << " "
676  << acceptedPoly[i].translation[1] << " " << acceptedPoly[i].translation[2];
677 
678  // If poly is not in finalFractures list
679  // mark that is was removed
680  if (i != finalFractures[curFinalIdx]) {
681  file << " R\n";
682  }
683  else {
684  if (curFinalIdx < finalFractLimit) {
685  curFinalIdx++;
686  }
687  file << "\n";
688  }
689  }
690  file.close();
691 }
692 
693 /* writeFinalPolyRadii() **********************************************************************/
699 void writeFinalPolyRadii(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::string &output){
700  std::string file = output + "/radii_Final.dat";
701  std::ofstream radiiFinal;
702  radiiFinal.open(file.c_str(), std::ofstream::out | std::ofstream::trunc);
703  checkIfOpen(radiiFinal, file);
704  radiiFinal << "Fracture Radii List After Isolated Fracture and Cluster Removal\n";
705  radiiFinal << "Format: xRadius yRadius Family# (-1 = userRectangle, 0 = userEllipse, > 0 is family in order of famProb)\n";
706 
707  int size = finalFractures.size();
708  for (int i = 0; i < size; i++) {
709  radiiFinal << acceptedPoly[finalFractures[i]].xradius << " "
710  << acceptedPoly[finalFractures[i]].yradius << " "
711  << acceptedPoly[finalFractures[i]].familyNum + 1 << "\n";
712  }
713  radiiFinal.close();
714 }
715 
716 
717 /* writeAllAcceptedRadii() ********************************************************************/
723 void writeAllAcceptedRadii(std::vector<Poly> &acceptedPoly, std::string &output){
724  std::string file = output + "/radii_AllAccepted.dat";
725  std::ofstream radiiAcpt;
726  radiiAcpt.open(file.c_str(), std::ofstream::out | std::ofstream::trunc);
727  checkIfOpen(radiiAcpt, file);
728  radiiAcpt << "Fracture Radii List Before Isolated Fracture and Cluster Removal\n";
729  radiiAcpt << "Format: xRadius yRadius Distrubution# (-1 = userRectangle, 0 = userEllipse, > 0 is family in order of famProb)\n";
730 
731  int size = acceptedPoly.size();
732  for (int i = 0; i < size; i++) {
733  radiiAcpt << acceptedPoly[i].xradius << " " << acceptedPoly[i].yradius << " " <<acceptedPoly[i].familyNum+1 << "\n";
734  }
735  radiiAcpt.close();
736 }
737 
738 
739 /* writeAllAcceptedRadii_OfFamily() ***********************************************************/
747 void writeAllAcceptedRadii_OfFamily(int familyNum, std::vector<Poly> &acceptedPoly, std::string &output){
748  std::string fileName = output + "/radii_AllAccepted_Fam_" + std::to_string(familyNum + 1) + ".dat";
749  std::ofstream file;
750  file.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
751  checkIfOpen(file, fileName);
752  file << "Fracture Radii List Before Isolated Fracture and Cluster Removal (Family " << familyNum+1 << ")\n";
753  file << "Format: xRadius yRadius Distrubution# (-1 = userRectangle, 0 = userEllipse, > 0 is family in order of famProb)\n";
754 
755  int size = acceptedPoly.size();
756  for (int i = 0; i < size; i++) {
757  if (acceptedPoly[i].familyNum == familyNum) {
758  file << acceptedPoly[i].xradius << " " << acceptedPoly[i].yradius << " " <<acceptedPoly[i].familyNum+1 << "\n";
759  }
760  }
761  file.close();
762 }
763 
764 /* writeAllAcceptedRadii_OfFamily() ***********************************************************/
772 void writeFinalRadii_OfFamily(std::vector<unsigned int> &finalFractures, int familyNum, std::vector<Poly> &acceptedPoly, std::string &output){
773  std::string fileName = output+"/radii_Final_Fam_" + std::to_string(familyNum + 1) + ".dat";
774  std::ofstream file;
775  file.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
776  checkIfOpen(file, fileName);
777  file << "Fracture Radii List After Isolated Fracture and Cluster Removal (Family " << familyNum+1 << ")\n";
778  file << "Format: xRadius yRadius Distrubution# (-1 = userRectangle, 0 = userEllipse, > 0 is family in order of famProb)\n";
779 
780  int size = finalFractures.size();
781  for (int i = 0; i < size; i++) {
782  if (acceptedPoly[finalFractures[i]].familyNum == familyNum) {
783  file << acceptedPoly[finalFractures[i]].xradius << " " << acceptedPoly[finalFractures[i]].yradius << " " <<acceptedPoly[finalFractures[i]].familyNum+1 << "\n";
784  }
785  }
786  file.close();
787 }
788 
789 
790 /* writeAllAcceptedRadii_OfFamily() ***********************************************************/
797 void writeTriplePts(std::vector<Point> &triplePoints, std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::vector<IntPoints> &intPts, std::string &output) {
798 
799 
800  std::string fileName = output + "/triple_points.dat";
801  std::ofstream file;
802  file.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
803  checkIfOpen(file, fileName);
804 
805  // Save triple point indices from final list of fractures to temp array
806  // There will be duplicates which need to be removed
807  // before writing to file
808  std::vector<unsigned int> triplePtsList;
809 
810  int size = finalFractures.size();
811  for (int i = 0; i < size; i++) {
812  int intersectCount = acceptedPoly[finalFractures[i]].intersectionIndex.size();
813  for (int j = 0; j < intersectCount; j++) {
814  int tripleSize = intPts[acceptedPoly[finalFractures[i]].intersectionIndex[j]].triplePointsIdx.size();
815  for (int k = 0; k < tripleSize; k++) {
816  int triplePtIdx = intPts[acceptedPoly[finalFractures[i]].intersectionIndex[j]].triplePointsIdx[k];
817  triplePtsList.push_back(triplePtIdx);
818  }
819  }
820  }
821 
822  size = triplePtsList.size();
823 
824  if (size > 0) {
825 
826  //remove duplicates
827  std::sort(triplePtsList.begin(), triplePtsList.end());
828  std::vector<unsigned int> finalPts;
829  unsigned int prevPt = triplePtsList[0];
830  finalPts.push_back(prevPt);
831  for (int i = 1; i < size; i++) {
832  unsigned int curPt = triplePtsList[i];
833  if (curPt != prevPt) {
834  finalPts.push_back(curPt);
835  }
836  prevPt = curPt;
837  }
838 
839  triplePtsList.clear();
840 
841 
842  size = finalPts.size();
843  for (int i = 0; i < size; i++) {
844  file << std::setprecision(17)
845  << triplePoints[finalPts[i]].x
846  << " " << triplePoints[finalPts[i]].y
847  << " " << triplePoints[finalPts[i]].z
848  << "\n";
849  }
850  }
851  file.close();
852 }
853 
854 
855 /* writeRejectionStats() **********************************************************************/
859 void writeRejectionStats(Stats &pstats, std::string &output) {
860  std::cout << "Writing Rejection Statistics File (rejections.dat)\n";
861  std::string fileName = output+"/rejections.dat";
862  std::ofstream file;
863  file.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
864  checkIfOpen(file, fileName);
865 
866  file << pstats.rejectionReasons.shortIntersection << " Short Intersections \n";
867  file << pstats.rejectionReasons.closeToNode << " Close to Node\n";
868  file << pstats.rejectionReasons.closeToEdge << " Close to Edge\n";
869  file << pstats.rejectionReasons.closePointToEdge << " Vertice Close to Edge\n";
870  file << pstats.rejectionReasons.outside << " Outside of Domain\n";
871  file << pstats.rejectionReasons.triple << " Triple intersection Rejections\n";
872  file << pstats.rejectionReasons.interCloseToInter << " Intersections Close to Other Intersections\n";
873 
874  file.close();
875 }
876 
877 
878 /* writeShapeFams() ***************************************************************************/
882 void writeShapeFams(std::vector<Shape> &shapeFamilies, std::string &output){
883 
884  double radToDeg = 180 / M_PI;
885 
886  std::cout << "Writing Family Definitions File (families.dat)\n";
887  std::string fileName = output+"/families.dat";
888  std::ofstream file;
889  file.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
890  checkIfOpen(file, fileName);
891 
892  using namespace std;
893 
894  for(unsigned int i = 0; i < shapeFamilies.size(); i++) {
895 
896  //name(rect or ell) and number of family
897  file << shapeType(shapeFamilies[i]) << " Family "
898  << getFamilyNumber(i, shapeFamilies[i].shapeFamily) << ":\n";
899 
900  file << "Global Family " << i + 1 << "\n";
901 
902  // Print vertice number
903  if (shapeFamilies[i].shapeFamily == 0) { // If ellipse family
904  file << "Number of Vertices: " << shapeFamilies[i].numPoints << endl;
905  }
906  else {
907  file << "Number of Vertices: 4" << endl;
908  }
909 
910  // aspect ratio
911  file << "Aspect Ratio: " << shapeFamilies[i].aspectRatio << endl;
912 
913  // p32 target
914  if (stopCondition == 1) {
915  file << "P32 (Fracture Intensity) Target: "
916  << shapeFamilies[i].p32Target << endl;
917  }
918 
919  // beta distribution, rotation around normal vector
920  if (shapeFamilies[i].betaDistribution == 0) {
921  file << "Beta Distribution (Rotation Around Normal Vector): [0, 2PI)" << endl;
922  }
923  else {
924  file << "Beta (Rotation Around Normal Vector): "
925  << shapeFamilies[i].beta << " rad, "
926  << shapeFamilies[i].beta * radToDeg << " deg" << endl;
927  }
928 
929  // Theta (angle normal makes with z axis
930  file << "Theta: " << shapeFamilies[i].theta << " rad, "
931  << shapeFamilies[i].theta * radToDeg << " deg" << endl;
932 
933  // Phi (angle the projection of normal onto x-y plane makes with +x axis
934  file << "Phi: " << shapeFamilies[i].phi << " rad, "
935  << shapeFamilies[i].phi * radToDeg << " deg" << endl;
936 
937  // kappa
938  file << "Kappa: " << shapeFamilies[i].kappa << endl;
939 
940 
941  // Print layer family belongs to
942  if (shapeFamilies[i].layer == 0) {
943  file << "Layer: Entire domain" << endl;
944  }
945  else {
946  int idx = (shapeFamilies[i].layer - 1) * 2;
947  file << "Layer: " << shapeFamilies[i].layer << " {" << layers[idx]
948  << ", " << layers[idx+1]
949  << "}" << endl;
950  }
951 
952  // Print distribution data
953  switch (shapeFamilies[i].distributionType) {
954  case 1: // lognormal
955  file << "Distribution: Lognormal\n";
956  file << "Mean: " << shapeFamilies[i].mean << endl;
957  file << "Standard Deviation: " << shapeFamilies[i].sd << endl;
958  file << "Minimum Radius: " << shapeFamilies[i].logMin << "m" << endl;
959  file << "Maximum Radius: " << shapeFamilies[i].logMax << "m" << endl;
960  break;
961 
962  case 2: // power-law
963  file << "Distribution: Truncated Power-Law\n";
964  file << "Alpha: " << shapeFamilies[i].alpha << endl;
965  file << "Minimum Radius: " << shapeFamilies[i].min << "m" << endl;
966  file << "Maximum Radius: " << shapeFamilies[i].max << "m" << endl;
967  break;
968 
969  case 3: // exponential
970  file << "Distribution: Exponential\n";
971  file << "Mean: " << shapeFamilies[i].expMean << endl;
972  file << "Lambda: " << shapeFamilies[i].expLambda << endl;
973  file << "Minimum Radius: " << shapeFamilies[i].expMin << "m" << endl;
974  file << "Maximum Radius: " << shapeFamilies[i].expMax << "m" << endl;
975  break;
976 
977  case 4: // constant
978  file << "Distribution: Constant\n";
979  file << "Radius: " << shapeFamilies[i].constRadi << "m" << endl;
980  }
981  file << "Family Insertion Probability: " << famProbOriginal[i] << "\n\n";
982  }
983  file.close();
984 }
985 
986 
987 /* makeDIR() **********************************************************************************/
991 void makeDIR(const char *dir) {
992 
993  // If dir already exists, remove it
994  if (DIR_exists(dir)) {
995  std::string tempStr = "rm -r ";
996  tempStr += dir;
997  if (system(tempStr.c_str())) {
998  std::cout << "ERROR: Problem executing system "
999  << "command: " << tempStr << "\n";
1000  exit(1);
1001  }
1002  }
1003 
1004  // If directory doesn't exist, create it
1005  if (!DIR_exists(dir)) {
1006  int dir_err = mkdir(dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
1007  if (-1 == dir_err) {
1008  std::cout << "\nError creating directory " << dir << "\n";
1009  exit(1);
1010  }
1011  }
1012 }
1013 
1014 
1015 /* writeConnectivity() **********************************************************************************/
1021 void writeConnectivity(std::vector<unsigned int> &finalFractures, std::vector<Poly> &acceptedPoly, std::vector<IntPoints> &intPts, std::string &output) {
1022 
1023  std::cout << "Writing Connectivity Data (connectivity.dat)\n";
1024  std::string fileName = output + "/connectivity.dat";
1025  std::ofstream file;
1026  file.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
1027  checkIfOpen(file, fileName);
1028 
1029  // Format for connectivity: Line number = poly number, integers on line are intersecting fractures
1030  // eg:
1031  // 2 3
1032  // 1 3
1033  // 1 2
1034  // Fracture 1 intersects frac 2 and 3, fract 2 intersects 1 and 3 etc
1035 
1036  for (unsigned int i = 0; i < finalFractures.size(); i++) {
1037 
1038  unsigned int size = acceptedPoly[finalFractures[i]].intersectionIndex.size();
1039  for (unsigned int j = 0; j < size; j++) {
1040  long int intIdx = acceptedPoly[finalFractures[i]].intersectionIndex[j];
1041  // Don't write fractures own fracture ID
1042 
1043  // NOTE: At this stage in the program, the fracture ID's have been changed to
1044  // negative. See 'adjustIntFractIds()' for more details.
1045  // Use '-' to make them positive again.
1046 
1047  if (finalFractures[i]+1 != -intPts[intIdx].fract1) {
1048  file << -intPts[intIdx].fract1 << " ";
1049  }
1050  else {
1051  file << -intPts[intIdx].fract2 << " ";
1052  }
1053  }
1054  file << "\n";
1055  }
1056  file.close();
1057 }
1058 
1059 
1060 /* writeRotationData() ******************************************************************************/
1067 void writeRotationData(std::vector<Poly> &acceptedPoly, std::vector<unsigned int> &finalFractures, std::vector<Shape> &shapeFamilies, std::string output) {
1068 
1069  std::ofstream file;
1070  std::string fileOutputFile = output+"/poly_info.dat";
1071  file.open(fileOutputFile.c_str(), std::ofstream::out | std::ofstream::trunc);
1072  checkIfOpen(file, fileOutputFile);
1073  std::cout << "Writing Rotation Data File (poly_info.dat)\n";
1074 
1075  double maxDomainSize = domainSize[0];
1076  if (maxDomainSize < domainSize[1]) {
1077  maxDomainSize = domainSize[1];
1078  }
1079  if (maxDomainSize < domainSize[2]) {
1080  maxDomainSize = domainSize[2];
1081  }
1082 
1083  maxDomainSize *= 10;
1084 
1085  for (unsigned int i = 0; i < finalFractures.size(); i++ ) {
1086 
1087  // poly's normal is already normalized at this point
1088  double normal[3] = {acceptedPoly[finalFractures[i]].normal[0], acceptedPoly[finalFractures[i]].normal[1], acceptedPoly[finalFractures[i]].normal[2]};
1089  double e3[3] = {0,0,1};
1090 
1091  // Rotation angle in radians
1092  double theta = std::acos(dotProduct(normal, e3));
1093  // rad to deg
1094  theta = theta * (180/M_PI);
1095 
1096  // Rotation into xy plane
1097  double *v = crossProduct(e3, normal);
1098  if (!(std::abs(v[0]) < eps && std::abs(v[1]) < eps && std::abs(v[2]) < eps)){ //if not zero vector
1099  normalize(v);
1100  }
1101 
1102 
1103  double x0 = (-maxDomainSize*v[0]);
1104  double y0 = (-maxDomainSize*v[1]);
1105  double z0 = (-maxDomainSize*v[2]);
1106 
1107  double x1 = maxDomainSize*v[0];
1108  double y1 = maxDomainSize*v[1];
1109  double z1 = maxDomainSize*v[2];
1110 
1111 
1112  // The last number is the shape family number. Throughout this program,
1113  // -1 and -2 are used to denote user defined ell. and rectangles.
1114  // -1 and -2 are not good numbers to use as material IDs in Lagrit.
1115  // If the family number is -1 or -2 we change these numbers to be
1116  // number of stochastic families + 1 and number of stochastic families + 2
1117  int famNum;
1118  if (acceptedPoly[finalFractures[i]].familyNum == -1) {
1119  famNum = shapeFamilies.size() + 1;
1120  }
1121  else if (acceptedPoly[finalFractures[i]].familyNum == -2) {
1122  famNum = shapeFamilies.size() + 2;
1123  }
1124  else {
1125  famNum = acceptedPoly[finalFractures[i]].familyNum + 1;
1126  }
1127 
1128  // Format: fracture#, x0, y0, z0, x1, y1, z1, family#
1129  file << (i+1) << " " << famNum << std::setprecision(15) << " " << theta << " " << x0
1130  << " " << y0 << " " << z0 << " " << x1 << " " << y1 << " " << z1 << "\n";
1131 
1132  delete[] v;
1133  }
1134  file.close();
1135 }
1136 
1137 
1138 /* writeRejectsPerAttempt()**************************************************************************/
1147 void writeRejectsPerAttempt(Stats &pstats, std::string &output) {
1148 
1149  std::ofstream file;
1150  std::string fileOutputFile = output+"/rejectsPerAttempt.dat";
1151  file.open(fileOutputFile.c_str(), std::ofstream::out | std::ofstream::trunc);
1152  checkIfOpen(file, fileOutputFile);
1153  std::cout << "Writing Rotation Data File (rejectsPerAttempt.dat)\n";
1154 
1155  for (unsigned int i = 0; i < pstats.rejectsPerAttempt.size(); i++) {
1156 
1157  file << pstats.rejectsPerAttempt[i] << "\n";
1158  }
1159 
1160  file.close();
1161 }
1162 
1163 
1164 
1165 
1166 
1167 
1168 
1169 
double euclideanDistance(double *A, double *B)
struct IntPoints polyAndIntersection_RotationToXY(struct IntPoints &intersection, Poly &newPoly, std::vector< Point > &triplePoints, std::vector< Point > &tempTripPts)
void normalize(T *vec)
void writeFractureTranslations(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:659
void writeRadiiFile(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:617
int * sortedIndex(const double *v, int n)
unsigned long long int shortIntersection
Definition: structures.h:252
unsigned long long int closeToNode
Definition: structures.h:255
unsigned long long int closeToEdge
Definition: structures.h:258
void writeApertureFile(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:573
unsigned long long int triple
Definition: structures.h:264
double x2
Definition: structures.h:148
double eps
Definition: DFNmain.cpp:39
unsigned long long int interCloseToInter
Definition: structures.h:267
double y2
Definition: structures.h:150
float * famProbOriginal
Definition: readInput.cpp:137
double y
Definition: structures.h:113
std::string shapeType(struct Shape &shapeFam)
void writeRejectionStats(Stats &pstats, std::string &output)
Definition: output.cpp:859
void rotateFractures(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly)
Definition: output.cpp:437
double y1
Definition: structures.h:144
void writeFinalRadii_OfFamily(std::vector< unsigned int > &finalFractures, int familyNum, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:772
bool userRectanglesOnOff
Definition: readInput.cpp:336
double z2
Definition: structures.h:152
void writePermFile(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:594
bool outputAcceptedRadiiPerFamily
Definition: readInput.cpp:82
double z1
Definition: structures.h:146
struct RejectionReasons rejectionReasons
Definition: structures.h:339
void writeAllAcceptedRadii(std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:723
float * layers
Definition: readInput.cpp:443
void writeConnectivity(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< IntPoints > &intPts, std::string &output)
Definition: output.cpp:1021
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)
Definition: output.cpp:248
bool userEllipsesOnOff
Definition: readInput.cpp:306
unsigned long long int closePointToEdge
Definition: structures.h:260
unsigned int intersectionNodeCount
Definition: structures.h:358
int aperture
Definition: readInput.cpp:413
void writeParamsFile(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< Shape > &shapeFamilies, Stats &pstats, std::vector< Point > &triplePoints, std::string &output)
Definition: output.cpp:551
bool outputFinalRadiiPerFamily
Definition: readInput.cpp:74
bool DIR_exists(const char *path)
Definition: output.cpp:193
double x
Definition: structures.h:112
unsigned long long int outside
Definition: structures.h:262
void writeFinalPolyRadii(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:699
int getFamilyNumber(int familyIndex, int familyShape)
std::vector< unsigned int > rejectsPerAttempt
Definition: structures.h:371
void applyRotation3D(Poly &newPoly, double *normalB)
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)
Definition: output.cpp:31
void writePolysInp(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:510
bool tripleIntersections
Definition: readInput.cpp:41
T dotProduct(const T *A, const T *B)
double x1
Definition: structures.h:142
void writeRejectsPerAttempt(Stats &pstats, std::string &output)
Definition: output.cpp:1147
void makeDIR(const char *dir)
Definition: output.cpp:991
bool visualizationMode
Definition: readInput.cpp:36
unsigned int tripleNodeCount
Definition: structures.h:364
double z
Definition: structures.h:114
void writeAllAcceptedRadii_OfFamily(int familyNum, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:747
void writeTriplePts(std::vector< Point > &triplePoints, std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::vector< IntPoints > &intPts, std::string &output)
Definition: output.cpp:797
void finishWritingIntFile(std::ostream &fractIntFile, int fract1, int numPoints, int numIntersections, std::vector< unsigned int > &intStart, std::vector< unsigned int > &intersectingFractures)
Definition: output.cpp:152
void writePolysInp_old(std::vector< unsigned int > &finalFractures, std::vector< Poly > &acceptedPoly, std::string &output)
Definition: output.cpp:457
double domainSize[3]
Definition: readInput.cpp:18
void writeShapeFams(std::vector< Shape > &shapeFamilies, std::string &output)
Definition: output.cpp:882
double h
Definition: readInput.cpp:21
T * crossProduct(const T *v1, const T *v2)
void writeRotationData(std::vector< Poly > &acceptedPoly, std::vector< unsigned int > &finalFractures, std::vector< Shape > &shapeFamilies, std::string output)
Definition: output.cpp:1067
void adjustIntFractIDs(std::vector< unsigned int > &finalFractures, std::vector< Poly > &allPolys, std::vector< IntPoints > &intPts)
Definition: output.cpp:218
void writePoints(std::ostream &output, std::vector< Point > &points, int start, unsigned int &count)
Definition: output.cpp:133
short stopCondition
Definition: readInput.cpp:12
std::vector< Point > discretizeLineOfIntersection(double *pt1, double *pt2, double dist)
void checkIfOpen(std::ifstream &stream, std::string fileName)