MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <ElementAvgQM.hpp>
Public Member Functions | |
MESQUITE_EXPORT | ElementAvgQM (ElemSampleQM *metric) |
virtual MESQUITE_EXPORT | ~ElementAvgQM () |
MESQUITE_EXPORT ElemSampleQM * | get_quality_metric () const |
virtual MESQUITE_EXPORT std::string | get_name () const |
virtual MESQUITE_EXPORT int | get_negate_flag () const |
1 if metric should be minimized, -1 if metric should be maximized. | |
virtual MESQUITE_EXPORT bool | evaluate (PatchData &pd, size_t handle, double &value, MsqError &err) |
Get metric value at a logical location in the patch. | |
Private Attributes | |
ElemSampleQM * | mMetric |
std::vector< size_t > | mHandles |
Definition at line 41 of file ElementAvgQM.hpp.
MBMesquite::ElementAvgQM::ElementAvgQM | ( | ElemSampleQM * | metric | ) |
Definition at line 40 of file ElementAvgQM.cpp.
: mMetric( metric ) {}
MBMesquite::ElementAvgQM::~ElementAvgQM | ( | ) | [virtual] |
Definition at line 42 of file ElementAvgQM.cpp.
{}
bool MBMesquite::ElementAvgQM::evaluate | ( | PatchData & | pd, |
size_t | handle, | ||
double & | value, | ||
MsqError & | err | ||
) | [virtual] |
Get metric value at a logical location in the patch.
Evaluate the metric at one location in the PatchData.
pd | The patch. |
handle | The location in the patch (as passed back from get_evaluations). |
value | The output metric value. |
Implements MBMesquite::QualityMetric.
Definition at line 57 of file ElementAvgQM.cpp.
References MBMesquite::QualityMetric::evaluate(), MBMesquite::ElemSampleQM::get_element_evaluations(), get_quality_metric(), mHandles, MSQ_ERRFALSE, and MSQ_ERRZERO.
{ ElemSampleQM* qm = get_quality_metric(); mHandles.clear(); qm->get_element_evaluations( pd, handle, mHandles, err ); MSQ_ERRFALSE( err ); bool valid = true; double tmpval; double accumulate = 0.0; int num_values = 0; bool tmpvalid; value = -std::numeric_limits< double >::infinity(); for( std::vector< size_t >::iterator h = mHandles.begin(); h != mHandles.end(); ++h ) { tmpvalid = qm->evaluate( pd, *h, tmpval, err ); MSQ_ERRZERO( err ); if( !tmpvalid ) { valid = false; break; } else { accumulate += tmpval; num_values++; } } if( valid ) value = accumulate / num_values; return valid; }
std::string MBMesquite::ElementAvgQM::get_name | ( | ) | const [virtual] |
Implements MBMesquite::QualityMetric.
Definition at line 44 of file ElementAvgQM.cpp.
References MBMesquite::QualityMetric::get_name(), and mMetric.
int MBMesquite::ElementAvgQM::get_negate_flag | ( | ) | const [virtual] |
1 if metric should be minimized, -1 if metric should be maximized.
Implements MBMesquite::QualityMetric.
Definition at line 52 of file ElementAvgQM.cpp.
References MBMesquite::QualityMetric::get_negate_flag(), and get_quality_metric().
{ return get_quality_metric()->get_negate_flag(); }
MESQUITE_EXPORT ElemSampleQM* MBMesquite::ElementAvgQM::get_quality_metric | ( | ) | const [inline] |
Definition at line 48 of file ElementAvgQM.hpp.
References mMetric.
Referenced by evaluate(), get_negate_flag(), and MBMesquite::VertexMover::loop_over_mesh().
{ return mMetric; }
std::vector< size_t > MBMesquite::ElementAvgQM::mHandles [mutable, private] |
Definition at line 61 of file ElementAvgQM.hpp.
Referenced by evaluate().
ElemSampleQM* MBMesquite::ElementAvgQM::mMetric [private] |
Definition at line 60 of file ElementAvgQM.hpp.
Referenced by get_name(), and get_quality_metric().