33 #ifndef __H__UG_quality_util
34 #define __H__UG_quality_util
53 template <
class TAAPos>
63 const number aMax = max(max(a[0], a[1]), a[2]);
68 return (6.9282032302755091741097853660235 * A) / (aMax * (a[0] + a[1] + a[2]));
78 template <
class TAAPos>
89 const number aMax = max(max(max(a[0], a[1]), a[2]), a[3]);
92 aaPos[vrts[2]], aaPos[vrts[3]]);
95 return (4. * A) / (aMax * (a[0] + a[1] + a[2] + a[3]));
104 template <
class TAAPos>
110 default:
UG_THROW(
"AspectRatio only supports faces with 3 or 4 vertices.");
115 template <
class TAAPos>
121 const size_t numEdges = vol->
num_edges();
122 for(
size_t i = 0; i < numEdges; ++i){
126 maxEdgeLenSq = max (maxEdgeLenSq, edgeLenSq);
128 return sqrt (maxEdgeLenSq);
132 template <
class TAAPos>
149 if(maxEdgeLength > 0)
150 return std::sqrt(3/2.0) * minTetHeight / maxEdgeLength;
156 template <
class TAAPos>
161 default:
UG_THROW(
"AspectRatio only supports volumes with 4 vertices.");
179 template <
class TElemIter,
class TAAPos>
192 if(elemsBegin == elemsEnd)
198 for(TElemIter ielem = elemsBegin; ielem != elemsEnd; ++ielem) {
200 ari.
min = min (ari.
min, ar);
201 ari.
max = max (ari.
max, ar);
209 for(TElemIter ielem = elemsBegin; ielem != elemsEnd; ++ielem) {
214 ari.
sd = sqrt(ari.
sd / (counter));
221 template <
class TElemIter,
class TAAPos>
224 std::vector<int>& histoOut,
225 TElemIter elemsBegin,
242 histoOut.resize(histoSecs, 0);
245 "Invalid paaHistoSec supplied to 'GetFaceAspectRatioHistogram'");
247 for(TElemIter ielem = elemsBegin; ielem != elemsEnd; ++ielem) {
249 int sec =
static_cast<int> (ar * histoSecs);
250 sec = min (sec, histoSecs - 1);
254 (*paaHistoSec)[*ielem] = sec;
Can be used to store information about an edge and to construct an edge.
Definition: grid_base_objects.h:464
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:367
Definition: grid_base_objects.h:483
virtual ConstVertexArray vertices() const
Definition: grid_base_objects.h:487
virtual size_t num_vertices() const
Definition: grid_base_objects.h:488
the generic attachment-accessor for access to grids attachment pipes.
Definition: grid.h:182
Vertex *const * ConstVertexArray
Definition: grid_base_objects.h:319
the most simple volume-element.
Definition: grid_objects_3d.h:91
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
virtual uint num_edges() const
Definition: grid_base_objects.h:782
virtual EdgeDescriptor edge_desc(int index) const
Definition: grid_base_objects.h:780
virtual size_t num_vertices() const
Definition: grid_base_objects.h:729
static number GetMaxEdgeLength(TDomain &dom)
Definition: domain_bridge.cpp:342
number CalculateMinVolumeHeight(Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
calculates the minimal height of a volume element of type tetrahedron
Definition: volume_util.cpp:109
#define UG_THROW(msg)
Definition: error.h:57
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
double number
Definition: types.h:124
number TriangleArea(const vector_t &p1, const vector_t &p2, const vector_t &p3)
calculates the are of the triangle defined by p1, p2 and p3
Definition: math_util_impl.hpp:914
number QuadrilateralArea(const vector_t &p1, const vector_t &p2, const vector_t &p3, const vector_t &p4)
calculates the are of the triangle defined by p1, p2 and p3
Definition: math_util_impl.hpp:924
TNumber sq(TNumber val)
returns the square of a value (val*val)
Definition: math_util_impl.hpp:91
vector_t::value_type VecDistanceSq(const vector_t &v1, const vector_t &v2)
returns the squared distance of two vector_ts.
Definition: math_vector_functions_common_impl.hpp:351
vector_t::value_type VecDistance(const vector_t &v1, const vector_t &v2)
returns the distance of two vector_ts.
Definition: math_vector_functions_common_impl.hpp:375
number TriangleAspectRatio(FaceVertices *f, TAAPos &aaPos)
Returns the aspect ratio of a triangle.
Definition: quality_util.h:54
number AspectRatio(FaceVertices *f, TAAPos &aaPos)
Returns the aspect ratio of a face.
Definition: quality_util.h:105
AspectRatioInfo GetAspectRatioInfo(TElemIter elemsBegin, TElemIter elemsEnd, TAAPos &aaPos)
Computes the AspectRatioInfo for a sample of elements.
Definition: quality_util.h:181
number QuadrilateralAspectRatio(FaceVertices *f, TAAPos &aaPos)
Returns the aspect ratio of a quadrilateral.
Definition: quality_util.h:79
void GetAspectRatioHistogram(std::vector< int > &histoOut, TElemIter elemsBegin, TElemIter elemsEnd, int histoSecs, TAAPos &aaPos, Grid::AttachmentAccessor< typename PtrToValueType< typename TElemIter::value_type >::base_type, Attachment< int > > *paaHistoSec=NULL)
Definition: quality_util.h:223
number TetrahedronAspectRatio(Volume *vol, TAAPos &aaPos)
Definition: quality_util.h:133
Holds information on the min, max, mean, and standard deviation of a sample.
Definition: quality_util.h:168
number min
Definition: quality_util.h:169
number mean
Definition: quality_util.h:171
number sd
Definition: quality_util.h:172
number max
Definition: quality_util.h:170
std::string to_string()
Definition: quality_util.cpp:39
void base_type
Definition: grid_base_objects.h:1011