DFNgen  2.0
DFN Model Generator
debugFunctions.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <vector>
3 #include "debugFunctions.h"
4 #include "input.h"
5 #include "insertShape.h"
6 
9 void printAllPolys(std::vector<Poly> &acceptedPoly) {
10  for (unsigned int i = 0; i < acceptedPoly.size(); i++) {
11  std::cout << "\nPoly " <<i<< "\n";
12  printPolyData(acceptedPoly[i]);
13  }
14 }
15 
18 void printAllTriplePts(std::vector<Point> &triplePoints) {
19  std::cout << "\nTriple Points:\n";
20  for (unsigned int i = 0; i < triplePoints.size(); i++) {
21  std::cout << "{" <<triplePoints[i].x<< "," <<triplePoints[i].y<< "," <<triplePoints[i].z<< "}\n";
22  }
23  std::cout << "\n";
24 }
25 
26 
29 void printIntersectionData(std::vector<IntPoints> &intPts) {
30  std::cout << "\nIntersections:\n";
31  for (unsigned int i = 0; i < intPts.size(); i++) {
32  std::cout << "Fractures: " << intPts[i].fract1+1 << ", " <<intPts[i].fract2+1<< "\n";
33  std::cout << "Line: {" <<intPts[i].x1<< "," <<intPts[i].y1<< "," <<intPts[i].z1
34  << "} {" <<intPts[i].x2<< "," <<intPts[i].y2<< "," <<intPts[i].z2<< "}\n";
35  std::cout << "Trip pts size = " <<intPts[i].triplePointsIdx.size()<< "\n";
36  std::cout << "Triple Pts Index: ";
37  for (unsigned int k = 0; k < intPts[i].triplePointsIdx.size(); k++) {
38  std::cout <<intPts[i].triplePointsIdx[k]<< " ";
39  }
40  std::cout << "\n\n";
41  }
42 }
43 
44 
48 void printGroupData(Stats &pstats, std::vector<Poly> &fractList) {
49  //group number debug
50  for (unsigned int i = 0; i < pstats.fractGroup.size(); i++) {
51  std::cout << "\nfracture group[" << i << "]:\n";
52  std::cout << "Group number = " <<pstats.fractGroup[i].groupNum<<std::endl;
53  std::cout << "List of Polys:\n";
54  for(unsigned int k= 0; k<pstats.fractGroup[i].polyList.size(); k++) {
55  std::cout <<pstats.fractGroup[i].polyList[k] << " ";
56 
57  }
58  std::cout << "\nintersections on poly:\n";
59  for (unsigned int k= 0; k < pstats.fractGroup[i].polyList.size(); k++) {
60  std::cout << fractList[pstats.fractGroup[i].polyList[k]].intersectionIndex.size() << ", ";
61  std::cout <<std::endl;
62  }
63  }
64 
65  for (unsigned int i=0; i<pstats.groupData.size(); i++) {
66  std::cout << "groupData[" << i << "]: {"
67  << pstats.groupData[i].faces[0] << "," << pstats.groupData[i].faces[1]
68  << "," << pstats.groupData[i].faces[2] << "," << pstats.groupData[i].faces[3]
69  << "," << pstats.groupData[i].faces[4] << "," << pstats.groupData[i].faces[5] << "}\n";
70 
71  std::cout << "size: " <<pstats.groupData[i].size << "\n";
72  std::cout << "valid: " <<pstats.groupData[i].valid << "\n";
73  }
74  std::cout << "\n";
75 }
76 
79 void printPolyData(struct Poly &poly) {
80  std::cout << "numberOfNodes = " << poly.numberOfNodes << std::endl;
81  std::cout << "intersectionCount = " << poly.intersectionIndex.size() << std::endl;
82  std::cout << "Truncated = " << poly.truncated<< "\n";
83  std::cout << "groupNum = " << poly.groupNum << std::endl;
84  std::cout << "familyNum = " << poly.familyNum << std::endl;
85  std::cout << "Faces = {" << poly.faces[0] << "," << poly.faces[1] << ","
86  << poly.faces[2] << "," << poly.faces[3] << ","
87  << poly.faces[4] << "," << poly.faces[5] << "}\n";
88  std::cout << "area = " << poly.area << std::endl;
89  std::cout << "aperture = " << poly.aperture << std::endl;
90  std::cout << "xradius = " << poly.xradius << std::endl;
91  std::cout << "yradius = " << poly.yradius << std::endl;
92  std::cout << "aspectRatio = " << poly.aspectRatio << std::endl;
93  std::cout << "aperture = " << poly.aperture << std::endl;
94  std::cout << "normal = {" << poly.normal[0] << "," << poly.normal[1] << "," << poly.normal[2] << "}\n";
95  std::cout << "translation = {" << poly.translation[0] << "," << poly.translation[1] << "," << poly.translation[2] << "}\n";
96  std::cout << "permeability = " << poly.permeability<< "\n";
97  std::cout << "boundingBox:\nxMin = " << poly.boundingBox[0] << " xMax = " << poly.boundingBox[1] << "\n";
98  std::cout << "yMin = " << poly.boundingBox[2] << " yMax = " << poly.boundingBox[3] << std::endl;
99  std::cout << "zMin = " << poly.boundingBox[4] << " zMax = " << poly.boundingBox[5] << std::endl;
100  std::cout << "IntPts indices: ";
101 
102  for (unsigned int i = 0; i < poly.intersectionIndex.size(); i++){
103  std::cout << poly.intersectionIndex[i] << ", ";
104  }
105 
106  std::cout << "\n";
107  std::cout << "Vertices:\n";
108 
109  for (int i = 0; i < poly.numberOfNodes; i++) {
110  int idx = i*3;
111  std::cout << "{" << poly.vertices[idx] << "," << poly.vertices[idx+1] << "," << poly.vertices[idx+2] << "}\n";
112  }
113 }
114 
115 
116 /*****************************************************************************/
119 void printShapeFams(std::vector<Shape> &shapeFamilies) {
120  using namespace std;
121 
122  double radToDeg = 180 / M_PI;
123 
124  cout << "\nShape Families:\n";
125 
126  for(unsigned int i = 0; i < shapeFamilies.size(); i++) {
127  //name(rect or ell) and number of family
128  cout << shapeType(shapeFamilies[i]) << " Family "
129  << getFamilyNumber(i, shapeFamilies[i].shapeFamily) << ":\n";
130 
131  // Print vertice number
132  if (shapeFamilies[i].shapeFamily == 0) { // If ellipse family
133  cout << "Number of Vertices: " << shapeFamilies[i].numPoints << endl;
134  }
135  else {
136  cout << "Number of Vertices: 4" << endl;
137  }
138 
139  // aspect ratio
140  cout << "Aspect Ratio: " << shapeFamilies[i].aspectRatio << endl;
141 
142  // p32 target
143  if (stopCondition == 1) {
144  cout << "P32 (Fracture Intensity) Target: "
145  << shapeFamilies[i].p32Target << endl;
146  }
147 
148  // beta distribution, rotation around normal vector
149  if (shapeFamilies[i].betaDistribution == 0) {
150  cout << "Beta Distribution (Rotation Around Normal Vector): [0, 2PI)" << endl;
151  }
152  else {
153  cout << "Beta (Rotation Around Normal Vector): "
154  << shapeFamilies[i].beta << " rad, "
155  << shapeFamilies[i].beta * radToDeg << " deg" << endl;
156  }
157 
158  // Theta (angle normal makes with z axis
159  cout << "Theta: " << shapeFamilies[i].theta << " rad, "
160  << shapeFamilies[i].theta * radToDeg << " deg" << endl;
161 
162  // Phi (angle the projection of normal onto x-y plane makes with +x axis
163  cout << "Phi: " << shapeFamilies[i].phi << " rad, "
164  << shapeFamilies[i].phi * radToDeg << " deg " << endl;
165 
166  // kappa
167  cout << "Kappa: " << shapeFamilies[i].kappa << endl;
168 
169 
170  // Print layer family belongs to
171  if (shapeFamilies[i].layer == 0) {
172  cout << "Layer: Entire domain" << endl;
173  }
174  else {
175  int idx = (shapeFamilies[i].layer - 1) * 2;
176  cout << "Layer: " << shapeFamilies[i].layer << " {" << layers[idx]
177  << ", " << layers[idx+1]
178  << "}" << endl;
179  }
180 
181  // Print distribution data
182  switch (shapeFamilies[i].distributionType) {
183  case 1: // lognormal
184  cout << "Distrubution: Lognormal\n";
185  cout << "Mean: " << shapeFamilies[i].mean << endl;
186  cout << "Standard Deviation: " << shapeFamilies[i].sd << endl;
187  cout << "Minimum Radius: " << shapeFamilies[i].logMin << "m" << endl;
188  cout << "Maximum Radius: " << shapeFamilies[i].logMax << "m" << endl;
189  break;
190 
191  case 2: // power-law
192  cout << "Distribution: Truncated Power-Law\n";
193  cout << "Alpha: " << shapeFamilies[i].alpha << endl;
194  cout << "Minimum Radius: " << shapeFamilies[i].min << "m" << endl;
195  cout << "Maximum Radius: " << shapeFamilies[i].max << "m" << endl;
196  break;
197 
198  case 3: // exponential
199  cout << "Distribution: Exponential\n";
200  cout << "Mean: " << shapeFamilies[i].expMean << endl;
201  cout << "Lambda: " << shapeFamilies[i].expLambda << endl;
202  cout << "Minimum Radius: " << shapeFamilies[i].expMin << "m" << endl;
203  cout << "Maximum Radius: " << shapeFamilies[i].expMax << "m" << endl;
204  break;
205 
206  case 4: // constant
207  cout << "Distribution: Constant\n";
208  cout << "Radius: " << shapeFamilies[i].constRadi << "m" << endl;
209  }
210  cout << "Family Insertion Probability: " << famProb[i] << "\n\n";
211  }
212 }
213 
214 
unsigned int groupNum
Definition: structures.h:30
bool truncated
Definition: structures.h:95
int numberOfNodes
Definition: structures.h:14
double boundingBox[6]
Definition: structures.h:62
void printIntersectionData(std::vector< IntPoints > &intPts)
std::string shapeType(struct Shape &shapeFam)
std::vector< struct FractureGroups > fractGroup
Definition: structures.h:374
float * layers
Definition: readInput.cpp:443
float aspectRatio
Definition: structures.h:49
int getFamilyNumber(int familyIndex, int familyShape)
void printAllPolys(std::vector< Poly > &acceptedPoly)
double * vertices
Definition: structures.h:70
void printPolyData(struct Poly &poly)
double yradius
Definition: structures.h:46
double permeability
Definition: structures.h:74
float * famProb
Definition: readInput.cpp:133
std::vector< struct GroupData > groupData
Definition: structures.h:376
double xradius
Definition: structures.h:40
std::vector< unsigned int > intersectionIndex
Definition: structures.h:98
void printGroupData(Stats &pstats, std::vector< Poly > &fractList)
double normal[3]
Definition: structures.h:55
float area
Definition: structures.h:33
double aperture
Definition: structures.h:66
void printShapeFams(std::vector< Shape > &shapeFamilies)
int familyNum
Definition: structures.h:22
void printAllTriplePts(std::vector< Point > &triplePoints)
bool faces[6]
Definition: structures.h:84
double translation[3]
Definition: structures.h:52
short stopCondition
Definition: readInput.cpp:12