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

#include <ViscousCFDTetShapeWrapper.hpp>

+ Inheritance diagram for MBMesquite::ViscousCFDTetShapeWrapper:
+ Collaboration diagram for MBMesquite::ViscousCFDTetShapeWrapper:

Public Member Functions

 ViscousCFDTetShapeWrapper (double max_vertex_movement, double a=0.4395, double d_prime=135, int max_iterations=50, int parallel_iterations=10)

Private Member Functions

void run_wrapper (MeshDomainAssoc *mesh_and_domain, ParallelMesh *pmesh, Settings *settings, QualityAssessor *qa, MsqError &err)

Private Attributes

double dCutoff
double aVal
int iterationLimit
int parallelIterations
double maxVtxMovement

Detailed Description

Definition at line 43 of file ViscousCFDTetShapeWrapper.hpp.

Constructor & Destructor Documentation

MBMesquite::ViscousCFDTetShapeWrapper::ViscousCFDTetShapeWrapper ( double  max_vertex_movement,
double  a = 0.4395,
double  d_prime = 135,
int  max_iterations = 50,
int  parallel_iterations = 10 
) [inline]
max_vertex_movementTermination optimization if no vertex is moved by more than this distance in the previous solver step.
aCoefficient for target metric weight
d_primeDihedral handle cut-off for target metric weight
max_iterationsTermination optimizaiton after this many solver steps.

Definition at line 67 of file ViscousCFDTetShapeWrapper.hpp.

        : dCutoff( d_prime ), aVal( a ), iterationLimit( max_iterations ), parallelIterations( parallel_iterations ),
          maxVtxMovement( max_vertex_movement )

Member Function Documentation

void MBMesquite::ViscousCFDTetShapeWrapper::run_wrapper ( MeshDomainAssoc mesh_and_domain,
ParallelMesh pmesh,
Settings settings,
QualityAssessor quality_assessor,
MsqError err 
) [private, virtual]

Function that each wrapper must implement

Implements MBMesquite::Wrapper.

Definition at line 59 of file ViscousCFDTetShapeWrapper.cpp.

References MBMesquite::TerminationCriterion::add_absolute_vertex_movement(), MBMesquite::TerminationCriterion::add_iteration_limit(), MBMesquite::QualityAssessor::add_quality_assessment(), MBMesquite::InstructionQueue::add_quality_assessor(), aVal, dCutoff, MBMesquite::QualityAssessor::disable_printing_results(), MBMesquite::QualityAssessor::Assessor::get_invalid_element_count(), MBMesquite::MeshDomainAssoc::get_mesh(), MBMesquite::QualityAssessor::get_results(), iterationLimit, maxVtxMovement, mesh, MSQ_CHKERR, MSQ_ERRRTN, parallelIterations, MBMesquite::InstructionQueue::remove_quality_assessor(), MBMesquite::InstructionQueue::run_common(), MBMesquite::QualityImprover::set_inner_termination_criterion(), MBMesquite::InstructionQueue::set_master_quality_improver(), and MBMesquite::QualityImprover::set_outer_termination_criterion().

    InstructionQueue q;

    // Set up barrier metric to see if mesh contains inverted elements
    TShapeB1 mu_b;
    IdealShapeTarget w_ideal;
    TQualityMetric barrier( &w_ideal, &mu_b );

    // Check for inverted elements in the mesh
    QualityAssessor inv_check( &barrier );
    q.add_quality_assessor( &inv_check, err );MSQ_ERRRTN( err );
    q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_ERRRTN( err );
    q.remove_quality_assessor( 0, err );MSQ_ERRRTN( err );
    const QualityAssessor::Assessor* inv_b = inv_check.get_results( &barrier );
    const bool use_barrier                 = ( 0 == inv_b->get_invalid_element_count() );

    // Create remaining metric instances
    TShapeNB1 mu;
    TShapeSizeOrientNB1 mu_o;
    TShapeSizeOrientB1 mu_ob;

    // Select which target metrics to use
    TMetric *mu_p, *mu_op;
    if( use_barrier )
        mu_p  = &mu_b;
        mu_op = &mu_ob;
        mu_p  = &mu;
        mu_op = &mu_o;

    // Set up target and weight calculators
    Mesh* mesh = mesh_and_domain->get_mesh();
    TagVertexMesh init_mesh( err, pmesh ? (Mesh*)pmesh : mesh );MSQ_ERRRTN( err );
    ReferenceMesh ref_mesh( &init_mesh );
    RefMeshTargetCalculator w_init( &ref_mesh );
    TetDihedralWeight c_dihedral( &ref_mesh, dCutoff, aVal );
    RemainingWeight c_remaining( &c_dihedral );

    // Create objective function
    TQualityMetric metric1( &w_ideal, &c_dihedral, mu_p );
    TQualityMetric metric2( &w_init, &c_remaining, mu_op );
    AddQualityMetric of_metric( &metric1, &metric2, err );MSQ_ERRRTN( err );
    PMeanPTemplate obj_func( 1.0, &of_metric );

    // Create optimizer
    TrustRegion solver( &obj_func );
    TerminationCriterion term, ptc;
    term.add_iteration_limit( iterationLimit );
    term.add_absolute_vertex_movement( maxVtxMovement );
    ptc.add_iteration_limit( pmesh ? parallelIterations : 1 );
    solver.set_inner_termination_criterion( &term );
    solver.set_outer_termination_criterion( &ptc );

    // Create instruction queue
    qa->add_quality_assessment( &metric1 );
    qa->add_quality_assessment( &metric2 );
    qa->add_quality_assessment( &of_metric );
    q.add_quality_assessor( qa, err );MSQ_ERRRTN( err );
    q.set_master_quality_improver( &solver, err );MSQ_ERRRTN( err );
    q.add_quality_assessor( qa, err );MSQ_ERRRTN( err );

    // Optimize mesh
    q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_CHKERR( err );

Member Data Documentation

Definition at line 46 of file ViscousCFDTetShapeWrapper.hpp.

Referenced by run_wrapper().

Definition at line 46 of file ViscousCFDTetShapeWrapper.hpp.

Referenced by run_wrapper().

Definition at line 49 of file ViscousCFDTetShapeWrapper.hpp.

Referenced by run_wrapper().

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