MOAB: Mesh Oriented datABase  (version 5.4.1)
NumericalTestOF Class Reference
+ Inheritance diagram for NumericalTestOF:
+ Collaboration diagram for NumericalTestOF:

Public Member Functions

 NumericalTestOF (bool should_fail, bool should_return_false, bool constant_func)
bool evaluate (EvalType type, PatchData &pd, double &val, bool free, MsqError &)
 Evaluate objective function for specified patch.
ObjectiveFunctionclone () const
 Create copy with same state.
void clear ()

Public Attributes

bool changed
bool fail
bool return_false
bool constant
const Vector3D linearGrad

Detailed Description

Define a dummy ObjectiveFunction on which to do numerical gradient calculation

If 'constant' flag is true, returns a constant value. If 'constant' flag is false, returns a linear function of vertex coordinates.

Definition at line 88 of file NumericalOFTest.cpp.

Constructor & Destructor Documentation

NumericalTestOF::NumericalTestOF ( bool  should_fail,
bool  should_return_false,
bool  constant_func 
) [inline]

Definition at line 91 of file NumericalOFTest.cpp.

        : changed( false ), fail( should_fail ), return_false( should_return_false ), constant( constant_func ),
          linearGrad( 1, 2, 3 )

Member Function Documentation

void NumericalTestOF::clear ( ) [inline, virtual]

Clear any values accumulated for BCD-related eval calls

Implements MBMesquite::ObjectiveFunction.

Definition at line 104 of file NumericalOFTest.cpp.

        changed = true;
ObjectiveFunction* NumericalTestOF::clone ( ) const [inline, 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 99 of file NumericalOFTest.cpp.

        return new NumericalTestOF( *this );
bool NumericalTestOF::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 117 of file NumericalOFTest.cpp.

References MBMesquite::ObjectiveFunction::CALCULATE, fail(), MBMesquite::MsqError::INVALID_ARG, MSQ_SETERR, MBMesquite::PatchData::num_free_vertices(), MBMesquite::PatchData::num_nodes(), MBMesquite::ObjectiveFunction::TEMPORARY, and MBMesquite::PatchData::vertex_by_index().

    if( fail )
        MSQ_SETERR( err )( "Expected failure of OF::evaluate", MsqError::INVALID_ARG );
        return false;

    if( pd.num_free_vertices() < 1 )
        MSQ_SETERR( err )( "PatchData without free vertices.", MsqError::INVALID_ARG );
        return false;

    if( type != ObjectiveFunction::CALCULATE && type != ObjectiveFunction::TEMPORARY ) changed = true;

    if( constant )
        val = 1.0;
        return !return_false;

    val = 0.0;
    for( size_t i = 0; i < pd.num_nodes(); ++i )
        const MsqVertex& v = pd.vertex_by_index( i );
        val += linearGrad[0] * v[0] + linearGrad[1] * v[1] + linearGrad[2] * v[2];

    return !return_false;

Member Data Documentation

Definition at line 112 of file NumericalOFTest.cpp.

Definition at line 110 of file NumericalOFTest.cpp.

Definition at line 111 of file NumericalOFTest.cpp.

List of all members.

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