MOAB: Mesh Oriented datABase  (version 5.4.1)
MetricLogger Class Reference
+ Inheritance diagram for MetricLogger:
+ Collaboration diagram for MetricLogger:

Public Member Functions

 MetricLogger (QualityMetric *metric)
double min () const
double max () const
double avg () const
double sqrsum () const
double rms () const
double dev () const
double pmean (double p) const
bool no_duplicate_evals () const
MetricType get_metric_type () const
std::string get_name () const
int get_negate_flag () const
 1 if metric should be minimized, -1 if metric should be maximized.
void get_evaluations (PatchData &pd, vector< size_t > &handles, bool free, MsqError &err)
bool evaluate (PatchData &pd, size_t handle, double &value, MsqError &err)
 Get metric value at a logical location in the patch.
bool evaluate_with_indices (PatchData &, size_t, double &, vector< size_t > &, MsqError &err)
bool evaluate_with_gradient (PatchData &, size_t, double &, vector< size_t > &, vector< Vector3D > &, MsqError &err)
bool evaluate_with_Hessian (PatchData &, size_t, double &, vector< size_t > &, vector< Vector3D > &, vector< Matrix3D > &, MsqError &err)

Public Attributes

vector< double > mValues
vector< Mesh::EntityHandlemHandles
int invalidCount

Private Attributes

QualityMetricmMetric

Detailed Description

Definition at line 211 of file QualityAssessorTest.cpp.


Constructor & Destructor Documentation

MetricLogger::MetricLogger ( QualityMetric metric) [inline]

Definition at line 214 of file QualityAssessorTest.cpp.

: invalidCount( 0 ), mMetric( metric ) {}

Member Function Documentation

double MetricLogger::avg ( ) const [inline]

Definition at line 228 of file QualityAssessorTest.cpp.

Referenced by QualityAssessorTest::test_basic_stats_element(), QualityAssessorTest::test_basic_stats_sample(), and QualityAssessorTest::test_basic_stats_vertex().

    {
        double x = 0;
        return accumulate( mValues.begin(), mValues.end(), x ) / mValues.size();
    }
bool MetricLogger::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 283 of file QualityAssessorTest.cpp.

References MBMesquite::PatchData::get_element_handles_array(), MBMesquite::PatchData::get_vertex_handles_array(), mMetric, MBMesquite::PatchData::num_elements(), and MBMesquite::QualityMetric::VERTEX_BASED.

    {
        bool rval = mMetric->evaluate( pd, handle, value, err );
        mValues.push_back( value );
        if( get_metric_type() == QualityMetric::VERTEX_BASED )
            mHandles.push_back( pd.get_vertex_handles_array()[handle] );
        else if( handle < pd.num_elements() )
            mHandles.push_back( pd.get_element_handles_array()[handle] );
        if( !rval ) ++invalidCount;
        return rval;
    }
bool MetricLogger::evaluate_with_gradient ( PatchData ,
size_t  ,
double &  ,
vector< size_t > &  ,
vector< Vector3D > &  ,
MsqError err 
) [inline]

Definition at line 301 of file QualityAssessorTest.cpp.

References CPPUNIT_ASSERT, MSQ_SETERR, and NOT_IMPLEMENTED.

    {  // shouldn't be called by QualityAssessor
        CPPUNIT_ASSERT( false );
        MSQ_SETERR( err )( MsqError::NOT_IMPLEMENTED );
        return false;
    }
bool MetricLogger::evaluate_with_Hessian ( PatchData ,
size_t  ,
double &  ,
vector< size_t > &  ,
vector< Vector3D > &  ,
vector< Matrix3D > &  ,
MsqError err 
) [inline]

Definition at line 307 of file QualityAssessorTest.cpp.

References CPPUNIT_ASSERT, MSQ_SETERR, and NOT_IMPLEMENTED.

    {  // shouldn't be called by QualityAssessor
        CPPUNIT_ASSERT( false );
        MSQ_SETERR( err )( MsqError::NOT_IMPLEMENTED );
        return false;
    }
bool MetricLogger::evaluate_with_indices ( PatchData ,
size_t  ,
double &  ,
vector< size_t > &  ,
MsqError err 
) [inline]

Definition at line 295 of file QualityAssessorTest.cpp.

References CPPUNIT_ASSERT, MSQ_SETERR, and NOT_IMPLEMENTED.

    {  // shouldn't be called by QualityAssessor
        CPPUNIT_ASSERT( false );
        MSQ_SETERR( err )( MsqError::NOT_IMPLEMENTED );
        return false;
    }
void MetricLogger::get_evaluations ( PatchData pd,
vector< size_t > &  handles,
bool  free,
MsqError err 
) [inline]

Definition at line 278 of file QualityAssessorTest.cpp.

References mMetric.

    {
        return mMetric->get_evaluations( pd, handles, free, err );
    }
MetricType MetricLogger::get_metric_type ( ) const [inline, virtual]

Implements MBMesquite::QualityMetric.

Definition at line 263 of file QualityAssessorTest.cpp.

References mMetric.

    {
        return mMetric->get_metric_type();
    }
std::string MetricLogger::get_name ( ) const [inline, virtual]

Implements MBMesquite::QualityMetric.

Definition at line 268 of file QualityAssessorTest.cpp.

References mMetric.

    {
        return mMetric->get_name();
    }
int MetricLogger::get_negate_flag ( ) const [inline, virtual]

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

Implements MBMesquite::QualityMetric.

Definition at line 273 of file QualityAssessorTest.cpp.

References mMetric.

    {
        return mMetric->get_negate_flag();
    }
bool MetricLogger::no_duplicate_evals ( ) const [inline]

Definition at line 256 of file QualityAssessorTest.cpp.

Referenced by QualityAssessorTest::test_basic_stats_element(), QualityAssessorTest::test_basic_stats_sample(), and QualityAssessorTest::test_basic_stats_vertex().

    {
        vector< Mesh::EntityHandle > handles( mHandles );
        sort( handles.begin(), handles.end() );
        return handles.end() == unique( handles.begin(), handles.end() );
    }
double MetricLogger::pmean ( double  p) const [inline]

Definition at line 248 of file QualityAssessorTest.cpp.

Referenced by QualityAssessorTest::test_power_mean().

    {
        double result = 0.0;
        for( unsigned i = 0; i < mValues.size(); ++i )
            result += pow( mValues[i], p );
        return pow( result / mValues.size(), 1. / p );
    }
double MetricLogger::sqrsum ( ) const [inline]

Definition at line 233 of file QualityAssessorTest.cpp.

    {
        double result = 0.0;
        for( unsigned i = 0; i < mValues.size(); ++i )
            result += mValues[i] * mValues[i];
        return result;
    }

Member Data Documentation

Definition at line 218 of file QualityAssessorTest.cpp.

Definition at line 321 of file QualityAssessorTest.cpp.

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