MOAB: Mesh Oriented datABase  (version 5.4.1)
analytical_grad3D_test.cpp File Reference
#include <iostream>
#include <cstdlib>
#include "Mesquite.hpp"
#include "MeshImpl.hpp"
#include "MsqError.hpp"
#include "Vector3D.hpp"
#include "InstructionQueue.hpp"
#include "PatchData.hpp"
#include "TerminationCriterion.hpp"
#include "QualityAssessor.hpp"
#include "IdealWeightInverseMeanRatio.hpp"
#include "ConditionNumberQualityMetric.hpp"
#include "LPtoPTemplate.hpp"
#include "LInfTemplate.hpp"
#include "SteepestDescent.hpp"
#include "TestUtil.hpp"
+ Include dependency graph for analytical_grad3D_test.cpp:

Go to the source code of this file.

Functions

int main ()

Function Documentation

int main ( )

Definition at line 69 of file analytical_grad3D_test.cpp.

References MBMesquite::TerminationCriterion::add_iteration_limit(), MBMesquite::QualityAssessor::add_quality_assessment(), MBMesquite::InstructionQueue::add_quality_assessor(), MBMesquite::QualityMetric::LINEAR, mesh, MBMesquite::MeshImpl::read_vtk(), MBMesquite::IQInterface::run_instructions(), MBMesquite::AveragingQM::set_averaging_method(), MBMesquite::QualityImprover::set_inner_termination_criterion(), MBMesquite::InstructionQueue::set_master_quality_improver(), MBMesquite::PatchSetUser::use_global_patch(), and MBMesquite::MeshImpl::write_vtk().

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

    std::string file_name = TestDir + "unittest/mesquite/3D/vtk/hexes/untangled/hexes_4by2by2.vtk";
    mesh.read_vtk( file_name.c_str(), err );

    // creates an intruction queue
    InstructionQueue queue1;

    // creates a mean ratio quality metric ...
    IdealWeightInverseMeanRatio mean_ratio( err );
    if( err ) return 1;
    ConditionNumberQualityMetric cond_num;
    mean_ratio.set_averaging_method( QualityMetric::LINEAR );

    // ... and builds an objective function with it
    // LInfTemplate* obj_func = new LInfTemplate(mean_ratio);
    LPtoPTemplate obj_func( &mean_ratio, 2, err );
    if( err ) return 1;
    // creates the steepest descent optimization procedures
    SteepestDescent pass1( &obj_func );
    pass1.use_global_patch();
    // if (err) return 1;
    // pass1.set_maximum_iteration(6);

    QualityAssessor stop_qa = QualityAssessor( &mean_ratio );
    if( err ) return 1;
    stop_qa.add_quality_assessment( &cond_num );
    if( err ) return 1;

    //**************Set stopping criterion****************
    // StoppingCriterion sc1(&stop_qa,1.0,1.8);
    // StoppingCriterion sc2(StoppingCriterion::NUMBER_OF_PASSES,1);
    TerminationCriterion tc2;
    tc2.add_iteration_limit( 1 );
    // CompositeAndStoppingCriterion sc(&sc1,&sc2);
    pass1.set_inner_termination_criterion( &tc2 );

    // adds 1 pass of pass1 to mesh_set1
    //  queue1.add_preconditioner(pass1, err);
    //  if (err) return 1;
    queue1.add_quality_assessor( &stop_qa, err );
    queue1.set_master_quality_improver( &pass1, err );
    if( err ) return 1;
    queue1.add_quality_assessor( &stop_qa, err );
    if( err ) return 1;
    // adds 1 passes of pass2 to mesh_set1
    //  mesh_set1.add_quality_pass(pass2);

    mesh.write_vtk( "original_mesh.vtk", err );
    if( err ) return 1;

    // launches optimization on mesh_set1
    queue1.run_instructions( &mesh, err );
    if( err ) return 1;

    mesh.write_vtk( "smoothed_mesh.vtk", err );
    if( err ) return 1;

    return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines