MOAB: Mesh Oriented datABase  (version 5.3.1)
SphericalGeometryTest Class Reference
+ Inheritance diagram for SphericalGeometryTest:
+ Collaboration diagram for SphericalGeometryTest:

Public Member Functions

void setUp ()
void tearDown ()
 SphericalGeometryTest ()
void test_cg_mesh_cond_sphere ()
void test_smart_lapl_sphere ()
void test_lapl_geo_sphere ()

Private Member Functions

 CPPUNIT_TEST_SUITE (SphericalGeometryTest)
 CPPUNIT_TEST (test_cg_mesh_cond_sphere)
 CPPUNIT_TEST (test_smart_lapl_sphere)
 CPPUNIT_TEST (test_lapl_geo_sphere)
 CPPUNIT_TEST_SUITE_END ()

Private Attributes

double qualTol
int pF

Detailed Description

Definition at line 85 of file SphericalGeometryTest.cpp.


Constructor & Destructor Documentation

Definition at line 113 of file SphericalGeometryTest.cpp.

{}

Member Function Documentation

void SphericalGeometryTest::setUp ( ) [inline]

Definition at line 102 of file SphericalGeometryTest.cpp.

References MBMesquite::MSQ_MIN.

    {
        // pF=1;//PRINT_FLAG IS ON
        pF = 0;  // PRINT_FLAG IS OFF
                 // tolerance double
        qualTol = MSQ_MIN;
    }

Definition at line 110 of file SphericalGeometryTest.cpp.

{}

Definition at line 115 of file SphericalGeometryTest.cpp.

References MBMesquite::TerminationCriterion::add_iteration_limit(), center(), CPPUNIT_ASSERT, MBMesquite::QualityAssessor::loop_over_mesh(), mesh, MBMesquite::MeshImpl::read_vtk(), MBMesquite::IQInterface::run_instructions(), MBMesquite::ConjugateGradient::set_debugging_level(), MBMesquite::QualityImprover::set_inner_termination_criterion(), MBMesquite::InstructionQueue::set_master_quality_improver(), and MBMesquite::PatchSetUser::use_global_patch().

    {
        MBMesquite::MeshImpl mesh;
        MBMesquite::MsqPrintError err( cout );
        mesh.read_vtk( MESH_FILES_DIR "2D/vtk/quads/untangled/quads_on_sphere_529.vtk", err );
        CPPUNIT_ASSERT( !err );

        // create geometry: sphere, center (2,2,0), radius 3
        Vector3D center( 2, 2, 0 );
        SphericalDomain msq_geom( center, 3.0 );

        // creates an intruction queue
        InstructionQueue queue1;

        // creates a mean ratio quality metric ...
        ConditionNumberQualityMetric shape;
        UntangleBetaQualityMetric untan;

        // ... and builds an objective function with it
        LPtoPTemplate obj_func( &shape, 2, err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // creates the steepest descent optimization procedures
        ConjugateGradient pass1( &obj_func, err );
        // SteepestDescent* pass2 = new SteepestDescent( obj_func );
        pass1.use_global_patch();
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        QualityAssessor qa = QualityAssessor( &shape );

        //**********Set stopping criterion  5 iterates ****************
        // StoppingCriterion sc5(StoppingCriterion::NUMBER_OF_PASSES,5);
        // pass1->set_stopping_criterion(&sc5);
        TerminationCriterion sc5;
        sc5.add_iteration_limit( 5 );
        pass1.set_inner_termination_criterion( &sc5 );
        // CG's debugging print, increase integer to get more print info
        pass1.set_debugging_level( 0 );

        //  queue1.add_preconditioner(pass2, err); CPPUNIT_ASSERT(!err);
        queue1.set_master_quality_improver( &pass1, err );
        CPPUNIT_ASSERT( !err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // launches optimization on mesh_set1
        MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &mesh, &msq_geom );
        double orig_qa_val              = qa.loop_over_mesh( &mesh_and_domain, 0, err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        queue1.run_instructions( &mesh_and_domain, err );
        CPPUNIT_ASSERT( !err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        double fin_qa_val = qa.loop_over_mesh( &mesh_and_domain, 0, err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // make sure 'quality' improved
        CPPUNIT_ASSERT( fin_qa_val <= orig_qa_val );
    }

Definition at line 225 of file SphericalGeometryTest.cpp.

References MBMesquite::TerminationCriterion::add_iteration_limit(), center(), CPPUNIT_ASSERT, MBMesquite::QualityAssessor::loop_over_mesh(), mesh, MBMesquite::MeshImpl::read_vtk(), MBMesquite::IQInterface::run_instructions(), MBMesquite::InstructionQueue::set_master_quality_improver(), and MBMesquite::QualityImprover::set_outer_termination_criterion().

    {
        MBMesquite::MeshImpl mesh;
        MBMesquite::MsqPrintError err( cout );

        mesh.read_vtk( MESH_FILES_DIR "2D/vtk/tris/untangled/Mesquite_geo_10242.vtk", err );

        // create geometry sphere:  ratius 1, centered at (0,0,0)
        Vector3D center( 0, 0, 0 );
        MBMesquite::SphericalDomain msq_geom( center, 1.0 );

        // creates an intruction queue
        InstructionQueue queue1;

        // creates an edge length metric ...
        EdgeLengthQualityMetric edg_len;

        // create the laplacian smoother
        LaplacianSmoother lapl;
        // Make sure no errors
        CPPUNIT_ASSERT( !err );

        // create a quality assessor
        QualityAssessor qa = QualityAssessor( &edg_len );

        //*******Set stopping criterion 10 iterates  ***********
        // StoppingCriterion sc10(StoppingCriterion::NUMBER_OF_PASSES,10);
        // lapl->set_stopping_criterion(&sc10);
        TerminationCriterion sc10;
        sc10.add_iteration_limit( 10 );
        lapl.set_outer_termination_criterion( &sc10 );
        // qa, qi, qa
        queue1.set_master_quality_improver( &lapl, err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // launches optimization on mesh_set1
        MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &mesh, &msq_geom );
        double orig_qa_val              = qa.loop_over_mesh( &mesh_and_domain, 0, err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        queue1.run_instructions( &mesh_and_domain, err );
        CPPUNIT_ASSERT( !err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        double fin_qa_val = qa.loop_over_mesh( &mesh_and_domain, 0, err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // make sure 'quality' improved
        CPPUNIT_ASSERT( fin_qa_val <= orig_qa_val );
    }

Definition at line 174 of file SphericalGeometryTest.cpp.

References MBMesquite::TerminationCriterion::add_iteration_limit(), center(), CPPUNIT_ASSERT, MBMesquite::QualityAssessor::loop_over_mesh(), mesh, MBMesquite::MeshImpl::read_vtk(), MBMesquite::IQInterface::run_instructions(), MBMesquite::InstructionQueue::set_master_quality_improver(), and MBMesquite::QualityImprover::set_outer_termination_criterion().

    {
        MBMesquite::MeshImpl mesh;
        MBMesquite::MsqPrintError err( cout );
        mesh.read_vtk( MESH_FILES_DIR "2D/vtk/quads/untangled/quads_on_sphere_529.vtk", err );

        // create geometry sphere:  ratius 1, centered at (0,0,0)
        Vector3D center( 2, 2, 0 );
        SphericalDomain msq_geom( center, 3.0 );

        // creates an intruction queue
        InstructionQueue queue1;

        // creates an edge length metric ...
        IdealWeightInverseMeanRatio shape_metric( err );
        LInfTemplate shape_func( &shape_metric );

        // create the smart laplacian smoother
        SmartLaplacianSmoother s_lapl( &shape_func );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );

        //*******Set stopping criterion 5 iterates  ***********
        TerminationCriterion sc5;
        sc5.add_iteration_limit( 5 );
        s_lapl.set_outer_termination_criterion( &sc5 );
        // qa, qi, qa
        queue1.set_master_quality_improver( &s_lapl, err );
        CPPUNIT_ASSERT( !err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // launches optimization on mesh_set1
        QualityAssessor qa              = QualityAssessor( &shape_metric );
        MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &mesh, &msq_geom );
        double orig_val                 = qa.loop_over_mesh( &mesh_and_domain, 0, err );

        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        queue1.run_instructions( &mesh_and_domain, err );
        CPPUNIT_ASSERT( !err );
        // Make sure no errors
        CPPUNIT_ASSERT( !err );

        double final_val = qa.loop_over_mesh( &mesh_and_domain, 0, err );

        // Make sure no errors
        CPPUNIT_ASSERT( !err );
        // make sure 'quality' improved
        CPPUNIT_ASSERT( final_val < orig_val );
    }

Member Data Documentation

Definition at line 100 of file SphericalGeometryTest.cpp.

Definition at line 99 of file SphericalGeometryTest.cpp.

List of all members.


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