MOAB: Mesh Oriented datABase  (version 5.3.0)
QualityMetricTester.cpp File Reference
#include "QualityMetricTester.hpp"
#include "PatchData.hpp"
#include "QualityMetric.hpp"
#include "IdealElements.hpp"
#include "UnitUtil.hpp"
#include "ElemSampleQM.hpp"
#include "TopologyInfo.hpp"
#include "EdgeQM.hpp"
#include <cppunit/extensions/HelperMacros.h>
+ Include dependency graph for QualityMetricTester.cpp:

Go to the source code of this file.

Classes

class  PatchTranslate
class  PatchScale
class  PatchRotate

Typedefs

typedef void(QualityMetricTester::* patch_func_t )(EntityTopology, PatchData &)

Functions

static std::vector
< EntityTopology
types_in_group (QualityMetricTester::ElemTypeGroup group)
static void test_evaluate (PatchData &pd, QualityMetric *qm, double value)
void get_ideal_element (EntityTopology type, bool unit_area, PatchData &pd, int free_vertex_index)
static void test_bad_element (QualityMetricTester *instance, QualityMetric *qm, patch_func_t type_func, bool should_succeed, const std::vector< EntityTopology > &types, const Settings *mSettings)
static double ** allocate_matrix (unsigned n)
static double value (const Matrix3D *blocks, unsigned n, unsigned i, unsigned j)

Typedef Documentation

typedef void( QualityMetricTester::* patch_func_t)(EntityTopology, PatchData &)

Definition at line 1806 of file QualityMetricTester.cpp.


Function Documentation

static double** allocate_matrix ( unsigned  n) [static]

Definition at line 2313 of file QualityMetricTester.cpp.

References n.

{
    unsigned num_ptr = n;
    if( num_ptr % 2 ) ++num_ptr;

    void* storage = malloc( n * n * sizeof( double ) + num_ptr * sizeof( double* ) );
    double** ptrs = (double**)storage;
    double* data  = (double*)( ptrs + num_ptr );
    for( unsigned i = 0; i < n; ++i )
        ptrs[i] = data + i * n;
    return ptrs;
}
void get_ideal_element ( EntityTopology  type,
bool  unit_area,
PatchData pd,
int  free_vertex_index 
)
static void test_bad_element ( QualityMetricTester instance,
QualityMetric qm,
patch_func_t  type_func,
bool  should_succeed,
const std::vector< EntityTopology > &  types,
const Settings mSettings 
) [static]

Definition at line 1807 of file QualityMetricTester.cpp.

References MBMesquite::PatchData::attach_settings(), CPPUNIT_ASSERT, CPPUNIT_ASSERT_EQUAL, MBMesquite::QualityMetric::evaluate(), MBMesquite::QualityMetric::get_evaluations(), and MSQ_CHKERR.

Referenced by QualityMetricTester::test_evaluate_degenerate_element(), QualityMetricTester::test_evaluate_inverted_element(), and QualityMetricTester::test_evaluate_zero_element().

{
    MsqPrintError err( std::cout );
    PatchData pd;
    if( mSettings ) pd.attach_settings( mSettings );
    std::vector< size_t > handles;
    double qmval;
    bool rval;

    CPPUNIT_ASSERT( !types.empty() );
    for( size_t i = 0; i < types.size(); ++i )
    {
        ( instance->*type_func )( types[i], pd );
        qm->get_evaluations( pd, handles, false, err );
        CPPUNIT_ASSERT( !MSQ_CHKERR( err ) );
        CPPUNIT_ASSERT( !handles.empty() );

        rval = true;
        for( size_t j = 0; j < handles.size(); ++j )
        {
            rval = rval && qm->evaluate( pd, handles[j], qmval, err );
            CPPUNIT_ASSERT( !MSQ_CHKERR( err ) );
        }
        CPPUNIT_ASSERT_EQUAL( should_succeed, rval );
    }
}
static std::vector< EntityTopology > types_in_group ( QualityMetricTester::ElemTypeGroup  group) [static]

Definition at line 38 of file QualityMetricTester.cpp.

References QualityMetricTester::ALL, QualityMetricTester::ALL_FE, QualityMetricTester::ALL_FE_EXCEPT_SEPTAHEDRON, MBMesquite::HEXAHEDRON, QualityMetricTester::NON_MIXED_FE, MBMesquite::POLYGON, MBMesquite::POLYHEDRON, MBMesquite::PRISM, MBMesquite::PYRAMID, MBMesquite::QUADRILATERAL, reverse(), MBMesquite::SEPTAHEDRON, QualityMetricTester::SIMPLICIES, MBMesquite::TETRAHEDRON, QualityMetricTester::THREE_D, QualityMetricTester::THREE_D_FE, QualityMetricTester::THREE_D_FE_EXCEPT_SEPTAHEDRON, QualityMetricTester::THREE_D_NON_MIXED_FE, MBMesquite::TRIANGLE, QualityMetricTester::TWO_D, and QualityMetricTester::TWO_D_FE.

{
    std::vector< EntityTopology > types;
    switch( group )
    {
        default:
        case QualityMetricTester::ALL:
            types.push_back( POLYHEDRON );
            types.push_back( POLYGON );
        case QualityMetricTester::ALL_FE:
            types.push_back( SEPTAHEDRON );
        case QualityMetricTester::ALL_FE_EXCEPT_SEPTAHEDRON:
            types.push_back( PYRAMID );
            types.push_back( PRISM );
        case QualityMetricTester::NON_MIXED_FE:
            types.push_back( HEXAHEDRON );
            types.push_back( QUADRILATERAL );
        case QualityMetricTester::SIMPLICIES:
            types.push_back( TETRAHEDRON );
            types.push_back( TRIANGLE );
            break;

        case QualityMetricTester::THREE_D:
            types.push_back( POLYHEDRON );
        case QualityMetricTester::THREE_D_FE:
            types.push_back( SEPTAHEDRON );
        case QualityMetricTester::THREE_D_FE_EXCEPT_SEPTAHEDRON:
            types.push_back( PYRAMID );
            types.push_back( PRISM );
        case QualityMetricTester::THREE_D_NON_MIXED_FE:
            types.push_back( HEXAHEDRON );
            types.push_back( TETRAHEDRON );
            break;

        case QualityMetricTester::TWO_D:
            types.push_back( POLYGON );
        case QualityMetricTester::TWO_D_FE:
            types.push_back( TRIANGLE );
            types.push_back( QUADRILATERAL );
            break;
    }
    std::reverse( types.begin(), types.end() );
    return types;
}
static double value ( const Matrix3D blocks,
unsigned  n,
unsigned  i,
unsigned  j 
) [static]

Definition at line 2326 of file QualityMetricTester.cpp.

References swap().

Referenced by moab::SimpleStat< T >::add(), MBMesquite::SimpleStats::add_squared(), MBMesquite::SimpleStats::add_value(), ProgOptions::addOpt(), ProgOptions::addRequiredArg(), moab::ParallelComm::augment_default_sets_with_ghosts(), FileTokenizerTest::boolean_test(), check_range_set(), PMeanPTemplateTest::check_result(), moab::BitTag::clear_data(), MBMesquite::ParallelHelperImpl::communicate_all_true(), MBMesquite::ParallelHelperImpl::communicate_any_true(), ObjectiveFunctionTests::compare_numerical_hessian(), compare_single_iter(), MBMesquite::NonSmoothDescent::compute_gradient(), MBMesquite::derivatives_at_mid_edge(), FileTokenizerTest::double_test(), MBMesquite::LInfTemplate::evaluate(), MBMesquite::MaxTemplate::evaluate(), MBMesquite::PatchPowerMeanP::evaluate(), FauxMetric< typename TMPTypes< TQualityMetric >::MetricType >::evaluate(), MBMesquite::VarianceTemplate::evaluate(), MBMesquite::LPtoPTemplate::evaluate(), MBMesquite::PMeanPTemplate::evaluate(), MBMesquite::NonGradient::evaluate(), ParabolicVertexMetric::evaluate(), TriTauMetric::evaluate(), moab::Element::SpectralHex::evaluate_scalar_field(), moab::Element::SpectralQuad::evaluate_scalar_field(), MBMesquite::EdgeLengthMetric::evaluate_with_gradient(), MBMesquite::PatchPowerMeanP::evaluate_with_gradient(), MBMesquite::VarianceTemplate::evaluate_with_gradient(), MBMesquite::PMeanPTemplate::evaluate_with_gradient(), MBMesquite::QualityMetric::evaluate_with_gradient(), MBMesquite::PatchPowerMeanP::evaluate_with_Hessian(), MBMesquite::PMeanPTemplate::evaluate_with_Hessian(), MBMesquite::VarianceTemplate::evaluate_with_Hessian_diagonal(), MBMesquite::PMeanPTemplate::evaluate_with_Hessian_diagonal(), ParabolicVertexMetric::evaluate_with_indices(), TriTauMetric::evaluate_with_indices(), moab::ReadABAQUS::extract_keyword_parameters(), smoab::faceIdsPerCell(), moab::BitTag::find_entities_with_value(), smoab::Interface::findEntitiesWithTag(), CompositeOFTest::get_hessians(), moab::FileOptions::get_ints_option(), moab::ReadMCNP5::get_mesh_plane(), moab::FileOptions::get_option(), MBMesquite::InverseMetricWeight::get_weight(), MBMesquite::MetricWeight::get_weight(), ScaleWeight::get_weight(), ProgOptions::getReqArg(), smoab::Interface::getTagData(), MBMesquite::ObjectiveFunctionTemplate::initialize_block_coordinate_descent(), MBMesquite::PatchPowerMeanP::initialize_block_coordinate_descent(), moab::FBEngine::initializeSmoothing(), FileTokenizerTest::long_test(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), main(), moab::FileOptions::match_option(), MBMesquite::Matrix3D::Matrix3D(), mb_type_is_maxtype_test(), smoab::detail::ReadSparseTag::multiSetRead(), parse_tag_create(), parse_value< double >(), IntxUtilsCSLAM::quasi_smooth_field(), read_scalar_attrib(), ReadFileMetaData(), MBMesquite::reduce_parallel_max(), moab::DenseTag::remove_data(), moab::IntxUtils::remove_duplicate_vertices(), MBMesquite::set_corner_derivatives(), MBMesquite::set_edge_derivatives(), MBMesquite::set_equal_derivatives(), MBMesquite::UntangleWrapper::set_metric_constant(), OFTestQM::set_negate_flag(), moab::ReadCGM::set_options(), MBMesquite::QualityAssessor::Assessor::set_stopping_function(), MBMesquite::MeshImplData::set_vertex_byte(), moab::BSPTreePoly::set_vertex_marks(), MBMesquite::TagVertexMesh::should_clean_up_tag_data(), smoab::detail::ReadSparseTag::singleSetRead(), IntxUtilsCSLAM::slotted_cylinder_field(), string_tag_value(), stringify(), CachedTargetCalculator::surf_orient(), TMPQualityMetricTest< AWQualityMetric >::test_2d_eval_ortho_quad(), TMPQualityMetricTest< AWQualityMetric >::test_3d_eval_ortho_hex(), test_bit_tag_big(), NumericalOFTest::test_changed(), UntangleBetaTest::test_degenerate_elements(), test_delete_type_tag(), PMeanPTemplateTest::test_diagonal(), QualityMetricTest::test_diagonal_constant(), QualityMetricTest::test_diagonal_linear(), QualityMetricTest::test_diagonal_parabolic(), QualityMetricTest::test_diagonal_tau(), CompositeOFTest::test_eval_fails(), PMeanPTemplateTest::test_evaluate(), CompositeOFTest::test_evaluate(), TMPQualityMetricTest< QMType >::test_evaluate_2D(), TMPQualityMetricTest< AWQualityMetric >::test_evaluate_2D_weight(), TMPQualityMetricTest< QMType >::test_evaluate_3D(), TMPQualityMetricTest< AWQualityMetric >::test_evaluate_3D_weight(), TMPQualityMetricTest< QMType >::test_evaluate_surface(), TMPQualityMetricTest< AWQualityMetric >::test_evaluate_surface_weight(), test_flag_cancel(), test_flag_opt_long(), test_flag_opt_long_short(), PMeanPTemplateTest::test_gradient(), TerminationCriterionTest::test_gradient_common(), QualityMetricTest::test_gradient_constant(), QualityMetricTest::test_gradient_linear(), QualityMetricTest::test_gradient_parabolic(), QualityMetricTest::test_gradient_tau(), NumericalOFTest::test_gradient_values(), NumericalOFTest::test_handles_eval_failure(), NumericalOFTest::test_handles_eval_false(), PMeanPTemplateTest::test_Hessian(), QualityMetricTest::test_Hessian_constant(), NumericalOFTest::test_Hessian_fails(), StdDevTemplateTest::test_hessian_fails(), StdDevTemplateTest::test_hessian_fails_sqr(), QualityMetricTest::test_Hessian_linear(), QualityMetricTest::test_Hessian_parabolic(), QualityMetricTest::test_Hessian_tau(), CompositeOFTest::test_invalid_eval(), UntangleBetaTest::test_inverted_elements(), ObjectiveFunctionTest::test_max_negate_flag(), test_mesh_value(), CompositeOFTest::test_multiply_hess_diagonal(), CompositeOFTest::test_multiply_hessian(), ObjectiveFunctionTests::test_negate_flag(), QualityAssessorTest::test_print_inverted(), test_read_handle_tag(), test_read_int_tag(), test_read_real_tag(), TMPQualityMetricTest< AWQualityMetric >::test_surf_eval_ortho_quad(), QualityMetricTester::test_type_is_not_supported(), QualityMetricTester::test_type_is_supported(), NumericalOFTest::test_unchanged(), CLArgs::KeyWordArg::value(), MBMesquite::MsqIMesh::vertex_get_byte(), MBMesquite::MsqMOAB::vertex_get_byte(), MBMesquite::MsqIMesh::vertex_set_byte(), MBMesquite::MsqMOAB::vertex_set_byte(), and moab::WriteVtk::write_bit_tag().

{
    if( i > j ) std::swap( i, j );

    unsigned mi  = i / 3;
    unsigned mj  = j / 3;
    unsigned idx = n * mi - mi * ( mi + 1 ) / 2 + mj;
    return blocks[idx][i % 3][j % 3];
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines