MOAB: Mesh Oriented datABase  (version 5.2.1)
DummyOF Class Reference
+ Inheritance diagram for DummyOF:
+ Collaboration diagram for DummyOF:

Public Member Functions

 DummyOF (double of_value=0.0, Vector3D grad_values=Vector3D(0, 0, 0))
bool initialize_block_coordinate_descent (MeshDomainAssoc *domain, const Settings *settings, PatchSet *user_set, MsqError &err)
 Initial accumulated value for block coordinate descent algorithms.
void initialize_queue (MeshDomainAssoc *, const Settings *, MsqError &)
 Called at start of instruction queue processing.
bool evaluate (EvalType type, PatchData &pd, double &value_out, bool free, MsqError &err)
 Evaluate objective function for specified patch.
bool evaluate_with_gradient (EvalType type, PatchData &pd, double &value_out, std::vector< Vector3D > &grad_out, MsqError &err)
 Evaluate objective function and gradient for specified patch.
ObjectiveFunctionclone () const
 Create copy with same state.
void clear ()
int min_patch_layers () const

Public Attributes

double mValue
 Objectve fuction value returned.
Vector3D mGrad
 Gradient values for all vertices.
bool mValid

Detailed Description

Definition at line 59 of file TerminationCriterionTest.cpp.


Constructor & Destructor Documentation

DummyOF::DummyOF ( double  of_value = 0.0,
Vector3D  grad_values = Vector3D( 0, 0, 0 ) 
) [inline]

Definition at line 66 of file TerminationCriterionTest.cpp.

        : mValue( 0.0 ), mGrad( grad_values ), mValid( true )
    {
    }

Member Function Documentation

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

Clear any values accumulated for BCD-related eval calls

Implements MBMesquite::ObjectiveFunction.

Definition at line 85 of file TerminationCriterionTest.cpp.

{}
ObjectiveFunction* DummyOF::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 81 of file TerminationCriterionTest.cpp.

    {
        return new DummyOF( *this );
    }
bool DummyOF::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 855 of file TerminationCriterionTest.cpp.

{
    value = mValue;
    return mValid;
}
bool DummyOF::evaluate_with_gradient ( EvalType  eval_type,
PatchData pd,
double &  OF_val,
std::vector< Vector3D > &  grad,
MsqError err 
) [virtual]

Evaluate objective function and gradient 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.

The default implementation of this function will use the value-only variation of the evaluate method and numerical approximation to calculate gradients. Whenever possible, objective function implementations should provide more efficient analyical gradient calculations.

Parameters:
typeEvaluation type.
pdThe patch.
value_outThe passed-back value of the objective fuction.
grad_outThe gradient of the OF wrt the coordinates of each *free* vertex in the patch.
Returns:
false if any QualityMetric evaluation returned false, true otherwise.

Numerically Calculates the gradient of the ObjectiveFunction for the free vertices in the patch. Returns 'false' if the patch is outside of a required feasible region, returns 'ture' otherwise. The behavior of the function depends on the value of the boolean useLocalGradient. If useLocalGradient is set to 'true', compute_numerical_gradient creates a sub-patch around a free vertex, and then perturbs that vertex in one of the coordinate directions. Only the ObjectiveFunction value on the local sub-patch is used in the computation of the gradient. Therefore, useLocalGradient should only be set to 'true' for ObjectiveFunctions which can use this method. Unless the concrete ObjectiveFunction sets useLocalGradient to 'true' in its constructor, the value will be 'false'. In this case, the objective function value for the entire patch is used in the calculation of the gradient. This is computationally expensive, but it is numerically correct for all (C_1) functions.

Parameters:
pdPatchData on which the gradient is taken.
gradArray of Vector3D of length the number of vertices used to store gradient.
OF_valwill be set to the objective function value.

Reimplemented from MBMesquite::ObjectiveFunction.

Definition at line 861 of file TerminationCriterionTest.cpp.

References MBMesquite::PatchData::num_free_vertices().

{
    value_out = mValue;
    grad_out.clear();
    grad_out.resize( pd.num_free_vertices(), mGrad );
    return mValid;
}
bool DummyOF::initialize_block_coordinate_descent ( MeshDomainAssoc mesh_and_domain,
const Settings settings,
PatchSet user_set,
MsqError err 
) [virtual]

Initial accumulated value for block coordinate descent algorithms.

Set accumulated value of objective function to the value for the entire, unmodified mesh. This is the initial state for a block coordinate descent algorithm. The ObjectiveFunction will asked to add or remove values for a specific patch of the mesh during the optimization.

Parameters:
meshThe Mesh
domainThe MeshDomain
user_setUser-defined patch set - not relevant for most OF templates.

Implements MBMesquite::ObjectiveFunction.

Definition at line 849 of file TerminationCriterionTest.cpp.

References MSQ_SETERR, and MBMesquite::MsqError::NOT_IMPLEMENTED.

{
    MSQ_SETERR( err )( MsqError::NOT_IMPLEMENTED );
    return false;
}
void DummyOF::initialize_queue ( MeshDomainAssoc mesh_and_domain,
const Settings settings,
MsqError err 
) [inline, virtual]

Called at start of instruction queue processing.

Do any preliminary global initialization, consistency checking, etc. This function is pure-virtual (abstract) in this class because every practical OF implementation at this time should have an implementation that at least recursively calls the same function on the underlying QualityMetric or ObjectiveFunction(s).

Implements MBMesquite::ObjectiveFunction.

Definition at line 74 of file TerminationCriterionTest.cpp.

{}
int DummyOF::min_patch_layers ( ) const [inline, virtual]

Get the minimum number of layers of adjacent elements required in a patch to evaluate the objective function for a single free vertex.

Implements MBMesquite::ObjectiveFunction.

Definition at line 86 of file TerminationCriterionTest.cpp.

    {
        return 1;
    }

Member Data Documentation

Gradient values for all vertices.

Definition at line 63 of file TerminationCriterionTest.cpp.

Definition at line 64 of file TerminationCriterionTest.cpp.

Objectve fuction value returned.

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