MOAB: Mesh Oriented datABase
(version 5.4.1)
|
More complex fake metric for testing finite difference. More...
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. |
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.
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.
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 258 of file QualityMetricTest.cpp.
References MBMesquite::det(), and value().
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;
}
MsqMatrix< 3, 3 > TriTauMetric::matrix | ( | PatchData & | pd, |
size_t | elem_idx | ||
) | [inline] |
Definition at line 243 of file QualityMetricTest.cpp.
References conn, CPPUNIT_ASSERT, MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqMeshEntity::node_count(), MBMesquite::MsqMatrix< R, C >::set_row(), MBMesquite::Vector3D::to_array(), and MBMesquite::PatchData::vertex_by_index().
Referenced by QualityMetricTest::test_diagonal_tau(), QualityMetricTest::test_gradient_tau(), and QualityMetricTest::test_Hessian_tau().
{ 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; }