MOAB: Mesh Oriented datABase  (version 5.3.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 216 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:
 pd The patch. handle The location in the patch (as passed back from get_evaluations). value The output metric value.

Implements MBMesquite::QualityMetric.

Definition at line 242 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 250 of file QualityMetricTest.cpp.

    {
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 219 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 223 of file QualityMetricTest.cpp.

    {
return 1;
}

 MsqMatrix< 3, 3 > TriTauMetric::matrix ( PatchData & pd, size_t elem_idx )  [inline]

Definition at line 227 of file QualityMetricTest.cpp.

    {
MsqMeshEntity& elem = pd.element_by_index( elem_idx );
unsigned nv         = elem.node_count();
const size_t* conn  = elem.get_vertex_index_array();
CPPUNIT_ASSERT( nv == 3 );

MsqMatrix< 3, 3 > M;
M.set_row( 0, pd.vertex_by_index( conn[0] ).to_array() );
M.set_row( 1, pd.vertex_by_index( conn[1] ).to_array() );
M.set_row( 2, pd.vertex_by_index( conn[2] ).to_array() );

return M;
}


List of all members.

The documentation for this class was generated from the following file: