MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::LInfTemplate Class Reference

Computes the L_infinity objective function for a given patch, i.e., LInfTemplate::concrete_evaluate returns the maximum absolute value of the quality metric values on 'patch'. More...

#include <LInfTemplate.hpp>

+ Inheritance diagram for MBMesquite::LInfTemplate:
+ Collaboration diagram for MBMesquite::LInfTemplate:

Public Member Functions

MESQUITE_EXPORT LInfTemplate (QualityMetric *)
virtual MESQUITE_EXPORT ~LInfTemplate ()
virtual MESQUITE_EXPORT bool evaluate (EvalType type, PatchData &pd, double &value_out, bool free, MsqError &err)
 Evaluate objective function for specified patch.
virtual MESQUITE_EXPORT
ObjectiveFunction
clone () const
 Create copy with same state.
virtual MESQUITE_EXPORT void clear ()

Private Attributes

std::vector< size_t > qmHandles

Detailed Description

Computes the L_infinity objective function for a given patch, i.e., LInfTemplate::concrete_evaluate returns the maximum absolute value of the quality metric values on 'patch'.

Definition at line 51 of file LInfTemplate.hpp.


Constructor & Destructor Documentation

Definition at line 44 of file LInfTemplate.cpp.

Referenced by clone().

: ObjectiveFunctionTemplate( qualitymetric ) {}

Definition at line 47 of file LInfTemplate.cpp.

{}

Member Function Documentation

void MBMesquite::LInfTemplate::clear ( ) [virtual]

Clear any values accumulated for BCD-related eval calls

Implements MBMesquite::ObjectiveFunction.

Definition at line 54 of file LInfTemplate.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 LInfTemplate.cpp.

References MBMesquite::ObjectiveFunctionTemplate::get_quality_metric(), and LInfTemplate().

{
    return new LInfTemplate( get_quality_metric() );
}
bool MBMesquite::LInfTemplate::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.

Parameters:
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
Returns:
false if any QualityMetric evaluation returned false, true otherwise.

Implements MBMesquite::ObjectiveFunction.

Definition at line 56 of file LInfTemplate.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, MBMesquite::negate(), qmHandles, and value().

{
    if( type != ObjectiveFunction::CALCULATE )
    {
        MSQ_SETERR( err )
        ( "LInfTemplate 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 negate = 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 = negate * fabs( value );
        if( value > value_out ) value_out = value;
    }

    return true;
}

Member Data Documentation

std::vector< size_t > MBMesquite::LInfTemplate::qmHandles [mutable, private]

Temporary storage for qm sample handles

Definition at line 62 of file LInfTemplate.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