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

Public Member Functions

 DistTestMetric ()
string get_name () const
int get_negate_flag () const
 1 if metric should be minimized, -1 if metric should be maximized.
bool evaluate (PatchData &pd, size_t vtx_idx, double &value, MsqError &err)
 Get metric value at a logical location in the patch.
bool evaluate_with_indices (PatchData &pd, size_t vtx_idx, double &value, vector< size_t > &indices, MsqError &err)

Public Attributes

bool falseEval
bool failEval

Detailed Description

Define a fake quality metric for testing the objective function

Returns, for each vertex in the patch, the distance of that vertex from the origin as the quality. Each evaluation depends only on a single vertex.

Definition at line 396 of file PMeanPTemplateTest.cpp.


Constructor & Destructor Documentation

Definition at line 399 of file PMeanPTemplateTest.cpp.

: falseEval( false ), failEval( false ) {}

Member Function Documentation

bool DistTestMetric::evaluate ( PatchData pd,
size_t  handle,
double &  value,
MsqError err 
) [virtual]

Get metric value at a logical location in the patch.

Evaluate the metric at one location in the PatchData.

Parameters:
pdThe patch.
handleThe location in the patch (as passed back from get_evaluations).
valueThe output metric value.

Implements MBMesquite::QualityMetric.

Definition at line 420 of file PMeanPTemplateTest.cpp.

References MBMesquite::MsqError::INVALID_STATE, MBMesquite::Vector3D::length_squared(), MSQ_SETERR, MBMesquite::PatchData::vertex_by_index(), and vtx().

{
    if( failEval )
    {
        MSQ_SETERR( err )( MsqError::INVALID_STATE );
        return true;
    }

    const MsqVertex& vtx = pd.vertex_by_index( vtx_idx );
    value                = vtx.length_squared();
    return !falseEval;
}
bool DistTestMetric::evaluate_with_indices ( PatchData pd,
size_t  vtx_idx,
double &  value,
vector< size_t > &  indices,
MsqError err 
)

Definition at line 433 of file PMeanPTemplateTest.cpp.

References MBMesquite::MsqError::INVALID_STATE, MBMesquite::Vector3D::length_squared(), MSQ_SETERR, MBMesquite::PatchData::num_free_vertices(), MBMesquite::PatchData::vertex_by_index(), and vtx().

{
    if( failEval )
    {
        MSQ_SETERR( err )( MsqError::INVALID_STATE );
        return true;
    }

    indices.clear();
    if( vtx_idx < pd.num_free_vertices() ) indices.push_back( vtx_idx );

    const MsqVertex& vtx = pd.vertex_by_index( vtx_idx );
    value                = vtx.length_squared();
    return !falseEval;
}
string DistTestMetric::get_name ( ) const [inline, virtual]

Implements MBMesquite::QualityMetric.

Definition at line 400 of file PMeanPTemplateTest.cpp.

    {
        return "Fake metric for testing objective function";
    }
int DistTestMetric::get_negate_flag ( ) const [inline, virtual]

1 if metric should be minimized, -1 if metric should be maximized.

Implements MBMesquite::QualityMetric.

Definition at line 404 of file PMeanPTemplateTest.cpp.

    {
        return 1;
    }

Member Data Documentation

Definition at line 417 of file PMeanPTemplateTest.cpp.

Definition at line 416 of file PMeanPTemplateTest.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