MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <VertexMaxQM.hpp>
Public Member Functions | |
VertexMaxQM (ElemSampleQM *metric) | |
virtual | ~VertexMaxQM () |
ElemSampleQM * | get_quality_metric () const |
virtual std::string | get_name () const |
virtual int | get_negate_flag () const |
1 if metric should be minimized, -1 if metric should be maximized. | |
virtual bool | evaluate (PatchData &pd, size_t handle, double &value, MsqError &err) |
Get metric value at a logical location in the patch. | |
virtual bool | evaluate_with_indices (PatchData &pd, size_t handle, double &value, std::vector< size_t > &indices, MsqError &err) |
Get metric value at a logical location in the patch. | |
Private Attributes | |
ElemSampleQM * | mMetric |
std::vector< size_t > | mHandles |
std::vector< size_t > | mIndices |
Definition at line 43 of file VertexMaxQM.hpp.
MBMesquite::VertexMaxQM::VertexMaxQM | ( | ElemSampleQM * | metric | ) |
Definition at line 44 of file VertexMaxQM.cpp.
: mMetric( metric ) {}
MBMesquite::VertexMaxQM::~VertexMaxQM | ( | ) | [virtual] |
Definition at line 46 of file VertexMaxQM.cpp.
{}
bool MBMesquite::VertexMaxQM::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 61 of file VertexMaxQM.cpp.
References MBMesquite::QualityMetric::evaluate(), get_quality_metric(), MBMesquite::VertexQM::get_vertex_corner_handles(), mHandles, MSQ_ERRFALSE, and MSQ_ERRZERO.
{ ElemSampleQM* qm = get_quality_metric(); get_vertex_corner_handles( pd, handle, mHandles, err ); MSQ_ERRFALSE( err ); bool valid = true; double tmpval; 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; else if( tmpval > value ) value = tmpval; } return valid; }
bool MBMesquite::VertexMaxQM::evaluate_with_indices | ( | PatchData & | pd, |
size_t | handle, | ||
double & | value, | ||
std::vector< size_t > & | indices, | ||
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. |
indices | The free vertices that the evaluation is a function of, specified as vertex indices in the PatchData. |
Implements MBMesquite::QualityMetric.
Definition at line 85 of file VertexMaxQM.cpp.
References MBMesquite::QualityMetric::evaluate_with_indices(), get_quality_metric(), MBMesquite::VertexQM::get_vertex_corner_handles(), mHandles, mIndices, MSQ_ERRFALSE, MSQ_ERRZERO, and size.
{ ElemSampleQM* qm = get_quality_metric(); get_vertex_corner_handles( pd, handle, mHandles, err ); MSQ_ERRFALSE( err ); bool valid = true; double tmpval; bool tmpvalid; std::vector< size_t >::iterator i, e, h; value = -std::numeric_limits< double >::infinity(); for( h = mHandles.begin(); h != mHandles.end(); ++h ) { mIndices.clear(); tmpvalid = qm->evaluate_with_indices( pd, *h, tmpval, mIndices, err ); MSQ_ERRZERO( err ); if( !tmpvalid ) valid = false; else if( tmpval > value ) value = tmpval; size_t size = indices.size(); e = indices.begin() + size; for( i = mIndices.begin(); i != mIndices.end(); ++i ) { if( std::find( indices.begin(), e, *i ) == e ) { indices.push_back( *i ); e = indices.begin() + size; } } } return valid; }
std::string MBMesquite::VertexMaxQM::get_name | ( | ) | const [virtual] |
Implements MBMesquite::QualityMetric.
Definition at line 48 of file VertexMaxQM.cpp.
References MBMesquite::QualityMetric::get_name(), and mMetric.
int MBMesquite::VertexMaxQM::get_negate_flag | ( | ) | const [virtual] |
1 if metric should be minimized, -1 if metric should be maximized.
Implements MBMesquite::QualityMetric.
Definition at line 56 of file VertexMaxQM.cpp.
References MBMesquite::QualityMetric::get_negate_flag(), and mMetric.
{ return mMetric->get_negate_flag(); }
ElemSampleQM* MBMesquite::VertexMaxQM::get_quality_metric | ( | ) | const [inline] |
Definition at line 50 of file VertexMaxQM.hpp.
References mMetric.
Referenced by evaluate(), and evaluate_with_indices().
{ return mMetric; }
std::vector< size_t > MBMesquite::VertexMaxQM::mHandles [mutable, private] |
Definition at line 69 of file VertexMaxQM.hpp.
Referenced by evaluate(), and evaluate_with_indices().
std::vector< size_t > MBMesquite::VertexMaxQM::mIndices [mutable, private] |
Definition at line 69 of file VertexMaxQM.hpp.
Referenced by evaluate_with_indices().
ElemSampleQM* MBMesquite::VertexMaxQM::mMetric [private] |
Definition at line 68 of file VertexMaxQM.hpp.
Referenced by get_name(), get_negate_flag(), and get_quality_metric().