MOAB: Mesh Oriented datABase  (version 5.2.1)

Offset a quality metric by a scalar value. More...

#include <ScalarAddQualityMetric.hpp>

## Public Member Functions

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, std::vector< size_t > &handles, bool free_vertices_only, MsqError &err)
Get locations at which metric can be evaluated.
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 &pd, size_t handle, double &value, std::vector< size_t > &indices, MsqError &err)
Get metric value at a logical location in the patch.
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.
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.

## Private Attributes

QualityMetricmMetric
double mOffset

## Detailed Description

Offset a quality metric by a scalar value.

Definition at line 42 of file ScalarAddQualityMetric.hpp.

## Constructor & Destructor Documentation

 MBMesquite::ScalarAddQualityMetric::ScalarAddQualityMetric ( QualityMetric * metric, double offset )  [inline]

Definition at line 45 of file ScalarAddQualityMetric.hpp.

: mMetric( metric ), mOffset( offset ) {}

 MBMesquite::ScalarAddQualityMetric::~ScalarAddQualityMetric ( )  [inline]

Definition at line 47 of file ScalarAddQualityMetric.hpp.

{}


## Member Function Documentation

 bool MBMesquite::ScalarAddQualityMetric::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:
 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 55 of file ScalarAddQualityMetric.cpp.

References MBMesquite::QualityMetric::evaluate(), mMetric, and mOffset.

{
bool rval = mMetric->evaluate( pd, handle, value, err );
value += mOffset;
return rval;
}

 bool MBMesquite::ScalarAddQualityMetric::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:
 pd The patch. handle The location in the patch (as passed back from get_evaluations). value The output metric value. indices The free vertices that the evaluation is a function of, specified as vertex indices in the PatchData. gradient The 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 70 of file ScalarAddQualityMetric.cpp.

{
value += mOffset;
return !MSQ_CHKERR( err ) && rval;
}

 bool MBMesquite::ScalarAddQualityMetric::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:
 pd The patch. handle The location in the patch (as passed back from get_evaluations). value The output metric value. indices The free vertices that the evaluation is a function of, specified as vertex indices in the PatchData. gradient The gradient of the metric as a function of the coordinates of the free vertices passed back in the indices list. Hessian The 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 79 of file ScalarAddQualityMetric.cpp.

{
bool rval = mMetric->evaluate_with_Hessian( pd, handle, value, indices, gradient, Hessian, err );
value += mOffset;
return !MSQ_CHKERR( err ) && rval;
}

 bool MBMesquite::ScalarAddQualityMetric::evaluate_with_indices ( PatchData & pd, size_t handle, double & value, std::vector< size_t > & indices, MsqError & err )  [virtual]

Get metric value at a logical location in the patch.

Evaluate the metric at one location in the PatchData.

Parameters:
 pd The patch. handle The location in the patch (as passed back from get_evaluations). value The output metric value. indices The free vertices that the evaluation is a function of, specified as vertex indices in the PatchData.

Implements MBMesquite::QualityMetric.

Definition at line 62 of file ScalarAddQualityMetric.cpp.

{
bool rval = mMetric->evaluate_with_indices( pd, handle, value, indices, err );
value += mOffset;
return !MSQ_CHKERR( err ) && rval;
}

 void MBMesquite::ScalarAddQualityMetric::get_evaluations ( PatchData & pd, std::vector< size_t > & handles, bool free_vertices_only, MsqError & err )  [virtual]

Get locations at which metric can be evaluated.

Different metrics are evaluated for different things within a patch. For example, an element-based metric will be evaluated once for each element in patch, a vertex-based metric once for each veretx, and a target/sample-point based metric will be evaluated once for each samle point in each element. This method returns a list of handles, one for each location in the patch at which the metric can be evaluated. The handle values are used as input to the evaluate methods.

Parameters:
 pd The patch handles Output list of handles free_vertices_only If true, only pass back evaluation points that depend on at least one free vertex.

Implements MBMesquite::QualityMetric.

Definition at line 49 of file ScalarAddQualityMetric.cpp.

References MBMesquite::QualityMetric::get_evaluations(), mMetric, and MSQ_CHKERR.

{
mMetric->get_evaluations( pd, handles, free_vertices_only, err );MSQ_CHKERR( err );
}

 MetricType MBMesquite::ScalarAddQualityMetric::get_metric_type ( ) const [inline, virtual]

Implements MBMesquite::QualityMetric.

Definition at line 49 of file ScalarAddQualityMetric.hpp.

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

    {
return mMetric->get_metric_type();
}

 std::string MBMesquite::ScalarAddQualityMetric::get_name ( ) const [virtual]

Implements MBMesquite::QualityMetric.

Definition at line 42 of file ScalarAddQualityMetric.cpp.

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

{
std::ostringstream str;
str << mMetric->get_name() << "+" << mOffset;
return str.str();
}

 int MBMesquite::ScalarAddQualityMetric::get_negate_flag ( ) const [inline, virtual]

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

Implements MBMesquite::QualityMetric.

Definition at line 56 of file ScalarAddQualityMetric.hpp.

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

    {
return mMetric->get_negate_flag();
}


## Member Data Documentation

 QualityMetric* MBMesquite::ScalarAddQualityMetric::mMetric [private]

Definition at line 75 of file ScalarAddQualityMetric.hpp.

 double MBMesquite::ScalarAddQualityMetric::mOffset [private]

Definition at line 76 of file ScalarAddQualityMetric.hpp.

List of all members.

The documentation for this class was generated from the following files: