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

#include <ElementPMeanP.hpp>

+ Inheritance diagram for MBMesquite::ElementPMeanP:
+ Collaboration diagram for MBMesquite::ElementPMeanP:

Public Member Functions

MESQUITE_EXPORT ElementPMeanP (double p, ElemSampleQM *metric)
virtual MESQUITE_EXPORT ~ElementPMeanP ()
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.
virtual MESQUITE_EXPORT bool evaluate_with_gradient (PatchData &pd, size_t handle, double &value, std::vector< size_t > &indices, std::vector< Vector3D > &gradient, MsqError &err)
 Get metric value and gradient at a logical location in the patch.
virtual MESQUITE_EXPORT bool evaluate_with_Hessian (PatchData &pd, size_t handle, double &value, std::vector< size_t > &indices, std::vector< Vector3D > &gradient, std::vector< Matrix3D > &Hessian, MsqError &err)
 Get metric value and deravitives at a logical location in the patch.
virtual MESQUITE_EXPORT bool evaluate_with_Hessian_diagonal (PatchData &pd, size_t handle, double &value, std::vector< size_t > &indices, std::vector< Vector3D > &gradient, std::vector< SymMatrix3D > &Hessian_diagonal, MsqError &err)
 Get metric value and gradient at a logical location in the patch.

Private Attributes

ElemSampleQMmMetric
std::vector< size_t > mHandles

Detailed Description

Definition at line 44 of file ElementPMeanP.hpp.


Constructor & Destructor Documentation

Definition at line 41 of file ElementPMeanP.cpp.

: PMeanPMetric( p ), mMetric( metric ) {}

Definition at line 43 of file ElementPMeanP.cpp.

{}

Member Function Documentation

bool MBMesquite::ElementPMeanP::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 58 of file ElementPMeanP.cpp.

References MBMesquite::PMeanPMetric::average(), MBMesquite::ElemSampleQM::get_element_evaluations(), get_quality_metric(), mHandles, MSQ_CHKERR, and MSQ_ERRFALSE.

Referenced by PMeanPMetricTest::test_element_evaluate(), and PMeanPMetricTest::test_indices().

{
    ElemSampleQM* qm = get_quality_metric();
    mHandles.clear();
    qm->get_element_evaluations( pd, handle, mHandles, err );
    MSQ_ERRFALSE( err );
    bool result = average( pd, qm, mHandles, value, err );
    return !MSQ_CHKERR( err ) && result;
}
bool MBMesquite::ElementPMeanP::evaluate_with_gradient ( PatchData pd,
size_t  handle,
double &  value,
std::vector< size_t > &  indices,
std::vector< Vector3D > &  gradient,
MsqError err 
) [virtual]

Get metric value and gradient 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.
indicesThe free vertices that the evaluation is a function of, specified as vertex indices in the PatchData.
gradientThe gradient of the metric as a function of the coordinates of the free vertices passed back in the indices list.

Reimplemented from MBMesquite::QualityMetric.

Definition at line 68 of file ElementPMeanP.cpp.

References MBMesquite::PMeanPMetric::average_with_gradient(), MBMesquite::ElemSampleQM::get_element_evaluations(), get_quality_metric(), mHandles, MSQ_CHKERR, and MSQ_ERRFALSE.

Referenced by PMeanPMetricTest::test_gradient(), and PMeanPMetricTest::test_hessian().

{
    ElemSampleQM* qm = get_quality_metric();
    mHandles.clear();
    qm->get_element_evaluations( pd, handle, mHandles, err );
    MSQ_ERRFALSE( err );
    bool result = average_with_gradient( pd, qm, mHandles, value, indices, gradient, err );
    return !MSQ_CHKERR( err ) && result;
}
bool MBMesquite::ElementPMeanP::evaluate_with_Hessian ( PatchData pd,
size_t  handle,
double &  value,
std::vector< size_t > &  indices,
std::vector< Vector3D > &  gradient,
std::vector< Matrix3D > &  Hessian,
MsqError err 
) [virtual]

Get metric value and deravitives 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.
indicesThe free vertices that the evaluation is a function of, specified as vertex indices in the PatchData.
gradientThe gradient of the metric as a function of the coordinates of the free vertices passed back in the indices list.
HessianThe Hessian of the metric as a function of the coordinates. The Hessian is passed back as the upper-triangular portion of the matrix in row-major order, where each Matrix3D is the portion of the Hessian with respect to the vertices at the corresponding positions in the indices list.

Reimplemented from MBMesquite::QualityMetric.

Definition at line 83 of file ElementPMeanP.cpp.

References MBMesquite::PMeanPMetric::average_with_Hessian(), MBMesquite::ElemSampleQM::get_element_evaluations(), get_quality_metric(), mHandles, MSQ_CHKERR, and MSQ_ERRFALSE.

Referenced by PMeanPMetricTest::test_hessian(), and PMeanPMetricTest::test_hessian_diagonal().

{
    ElemSampleQM* qm = get_quality_metric();
    mHandles.clear();
    qm->get_element_evaluations( pd, handle, mHandles, err );
    MSQ_ERRFALSE( err );
    bool result = average_with_Hessian( pd, qm, mHandles, value, indices, gradient, Hessian, err );
    return !MSQ_CHKERR( err ) && result;
}
bool MBMesquite::ElementPMeanP::evaluate_with_Hessian_diagonal ( PatchData pd,
size_t  handle,
double &  value,
std::vector< size_t > &  indices,
std::vector< Vector3D > &  gradient,
std::vector< SymMatrix3D > &  Hessian_diagonal,
MsqError err 
) [virtual]

Get metric value and gradient 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.
indicesThe free vertices that the evaluation is a function of, specified as vertex indices in the PatchData.
gradientThe gradient of the metric as a function of the coordinates of the free vertices passed back in the indices list.
Hessian_diagonalThe 3x3 blocks along the diagonal of the Hessian matrix.

Reimplemented from MBMesquite::QualityMetric.

Definition at line 99 of file ElementPMeanP.cpp.

References MBMesquite::PMeanPMetric::average_with_Hessian_diagonal(), MBMesquite::ElemSampleQM::get_element_evaluations(), get_quality_metric(), mHandles, MSQ_CHKERR, and MSQ_ERRFALSE.

Referenced by PMeanPMetricTest::test_hessian_diagonal().

{
    ElemSampleQM* qm = get_quality_metric();
    mHandles.clear();
    qm->get_element_evaluations( pd, handle, mHandles, err );
    MSQ_ERRFALSE( err );
    bool result = average_with_Hessian_diagonal( pd, qm, mHandles, value, indices, gradient, diagonal, err );
    return !MSQ_CHKERR( err ) && result;
}
std::string MBMesquite::ElementPMeanP::get_name ( ) const [virtual]

Implements MBMesquite::QualityMetric.

Definition at line 45 of file ElementPMeanP.cpp.

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

{
    std::string result( "ElementPMeanP(" );
    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 53 of file ElementPMeanP.cpp.

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


Member Data Documentation

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

Definition at line 86 of file ElementPMeanP.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