MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::ElementMaxQM Class Reference

#include <ElementMaxQM.hpp>

+ Inheritance diagram for MBMesquite::ElementMaxQM:
+ Collaboration diagram for MBMesquite::ElementMaxQM:

Public Member Functions

MESQUITE_EXPORT ElementMaxQM (ElemSampleQM *metric)
virtual MESQUITE_EXPORT ~ElementMaxQM ()
MESQUITE_EXPORT ElemSampleQMget_quality_metric () const
virtual MESQUITE_EXPORT std::string get_name () const
virtual MESQUITE_EXPORT int get_negate_flag () const
 1 if metric should be minimized, -1 if metric should be maximized.
virtual MESQUITE_EXPORT bool evaluate (PatchData &pd, size_t handle, double &value, MsqError &err)
 Get metric value at a logical location in the patch.

Private Attributes

ElemSampleQMmMetric
std::vector< size_t > mHandles

Detailed Description

Definition at line 43 of file ElementMaxQM.hpp.


Constructor & Destructor Documentation

Definition at line 42 of file ElementMaxQM.cpp.

: mMetric( metric ) {}

Definition at line 44 of file ElementMaxQM.cpp.

{}

Member Function Documentation

bool MBMesquite::ElementMaxQM::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.

Parameters:
pdThe patch.
handleThe location in the patch (as passed back from get_evaluations).
valueThe output metric value.

Implements MBMesquite::QualityMetric.

Definition at line 59 of file ElementMaxQM.cpp.

References MBMesquite::QualityMetric::evaluate(), MBMesquite::ElemSampleQM::get_element_evaluations(), get_quality_metric(), mHandles, and MSQ_ERRFALSE.

{
    ElemSampleQM* qm = get_quality_metric();
    mHandles.clear();
    qm->get_element_evaluations( pd, handle, mHandles, err );
    MSQ_ERRFALSE( err );

    bool valid = true;
    double tmpval;
    bool tmpvalid;

    value = -1.e+100;  // initialize max computation
    for( std::vector< size_t >::iterator h = mHandles.begin(); h != mHandles.end(); ++h )
    {
        tmpvalid = qm->evaluate( pd, *h, tmpval, err );  // MSQ_ERRZERO(err);
        if( !tmpvalid )
        {
            value = +1.e+100;
            return false;  // if any handle within the element makes tmpvalid false, then valid is
                           // false, no matter what the other handles say
        }
        else if( tmpval > value )
            value = tmpval;
    }

    return valid;
}
std::string MBMesquite::ElementMaxQM::get_name ( ) const [virtual]

Implements MBMesquite::QualityMetric.

Definition at line 46 of file ElementMaxQM.cpp.

References MBMesquite::QualityMetric::get_name(), and mMetric.

{
    std::string result( "ElementMaxQM(" );
    result += mMetric->get_name();
    result += ")";
    return result;
}

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

Implements MBMesquite::QualityMetric.

Definition at line 54 of file ElementMaxQM.cpp.

References MBMesquite::QualityMetric::get_negate_flag(), and get_quality_metric().


Member Data Documentation

std::vector< size_t > MBMesquite::ElementMaxQM::mHandles [mutable, private]

Definition at line 63 of file ElementMaxQM.hpp.

Referenced by evaluate().

Definition at line 62 of file ElementMaxQM.hpp.

Referenced by get_name(), and get_quality_metric().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines