MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Public Member Functions | |
DistTestMetric () | |
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 vtx_idx, double &value, MsqError &err) |
Get metric value at a logical location in the patch. | |
bool | evaluate_with_indices (PatchData &pd, size_t vtx_idx, double &value, vector< size_t > &indices, MsqError &err) |
Public Attributes | |
bool | falseEval |
bool | failEval |
Define a fake quality metric for testing the objective function
Returns, for each vertex in the patch, the distance of that vertex from the origin as the quality. Each evaluation depends only on a single vertex.
Definition at line 396 of file PMeanPTemplateTest.cpp.
DistTestMetric::DistTestMetric | ( | ) | [inline] |
Definition at line 399 of file PMeanPTemplateTest.cpp.
bool DistTestMetric::evaluate | ( | PatchData & | pd, |
size_t | handle, | ||
double & | value, | ||
MsqError & | err | ||
) | [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 420 of file PMeanPTemplateTest.cpp.
References MBMesquite::MsqError::INVALID_STATE, MBMesquite::Vector3D::length_squared(), MSQ_SETERR, MBMesquite::PatchData::vertex_by_index(), and vtx().
{ if( failEval ) { MSQ_SETERR( err )( MsqError::INVALID_STATE ); return true; } const MsqVertex& vtx = pd.vertex_by_index( vtx_idx ); value = vtx.length_squared(); return !falseEval; }
bool DistTestMetric::evaluate_with_indices | ( | PatchData & | pd, |
size_t | vtx_idx, | ||
double & | value, | ||
vector< size_t > & | indices, | ||
MsqError & | err | ||
) |
Definition at line 433 of file PMeanPTemplateTest.cpp.
References MBMesquite::MsqError::INVALID_STATE, MBMesquite::Vector3D::length_squared(), MSQ_SETERR, MBMesquite::PatchData::num_free_vertices(), MBMesquite::PatchData::vertex_by_index(), and vtx().
{ if( failEval ) { MSQ_SETERR( err )( MsqError::INVALID_STATE ); return true; } indices.clear(); if( vtx_idx < pd.num_free_vertices() ) indices.push_back( vtx_idx ); const MsqVertex& vtx = pd.vertex_by_index( vtx_idx ); value = vtx.length_squared(); return !falseEval; }
string DistTestMetric::get_name | ( | ) | const [inline, virtual] |
Implements MBMesquite::QualityMetric.
Definition at line 400 of file PMeanPTemplateTest.cpp.
{ return "Fake metric for testing objective function"; }
int DistTestMetric::get_negate_flag | ( | ) | const [inline, virtual] |
1 if metric should be minimized, -1 if metric should be maximized.
Implements MBMesquite::QualityMetric.
Definition at line 404 of file PMeanPTemplateTest.cpp.
{
return 1;
}
Definition at line 417 of file PMeanPTemplateTest.cpp.
Definition at line 416 of file PMeanPTemplateTest.cpp.