MOAB: Mesh Oriented datABase  (version 5.4.1)
TriTauMetric Class Reference

More complex fake metric for testing finite difference. More...

+ Inheritance diagram for TriTauMetric:
+ Collaboration diagram for TriTauMetric:

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.
MsqMatrix< 3, 3 > matrix (PatchData &pd, size_t elem_idx)
bool evaluate (PatchData &pd, size_t element_idx, 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

More complex fake metric for testing finite difference.

Calculate /f$ (det(M)-1)^2 /f$ where the rows of M are the coordinates of the three vertices in the triangle.

Definition at line 232 of file QualityMetricTest.cpp.


Member Function Documentation

bool TriTauMetric::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 258 of file QualityMetricTest.cpp.

References MBMesquite::det(), and value().

    {
        MsqMatrix< 3, 3 > M = matrix( pd, element_idx );
        value               = det( M ) - 1;
        value *= value;
        return true;
    }
bool TriTauMetric::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 266 of file QualityMetricTest.cpp.

References conn, MBMesquite::det(), MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::PatchData::is_vertex_free(), MBMesquite::MsqMeshEntity::node_count(), and value().

    {
        MsqMatrix< 3, 3 > M = matrix( pd, elem_idx );
        value               = det( M ) - 1;
        value *= value;

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

        return true;
    }
std::string TriTauMetric::get_name ( ) const [inline, virtual]

Implements MBMesquite::QualityMetric.

Definition at line 235 of file QualityMetricTest.cpp.

    {
        return "Triangle Tau Metric";
    }
int TriTauMetric::get_negate_flag ( ) const [inline, virtual]

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

Implements MBMesquite::QualityMetric.

Definition at line 239 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