MOAB: Mesh Oriented datABase  (version 5.2.1)
ConstantElementMetric Class Reference

Fake quality metric for testing numerial gradient. More...

+ Inheritance diagram for ConstantElementMetric:
+ Collaboration diagram for ConstantElementMetric:

Public Member Functions

std::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, double &value, MsqError &)
 Get metric value at a logical location in the patch.
bool evaluate_with_indices (PatchData &pd, size_t elem_idx, double &value, std::vector< size_t > &indices, MsqError &)
 Default implementation for all element-based metrics.

Detailed Description

Fake quality metric for testing numerial gradient.

Implement an element metric for which the "quality" is always 1.0. The resulting gradient and Hessian should always be zero.

Definition at line 146 of file QualityMetricTest.cpp.


Member Function Documentation

bool ConstantElementMetric::evaluate ( PatchData pd,
size_t  handle,
double &  value,
MsqError err 
) [inline, 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 157 of file QualityMetricTest.cpp.

    {
        value = 1.0;
        return true;
    }
bool ConstantElementMetric::evaluate_with_indices ( PatchData pd,
size_t  handle,
double &  value,
std::vector< size_t > &  indices,
MsqError err 
) [inline, virtual]

Default implementation for all element-based metrics.

Fill 'indices' with all free vertex indices in element, and call 'evaluate'.

Reimplemented from MBMesquite::ElementQM.

Definition at line 162 of file QualityMetricTest.cpp.

References conn, MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqMeshEntity::node_count(), and MBMesquite::PatchData::num_free_vertices().

    {
        MsqMeshEntity& elem = pd.element_by_index( elem_idx );
        unsigned nv         = elem.node_count();
        const size_t* conn  = elem.get_vertex_index_array();
        indices.clear();
        for( unsigned i = 0; i < nv; ++i )
            if( conn[i] < pd.num_free_vertices() ) indices.push_back( conn[i] );

        value = 1.0;
        return true;
    }
std::string ConstantElementMetric::get_name ( ) const [inline, virtual]

Implements MBMesquite::QualityMetric.

Definition at line 149 of file QualityMetricTest.cpp.

    {
        return "Fake metric for testing numerical gradient";
    }
int ConstantElementMetric::get_negate_flag ( ) const [inline, virtual]

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

Implements MBMesquite::QualityMetric.

Definition at line 153 of file QualityMetricTest.cpp.

    {
        return 1;
    }

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