MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::MaxTemplate Class Reference

Computes the maximum quality metric value. More...

#include <MaxTemplate.hpp>

+ Inheritance diagram for MBMesquite::MaxTemplate:
+ Collaboration diagram for MBMesquite::MaxTemplate:

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 ObjectiveFunctionclone () const
 Create copy with same state.
virtual void clear ()

Private Attributes

std::vector< size_t > qmHandles

Detailed Description

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.

Constructor & Destructor Documentation

Definition at line 44 of file MaxTemplate.cpp.

Referenced by clone().

: ObjectiveFunctionTemplate( qualitymetric ) {}

Definition at line 47 of file MaxTemplate.cpp.


Member Function Documentation

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.


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.

typeEvaluation type.
pdThe patch.
value_outThe passed-back value of the objective fuction.
freeIf true, incorporate the quality metric values only for those metric evaluations that depend on at least one free vertex
false if any QualityMetric evaluation returned false, true otherwise.

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;

Member Data Documentation

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().

List of all members.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines