MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Base type for per-element quality metrics. More...
#include <ElementQM.hpp>
Public Member Functions | |
virtual MESQUITE_EXPORT | ~ElementQM () |
virtual MESQUITE_EXPORT MetricType | get_metric_type () const |
virtual MESQUITE_EXPORT void | get_evaluations (PatchData &pd, std::vector< size_t > &handles, bool free_vertices_only, MsqError &err) |
Returns list of element indices in PatchData. | |
virtual MESQUITE_EXPORT bool | evaluate_with_indices (PatchData &pd, size_t handle, double &value, std::vector< size_t > &indices, MsqError &err) |
Default implementation for all element-based metrics. | |
Static Public Member Functions | |
static MESQUITE_EXPORT void | get_element_evaluations (PatchData &pd, std::vector< size_t > &handles, bool free_vertices_only, MsqError &err) |
Base type for per-element quality metrics.
Definition at line 42 of file ElementQM.hpp.
MBMesquite::ElementQM::~ElementQM | ( | ) | [virtual] |
Definition at line 39 of file ElementQM.cpp.
{}
bool MBMesquite::ElementQM::evaluate_with_indices | ( | PatchData & | pd, |
size_t | handle, | ||
double & | value, | ||
std::vector< size_t > & | indices, | ||
MsqError & | err | ||
) | [virtual] |
Default implementation for all element-based metrics.
Fill 'indices' with all free vertex indices in element, and call 'evaluate'.
Implements MBMesquite::QualityMetric.
Reimplemented in TriTauMetric, and ConstantElementMetric.
Definition at line 74 of file ElementQM.cpp.
References MBMesquite::PatchData::element_by_index(), MBMesquite::QualityMetric::evaluate(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MSQ_CHKERR, n, MBMesquite::PatchData::num_free_vertices(), MBMesquite::MsqMeshEntity::vertex_count(), and vtx().
Referenced by PMeanPMetricTest::test_gradient(), and PMeanPMetricTest::test_indices().
{ const MsqMeshEntity& elem = pd.element_by_index( handle ); const size_t* vtx = elem.get_vertex_index_array(); const unsigned n = elem.vertex_count(); indices.clear(); for( unsigned i = 0; i < n; ++i ) if( vtx[i] < pd.num_free_vertices() ) indices.push_back( vtx[i] ); bool rval = evaluate( pd, handle, value, err ); return !MSQ_CHKERR( err ) && rval; }
void MBMesquite::ElementQM::get_element_evaluations | ( | PatchData & | pd, |
std::vector< size_t > & | handles, | ||
bool | free_vertices_only, | ||
MsqError & | err | ||
) | [static] |
Definition at line 46 of file ElementQM.cpp.
References MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqMeshEntity::node_count(), MBMesquite::PatchData::num_elements(), MBMesquite::PatchData::num_free_vertices(), and vtx().
Referenced by get_evaluations(), and MBMesquite::get_sample_pt_evaluations().
{ size_t num_elem = pd.num_elements(); if( !free_vertices_only ) { handles.resize( num_elem ); for( size_t i = 0; i < num_elem; ++i ) handles[i] = i; return; } handles.clear(); for( size_t i = 0; i < num_elem; ++i ) { // check if element has any free vertices MsqMeshEntity& elem = pd.element_by_index( i ); unsigned num_vtx = elem.node_count(); size_t* vtx = elem.get_vertex_index_array(); unsigned j; for( j = 0; j < num_vtx && vtx[j] >= pd.num_free_vertices(); ++j ) ; if( j < num_vtx ) handles.push_back( i ); } }
void MBMesquite::ElementQM::get_evaluations | ( | PatchData & | pd, |
std::vector< size_t > & | handles, | ||
bool | free_vertices_only, | ||
MsqError & | err | ||
) | [virtual] |
Returns list of element indices in PatchData.
Implements MBMesquite::QualityMetric.
Definition at line 41 of file ElementQM.cpp.
References get_element_evaluations().
Referenced by TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), and PMeanPMetricTest::test_get_element_evaluations().
{ get_element_evaluations( pd, handles, free_vertices_only, err ); }
virtual MESQUITE_EXPORT MetricType MBMesquite::ElementQM::get_metric_type | ( | ) | const [inline, virtual] |
Implements MBMesquite::QualityMetric.
Definition at line 47 of file ElementQM.hpp.
References MBMesquite::QualityMetric::ELEMENT_BASED.
Referenced by PMeanPMetricTest::test_get_metric_type().
{ return ELEMENT_BASED; }