MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Computes the maximum quality metric value. More...
#include <MaxTemplate.hpp>
Public Member Functions | |
MaxTemplate (QualityMetric *) | |
virtual | ~MaxTemplate () |
virtual bool | evaluate (EvalType type, PatchData &pd, double &value_out, bool free, MsqError &err) |
Evaluate objective function for specified patch. | |
virtual ObjectiveFunction * | clone () const |
Create copy with same state. | |
virtual void | clear () |
Private Attributes | |
std::vector< size_t > | qmHandles |
Computes the maximum quality metric value.
This function is the same as the LInfTemplate except that no absolute values are used.
Definition at line 52 of file MaxTemplate.hpp.
MBMesquite::MaxTemplate::MaxTemplate | ( | QualityMetric * | qualitymetric | ) |
Definition at line 44 of file MaxTemplate.cpp.
Referenced by clone().
: ObjectiveFunctionTemplate( qualitymetric ) {}
MBMesquite::MaxTemplate::~MaxTemplate | ( | ) | [virtual] |
Definition at line 47 of file MaxTemplate.cpp.
{}
void MBMesquite::MaxTemplate::clear | ( | ) | [virtual] |
Clear any values accumulated for BCD-related eval calls
Implements MBMesquite::ObjectiveFunction.
Definition at line 54 of file MaxTemplate.cpp.
{}
ObjectiveFunction * MBMesquite::MaxTemplate::clone | ( | ) | const [virtual] |
Create copy with same state.
Create a new instance of the objective function that is a copy of the callee with the same accumulated values, parameters, etc.
Implements MBMesquite::ObjectiveFunction.
Definition at line 49 of file MaxTemplate.cpp.
References MBMesquite::ObjectiveFunctionTemplate::get_quality_metric(), and MaxTemplate().
{ return new MaxTemplate( get_quality_metric() ); }
bool MBMesquite::MaxTemplate::evaluate | ( | EvalType | type, |
PatchData & | pd, | ||
double & | value_out, | ||
bool | free, | ||
MsqError & | err | ||
) | [virtual] |
Evaluate objective function for specified patch.
Either evaluate the objective function over the passed patch or update the accumulated, global objective function value for changes in the passed patch, depending on the value of the EvalType.
type | Evaluation type. |
pd | The patch. |
value_out | The passed-back value of the objective fuction. |
free | If true, incorporate the quality metric values only for those metric evaluations that depend on at least one free vertex |
Implements MBMesquite::ObjectiveFunction.
Definition at line 56 of file MaxTemplate.cpp.
References MBMesquite::ObjectiveFunction::CALCULATE, MBMesquite::QualityMetric::evaluate(), MBMesquite::QualityMetric::get_evaluations(), MBMesquite::QualityMetric::get_negate_flag(), MBMesquite::ObjectiveFunctionTemplate::get_quality_metric(), MBMesquite::MsqError::INVALID_STATE, MSQ_CHKERR, MSQ_ERRFALSE, MSQ_SETERR, qmHandles, MBMesquite::sign, and value().
{ if( type != ObjectiveFunction::CALCULATE ) { MSQ_SETERR( err ) ( "MaxTemplate does not support block coodinate descent algoritms", MsqError::INVALID_STATE ); return false; } QualityMetric* qm = get_quality_metric(); qm->get_evaluations( pd, qmHandles, free, err ); MSQ_ERRFALSE( err ); const double sign = qm->get_negate_flag(); // calculate OF value for just the patch std::vector< size_t >::const_iterator i; double value; value_out = -HUGE_VAL; for( i = qmHandles.begin(); i != qmHandles.end(); ++i ) { bool result = qm->evaluate( pd, *i, value, err ); if( MSQ_CHKERR( err ) || !result ) return false; value *= sign; if( value > value_out ) value_out = value; } return true; }
std::vector< size_t > MBMesquite::MaxTemplate::qmHandles [mutable, private] |
Temporary storage for qm sample handles
Definition at line 63 of file MaxTemplate.hpp.
Referenced by evaluate().