34 #ifndef __ELEMENT_QUALITY_STATISTICS_H__
35 #define __ELEMENT_QUALITY_STATISTICS_H__
63 template <
class TIterator,
class TAAPosVRT>
65 TIterator elementsEnd,
67 vector<number>& minAngles)
74 if(elementsBegin == elementsEnd)
76 UG_LOG(
"ERROR in CollectMinAngles: elementsBegin == elementsEnd." << std::endl);
81 for(TIterator iter = elementsBegin; iter != elementsEnd; ++iter)
92 minAngles.push_back(curMinAngle);
99 template <
class TIterator,
class TAAPosVRT>
101 TIterator elementsEnd,
103 vector<number>& maxAngles)
110 if(elementsBegin == elementsEnd)
112 UG_LOG(
"ERROR in CollectMaxAngles: elementsBegin == elementsEnd." << std::endl);
117 for(TIterator iter = elementsBegin; iter != elementsEnd; ++iter)
128 maxAngles.push_back(curMaxAngle);
135 template <
class TIterator,
class TAAPosVRT>
137 TIterator elementsEnd,
139 vector<number>& aspectRatios)
146 if(elementsBegin == elementsEnd)
148 UG_LOG(
"ERROR in CollectAspectRatios: elementsBegin == elementsEnd." << std::endl);
153 for(TIterator iter = elementsBegin; iter != elementsEnd; ++iter)
164 aspectRatios.push_back(curAspectRatio);
171 template <
class TIterator,
class TAAPosVRT>
173 TIterator elementsEnd,
175 vector<number>& ratios)
182 if(elementsBegin == elementsEnd)
184 UG_LOG(
"ERROR in CollectVolToRMSFaceAreaRatios: elementsBegin == elementsEnd." << std::endl);
189 bool nonTetrahedralElemsPresent =
false;
190 for(TIterator iter = elementsBegin; iter != elementsEnd; ++iter)
202 ratios.push_back(0.0);
203 nonTetrahedralElemsPresent =
true;
207 ratios.push_back(curRatio);
210 if (nonTetrahedralElemsPresent)
211 UG_LOGN(
"CollectVolToRMSFaceAreaRatios could not calculate VolToRMSFaceAreaRatios "
212 "for non-tetraheadral elements (set to 0.0)");
218 template <
class TAAPosVRT>
221 size_t numTriangles = 0;
222 size_t numQuadrilaterals = 0;
236 vector<number> vAnglesOut;
257 for(
size_t k = 0; k < vAnglesOut.size(); ++k)
259 sd_tri += (regAngle-vAnglesOut[k])*(regAngle-vAnglesOut[k]);
260 mean_tri += vAnglesOut[k];
270 for(
size_t k = 0; k < vAnglesOut.size(); ++k)
272 sd_quad += (regAngle-vAnglesOut[k])*(regAngle-vAnglesOut[k]);
273 mean_quad += vAnglesOut[k];
298 sd_tri *= (1.0/(3*numTriangles));
299 sd_tri = sqrt(sd_tri);
300 mean_tri *= (1.0/(3*numTriangles));
305 sd_quad *= (1.0/(4*numQuadrilaterals));
306 sd_quad = sqrt(sd_quad);
307 mean_quad *= (1.0/(4*numQuadrilaterals));
310 UG_LOG(
"(*) Standard deviation of face angles to regular case" << endl);
311 UG_LOG(
" (60° for triangles, 90° for quadrilaterals)" << endl);
313 UG_LOG(
" Triangles (" << numTriangles <<
"):" << endl);
316 UG_LOG(
" sd = " << sd_tri << endl);
317 UG_LOG(
" mean = " << mean_tri << endl);
320 UG_LOG(
" Quadrilaterals (" << numQuadrilaterals <<
"):" << endl);
323 UG_LOG(
" sd = " << sd_quad << endl);
324 UG_LOG(
" mean = " << mean_quad << endl);
333 template <
class TAAPosVRT>
336 size_t numTriangles = 0;
337 size_t numQuadrilaterals = 0;
338 size_t numTetrahedrons = 0;
339 size_t numHexahedrons = 0;
340 size_t numOctahedrons = 0;
354 number regVolDihedral = 90.0;
362 vector<number> vAnglesOut;
383 for(
size_t k = 0; k < vAnglesOut.size(); ++k)
385 sd_tri += (regAngle-vAnglesOut[k])*(regAngle-vAnglesOut[k]);
386 mean_tri += vAnglesOut[k];
396 for(
size_t k = 0; k < vAnglesOut.size(); ++k)
398 sd_quad += (regAngle-vAnglesOut[k])*(regAngle-vAnglesOut[k]);
399 mean_quad += vAnglesOut[k];
424 sd_tri *= (1.0/(3*numTriangles));
425 sd_tri = sqrt(sd_tri);
426 mean_tri *= (1.0/(3*numTriangles));
431 sd_quad *= (1.0/(4*numQuadrilaterals));
432 sd_quad = sqrt(sd_quad);
433 mean_quad *= (1.0/(4*numQuadrilaterals));
436 UG_LOG(
"(*) Standard deviation of face angles to regular case" << endl);
437 UG_LOG(
" (60° for triangles, 90° for quadrilaterals)" << endl);
439 UG_LOG(
" Triangles (" << numTriangles <<
"):" << endl);
442 UG_LOG(
" sd = " << sd_tri << endl);
443 UG_LOG(
" mean = " << mean_tri << endl);
446 UG_LOG(
" Quadrilaterals (" << numQuadrilaterals <<
"):" << endl);
449 UG_LOG(
" sd = " << sd_quad << endl);
450 UG_LOG(
" mean = " << mean_quad << endl);
458 vector<number> vDihedralsOut;
462 vDihedralsOut.clear();
475 regVolDihedral = 70.52877937;
479 for(
size_t k = 0; k < vDihedralsOut.size(); ++k)
481 sd_tet += (regVolDihedral-vDihedralsOut[k])*(regVolDihedral-vDihedralsOut[k]);
482 mean_tet += vDihedralsOut[k];
488 regVolDihedral = 90.0;
492 for(
size_t k = 0; k < vDihedralsOut.size(); ++k)
494 sd_hex += (regVolDihedral-vDihedralsOut[k])*(regVolDihedral-vDihedralsOut[k]);
495 mean_hex += vDihedralsOut[k];
501 regVolDihedral = 109.4712206;
505 for(
size_t k = 0; k < vDihedralsOut.size(); ++k)
507 sd_oct += (regVolDihedral-vDihedralsOut[k])*(regVolDihedral-vDihedralsOut[k]);
508 mean_oct += vDihedralsOut[k];
536 sd_tet *= (1.0/(6*numTetrahedrons));
537 sd_tet = sqrt(sd_tet);
538 mean_tet *= (1.0/(6*numTetrahedrons));
543 sd_hex *= (1.0/(12*numHexahedrons));
544 sd_hex = sqrt(sd_hex);
545 mean_hex *= (1.0/(12*numHexahedrons));
550 sd_oct *= (1.0/(12*numOctahedrons));
551 sd_oct = sqrt(sd_oct);
552 mean_oct *= (1.0/(12*numOctahedrons));
555 UG_LOG(
"(*) Standard deviation of dihedral angles to regular case" << endl);
556 UG_LOG(
" (70.5288° for tetrahedrons, 90° for hexahedrons, 109.471° for Octahedrons)" << endl);
558 UG_LOG(
" Tetrahedrons (" << numTetrahedrons <<
"):" << endl);
561 UG_LOG(
" sd = " << sd_tet << endl);
562 UG_LOG(
" mean = " << mean_tet << endl);
565 UG_LOG(
" Hexahedrons (" << numHexahedrons <<
"):" << endl);
568 UG_LOG(
" sd = " << sd_hex << endl);
569 UG_LOG(
" mean = " << mean_hex << endl);
572 UG_LOG(
" Octahedrons (" << numOctahedrons <<
"):" << endl);
575 UG_LOG(
" sd = " << sd_oct << endl);
576 UG_LOG(
" mean = " << mean_oct << endl);
size_t allreduce(const size_t &t, pcl::ReduceOperation op) const
bool is_ghost(TElem *elem) const
bool contains_status(TGeomObj *o, byte status) const
virtual ReferenceObjectID reference_object_id() const
geometry_traits< TGeomObj >::iterator begin(size_t level=0)
geometry_traits< TGeomObj >::iterator end(size_t level=0)
virtual ReferenceObjectID reference_object_id() const
number CalculateAspectRatio(Grid &grid, Face *face, TAAPosVRT &aaPos)
void ElementQualityStatistics2d(Grid &grid, GridObjectCollection goc, number angleHistStepSize, number aspectRatioHistStepSize, bool bWriteHistograms)
Definition: element_quality_statistics.cpp:576
void CollectAspectRatios(Grid &grid, TIterator elementsBegin, TIterator elementsEnd, TAAPosVRT &aaPos, vector< number > &aspectRatios)
Definition: element_quality_statistics.h:136
ElementStorage< Face >::SectionContainer::iterator FaceIterator
void AssignSubsetsByElementQuality3d(MultiGrid &grid, MGSubsetHandler &sh, int numSecs)
Definition: element_quality_statistics.cpp:439
number CalculateMaxAngle(Grid &grid, Face *f, TAAPosVRT &aaPos)
number CalculateMinAngle(Grid &grid, Face *f, TAAPosVRT &aaPos)
GridSubsetHandler SubsetHandler
void AssignSubsetToElementWithSmallestMinAngle3d(MultiGrid &grid, MGSubsetHandler &sh, const char *roid, int si)
Definition: element_quality_statistics.cpp:163
void PrintAngleHistogram(vector< number > &locAngles, number stepSize, ug::Table< std::stringstream > &outTable)
Definition: element_quality_statistics.cpp:1244
void AssignSubsetToElementWithSmallestMinAngle2d(MultiGrid &grid, MGSubsetHandler &sh, const char *roid, int si)
Definition: element_quality_statistics.cpp:130
void FindBoundsForStiffnesMatrixMaxEigenvalue(MultiGrid &mg, MGSubsetHandler &shOut)
Definition: element_quality_statistics.cpp:291
void ElementQualityStatistics3d(Grid &grid, GridObjectCollection goc, number angleHistStepSize, number aspectRatioHistStepSize, bool bWriteHistograms)
Definition: element_quality_statistics.cpp:737
void CollectVolToRMSFaceAreaRatios(Grid &grid, TIterator elementsBegin, TIterator elementsEnd, TAAPosVRT &aaPos, vector< number > &ratios)
Definition: element_quality_statistics.h:172
void CollectMinAngles(Grid &grid, TIterator elementsBegin, TIterator elementsEnd, TAAPosVRT &aaPos, vector< number > &minAngles)
Definition: element_quality_statistics.h:64
MultiGridSubsetHandler MGSubsetHandler
void AssignSubsetToElementWithSmallestMinAngle(MultiGrid &grid, MGSubsetHandler &sh, int dim, const char *roid, int si)
Definition: element_quality_statistics.cpp:117
void PrintVertexVolumeValence(MultiGrid &mg, SubsetHandler &sh, int subsetIndex)
Definition: element_quality_statistics.cpp:47
void PrintAspectRatioHistogram(vector< number > &locAspectRatios, number stepSize, ug::Table< std::stringstream > &outTable)
Definition: element_quality_statistics.cpp:1370
void ElementQualityStatistics(MultiGrid &mg, int dim, number angleHistStepSize, number aspectRatioHistStepSize, bool bWriteHistograms)
Definition: element_quality_statistics.cpp:534
void PrintAngleStatistics3d(Grid &grid, GridObjectCollection &goc, int level, TAAPosVRT &aaPos)
Definition: element_quality_statistics.h:334
void AssignSubsetsByElementQuality(MultiGrid &mg, MGSubsetHandler &sh, int dim, int numSecs)
Definition: element_quality_statistics.cpp:508
void CollectMaxAngles(Grid &grid, TIterator elementsBegin, TIterator elementsEnd, TAAPosVRT &aaPos, vector< number > &maxAngles)
Definition: element_quality_statistics.h:100
void MeasureTetrahedronWithSmallestMinAngle(MultiGrid &grid)
Definition: element_quality_statistics.cpp:214
void CalculateAngles(vector< number > &vAnglesOut, Grid &grid, Face *f, TAAPosVRT &aaPos)
number CalculateVolToRMSFaceAreaRatio(Grid &grid, Face *face, TAAPosVRT &aaPos)
ElementStorage< Volume >::SectionContainer::iterator VolumeIterator
void PrintAngleStatistics2d(Grid &grid, GridObjectCollection &goc, int level, TAAPosVRT &aaPos)
Definition: element_quality_statistics.h:219