OGS
MeshToolsLib::RadiusEdgeRatioMetric Struct Referencefinal

Detailed Description

Calculates the quality of mesh elements based on the ratio between radius of the smallest enclosing sphere and the shortest element edge

Definition at line 26 of file RadiusEdgeRatioMetric.h.

#include <RadiusEdgeRatioMetric.h>

Inheritance diagram for MeshToolsLib::RadiusEdgeRatioMetric:
[legend]
Collaboration diagram for MeshToolsLib::RadiusEdgeRatioMetric:
[legend]

Public Member Functions

void calculateQuality () override
 Calculates the quality metric for each element of the mesh.
 
 ElementQualityMetric (MeshLib::Mesh const &mesh)
 
- Public Member Functions inherited from MeshToolsLib::ElementQualityMetric
 ElementQualityMetric (MeshLib::Mesh const &mesh)
 
virtual ~ElementQualityMetric ()=default
 
std::vector< double > const & getElementQuality () const
 Returns the result vector.
 
virtual BaseLib::Histogram< double > getHistogram (std::size_t n_bins=0) const
 

Additional Inherited Members

- Protected Attributes inherited from MeshToolsLib::ElementQualityMetric
double _min = std::numeric_limits<double>::max()
 
double _max = 0
 
MeshLib::Mesh const & _mesh
 
std::vector< double > _element_quality_metric
 

Member Function Documentation

◆ calculateQuality()

void MeshToolsLib::RadiusEdgeRatioMetric::calculateQuality ( )
overridevirtual

Calculates the quality metric for each element of the mesh.

Implements MeshToolsLib::ElementQualityMetric.

Definition at line 22 of file RadiusEdgeRatioMetric.cpp.

23{
24 std::vector<MeshLib::Element*> const& elements(_mesh.getElements());
25 std::size_t const nElements(_mesh.getNumberOfElements());
26 for (std::size_t k(0); k < nElements; k++)
27 {
28 MeshLib::Element const& elem(*elements[k]);
29 std::size_t const n_nodes(elem.getNumberOfBaseNodes());
30 std::vector<MathLib::Point3d*> pnts(n_nodes);
31 std::copy_n(elem.getNodes(), n_nodes, pnts.begin());
33 auto const& [min, max] = computeSqrEdgeLengthRange(elem);
34 _element_quality_metric[k] = std::sqrt(min) / (2 * s.getRadius());
35 }
36}
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
std::size_t getNumberOfElements() const
Get the number of elements.
Definition Mesh.h:97
std::vector< double > _element_quality_metric
std::pair< double, double > computeSqrEdgeLengthRange(Element const &element)
Compute the minimum and maximum squared edge length for this element.
Definition Element.cpp:156

References MeshToolsLib::ElementQualityMetric::_element_quality_metric, MeshToolsLib::ElementQualityMetric::_mesh, MeshLib::Mesh::getElements(), MeshLib::Element::getNodes(), MeshLib::Element::getNumberOfBaseNodes(), MeshLib::Mesh::getNumberOfElements(), and GeoLib::MinimalBoundingSphere::getRadius().

◆ ElementQualityMetric()

MeshToolsLib::ElementQualityMetric::ElementQualityMetric ( MeshLib::Mesh const & mesh)
explicit

Definition at line 33 of file ElementQualityMetric.cpp.

24 : _mesh(mesh)
25{
27}

The documentation for this struct was generated from the following files: