MOAB: Mesh Oriented datABase
(version 5.2.1)
|
Fake quality metric for testing numerial gradient. 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. | |
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. |
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.
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.
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 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;
}