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

Base type for per-element quality metrics. More...

#include <ElementQM.hpp>

+ Inheritance diagram for MBMesquite::ElementQM:
+ Collaboration diagram for MBMesquite::ElementQM:

Public Member Functions

virtual MESQUITE_EXPORT ~ElementQM ()
virtual MESQUITE_EXPORT MetricType get_metric_type () const
virtual MESQUITE_EXPORT void get_evaluations (PatchData &pd, std::vector< size_t > &handles, bool free_vertices_only, MsqError &err)
 Returns list of element indices in PatchData.
virtual MESQUITE_EXPORT bool evaluate_with_indices (PatchData &pd, size_t handle, double &value, std::vector< size_t > &indices, MsqError &err)
 Default implementation for all element-based metrics.

Static Public Member Functions

static MESQUITE_EXPORT void get_element_evaluations (PatchData &pd, std::vector< size_t > &handles, bool free_vertices_only, MsqError &err)

Detailed Description

Base type for per-element quality metrics.

Definition at line 42 of file ElementQM.hpp.


Constructor & Destructor Documentation

Definition at line 39 of file ElementQM.cpp.

{}

Member Function Documentation

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

Default implementation for all element-based metrics.

Fill 'indices' with all free vertex indices in element, and call 'evaluate'.

Implements MBMesquite::QualityMetric.

Reimplemented in TriTauMetric, and ConstantElementMetric.

Definition at line 74 of file ElementQM.cpp.

References MBMesquite::PatchData::element_by_index(), MBMesquite::QualityMetric::evaluate(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MSQ_CHKERR, n, MBMesquite::PatchData::num_free_vertices(), MBMesquite::MsqMeshEntity::vertex_count(), and vtx().

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

{
    const MsqMeshEntity& elem = pd.element_by_index( handle );
    const size_t* vtx         = elem.get_vertex_index_array();
    const unsigned n          = elem.vertex_count();
    indices.clear();
    for( unsigned i = 0; i < n; ++i )
        if( vtx[i] < pd.num_free_vertices() ) indices.push_back( vtx[i] );

    bool rval = evaluate( pd, handle, value, err );
    return !MSQ_CHKERR( err ) && rval;
}
void MBMesquite::ElementQM::get_element_evaluations ( PatchData pd,
std::vector< size_t > &  handles,
bool  free_vertices_only,
MsqError err 
) [static]

Definition at line 46 of file ElementQM.cpp.

References MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqMeshEntity::node_count(), MBMesquite::PatchData::num_elements(), MBMesquite::PatchData::num_free_vertices(), and vtx().

Referenced by get_evaluations(), and MBMesquite::get_sample_pt_evaluations().

{
    size_t num_elem = pd.num_elements();
    if( !free_vertices_only )
    {
        handles.resize( num_elem );
        for( size_t i = 0; i < num_elem; ++i )
            handles[i] = i;
        return;
    }

    handles.clear();
    for( size_t i = 0; i < num_elem; ++i )
    {
        // check if element has any free vertices
        MsqMeshEntity& elem = pd.element_by_index( i );
        unsigned num_vtx    = elem.node_count();
        size_t* vtx         = elem.get_vertex_index_array();
        unsigned j;
        for( j = 0; j < num_vtx && vtx[j] >= pd.num_free_vertices(); ++j )
            ;
        if( j < num_vtx ) handles.push_back( i );
    }
}
void MBMesquite::ElementQM::get_evaluations ( PatchData pd,
std::vector< size_t > &  handles,
bool  free_vertices_only,
MsqError err 
) [virtual]

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