MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Wrapper that implements several TMP-based untanglers. More...
#include <UntangleWrapper.hpp>
Public Types | |
enum | UntangleMetric { BETA, SIZE, SHAPESIZE } |
Which quality metric to use. More... | |
Public Member Functions | |
MESQUITE_EXPORT void | set_untangle_metric (UntangleMetric metric) |
Specify which untangle metric to use. | |
MESQUITE_EXPORT void | set_metric_constant (double value) |
Specify constant value for untangle metric. | |
MESQUITE_EXPORT void | set_cpu_time_limit (double seconds) |
Specify timeout after which untangler will exit. | |
MESQUITE_EXPORT void | set_outer_iteration_limit (int maxIt) |
Specify max number of outer iterations after which untangler will exit. | |
MESQUITE_EXPORT void | set_vertex_movement_limit_factor (double f) |
Specify factor by which to minimum distance a vertex must move in an iteration to avoid termination of the untangler. | |
MESQUITE_EXPORT | UntangleWrapper () |
MESQUITE_EXPORT | UntangleWrapper (UntangleMetric m) |
MESQUITE_EXPORT | ~UntangleWrapper () |
bool | is_culling_enabled () const |
Check if vertex culling will be used. | |
void | enable_culling (bool yesno) |
Enable vertex culling. | |
bool | is_jacobi_optimization () const |
Check if a Jacobi optimization strategy will be used. | |
bool | is_gauss_optimization () const |
Check if a Gauss optimization strategy will be used. | |
void | do_jacobi_optimization () |
Use a Jacobi optimization strategy. | |
void | do_gauss_optimization () |
Use a Gauss optimization strategy. | |
Protected Member Functions | |
MESQUITE_EXPORT void | run_wrapper (MeshDomainAssoc *mesh_and_domain, ParallelMesh *pmesh, Settings *settings, QualityAssessor *qa, MsqError &err) |
Private Attributes | |
UntangleMetric | qualityMetric |
double | maxTime |
double | movementFactor |
double | metricConstant |
int | maxIterations |
bool | doCulling |
bool | doJacobi |
Wrapper that implements several TMP-based untanglers.
Definition at line 42 of file UntangleWrapper.hpp.
Which quality metric to use.
BETA |
Use TMP UntangleBeta metric. |
SIZE |
Use UntangleMu(TargetSize}. |
SHAPESIZE |
Use UntangleMu(TargetShapeSize}. |
Definition at line 47 of file UntangleWrapper.hpp.
Definition at line 67 of file UntangleWrapper.cpp.
: qualityMetric( SIZE ), maxTime( -1 ), movementFactor( DEFAULT_MOVEMENT_FACTOR ), metricConstant( -1 ), maxIterations( -1 ), doCulling( CULLING_DEFAULT ), doJacobi( JACOBI_DEFAULT ) { }
Definition at line 73 of file UntangleWrapper.cpp.
: qualityMetric( m ), maxTime( -1 ), movementFactor( DEFAULT_MOVEMENT_FACTOR ), metricConstant( -1 ), maxIterations( -1 ), doCulling( CULLING_DEFAULT ), doJacobi( JACOBI_DEFAULT ) { }
Definition at line 79 of file UntangleWrapper.cpp.
{}
void MBMesquite::UntangleWrapper::do_gauss_optimization | ( | ) | [inline] |
Use a Gauss optimization strategy.
Definition at line 115 of file UntangleWrapper.hpp.
References doJacobi.
{ doJacobi = false; }
void MBMesquite::UntangleWrapper::do_jacobi_optimization | ( | ) | [inline] |
Use a Jacobi optimization strategy.
Definition at line 109 of file UntangleWrapper.hpp.
References doJacobi.
{ doJacobi = true; }
void MBMesquite::UntangleWrapper::enable_culling | ( | bool | yesno | ) | [inline] |
Enable vertex culling.
Definition at line 91 of file UntangleWrapper.hpp.
References doCulling.
{ doCulling = yesno; }
bool MBMesquite::UntangleWrapper::is_culling_enabled | ( | ) | const [inline] |
Check if vertex culling will be used.
Definition at line 85 of file UntangleWrapper.hpp.
References doCulling.
{ return doCulling; }
bool MBMesquite::UntangleWrapper::is_gauss_optimization | ( | ) | const [inline] |
Check if a Gauss optimization strategy will be used.
Definition at line 103 of file UntangleWrapper.hpp.
References doJacobi.
{ return !doJacobi; }
bool MBMesquite::UntangleWrapper::is_jacobi_optimization | ( | ) | const [inline] |
Check if a Jacobi optimization strategy will be used.
Definition at line 97 of file UntangleWrapper.hpp.
References doJacobi.
{ return doJacobi; }
void MBMesquite::UntangleWrapper::run_wrapper | ( | MeshDomainAssoc * | mesh_and_domain, |
ParallelMesh * | pmesh, | ||
Settings * | settings, | ||
QualityAssessor * | quality_assessor, | ||
MsqError & | err | ||
) | [protected, virtual] |
Function that each wrapper must implement
Implements MBMesquite::Wrapper.
Definition at line 106 of file UntangleWrapper.cpp.
References MBMesquite::QualityAssessor::add_quality_assessment(), MBMesquite::InstructionQueue::add_quality_assessor(), MBMesquite::SimpleStats::average(), BETA, beta, MBMesquite::VertexMover::do_gauss_optimization(), MBMesquite::VertexMover::do_jacobi_optimization(), doCulling, doJacobi, eps, MBMesquite::MeshDomainAssoc::get_mesh(), MBMesquite::Instruction::initialize_vertex_byte(), MBMesquite::inner(), maxIterations, maxTime, mesh, metricConstant, movementFactor, MSQ_ERRRTN, NUM_INNER_ITERATIONS, MBMesquite::outer(), qualityMetric, MBMesquite::InstructionQueue::run_common(), MBMesquite::QualityImprover::set_inner_termination_criterion(), MBMesquite::InstructionQueue::set_master_quality_improver(), MBMesquite::QualityImprover::set_outer_termination_criterion(), SIZE, MBMesquite::SimpleStats::standard_deviation(), MBMesquite::TerminationCriterion::TYPE_INNER, MBMesquite::TerminationCriterion::TYPE_OUTER, and MBMesquite::PatchSetUser::use_element_on_vertex_patch().
{ Instruction::initialize_vertex_byte( mesh_and_domain, settings, err );MSQ_ERRRTN( err ); Mesh* mesh = mesh_and_domain->get_mesh(); // get some global mesh properties SimpleStats edge_len, lambda; std::unique_ptr< MeshUtil > tool( new MeshUtil( mesh, settings ) ); tool->edge_length_distribution( edge_len, err );MSQ_ERRRTN( err ); tool->lambda_distribution( lambda, err );MSQ_ERRRTN( err ); tool.reset( 0 ); // get target metrics from user perferences TSizeNB1 mu_size; TShapeSize2DNB1 mu_shape_2d; TShapeSize3DNB1 mu_shape_3d; TMixed mu_shape( &mu_shape_2d, &mu_shape_3d ); std::unique_ptr< TMetric > mu; if( qualityMetric == BETA ) { double beta = metricConstant; if( beta < 0 ) beta = ( lambda.average() * lambda.average() ) / 20; // std::cout << "beta= " << beta << std::endl; mu.reset( new TUntangleBeta( beta ) ); } else { TMetric* sub = 0; if( qualityMetric == SIZE ) sub = &mu_size; else sub = &mu_shape; if( metricConstant >= 0 ) mu.reset( new TUntangleMu( sub, metricConstant ) ); else mu.reset( new TUntangleMu( sub ) ); } // define objective function IdealShapeTarget base_target; LambdaConstant target( lambda.average(), &base_target ); TQualityMetric metric_0( &target, mu.get() ); ElementPMeanP metric( 1.0, &metric_0 ); PMeanPTemplate objfunc( 1.0, &metric ); // define termination criterion double eps = movementFactor * ( edge_len.average() - edge_len.standard_deviation() ); TerminationCriterion inner( "<type:untangle_inner>", TerminationCriterion::TYPE_INNER ), outer( "<type:untangle_outer>", TerminationCriterion::TYPE_OUTER ); outer.add_untangled_mesh(); if( doCulling ) inner.cull_on_absolute_vertex_movement( eps ); else outer.add_absolute_vertex_movement( eps ); if( maxTime > 0.0 ) outer.add_cpu_time( maxTime ); inner.add_iteration_limit( NUM_INNER_ITERATIONS ); if( maxIterations > 0 ) outer.add_iteration_limit( maxIterations ); // construct solver SteepestDescent solver( &objfunc ); solver.use_element_on_vertex_patch(); solver.set_inner_termination_criterion( &inner ); solver.set_outer_termination_criterion( &outer ); if( doJacobi ) solver.do_jacobi_optimization(); else solver.do_gauss_optimization(); // Run qa->add_quality_assessment( &metric ); InstructionQueue q; 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 ); q.run_common( mesh_and_domain, pmesh, settings, err );MSQ_ERRRTN( err ); }
void MBMesquite::UntangleWrapper::set_cpu_time_limit | ( | double | seconds | ) |
Specify timeout after which untangler will exit.
Definition at line 91 of file UntangleWrapper.cpp.
References maxTime.
{ maxTime = seconds; }
void MBMesquite::UntangleWrapper::set_metric_constant | ( | double | value | ) |
Specify constant value for untangle metric.
Definition at line 86 of file UntangleWrapper.cpp.
References metricConstant, and value().
Referenced by uwt().
{ metricConstant = value; }
void MBMesquite::UntangleWrapper::set_outer_iteration_limit | ( | int | maxIt | ) |
Specify max number of outer iterations after which untangler will exit.
Definition at line 96 of file UntangleWrapper.cpp.
References maxIterations.
{ maxIterations = maxIt; }
void MBMesquite::UntangleWrapper::set_untangle_metric | ( | UntangleMetric | metric | ) |
Specify which untangle metric to use.
Definition at line 81 of file UntangleWrapper.cpp.
References qualityMetric.
{ qualityMetric = metric; }
void MBMesquite::UntangleWrapper::set_vertex_movement_limit_factor | ( | double | f | ) |
Specify factor by which to minimum distance a vertex must move in an iteration to avoid termination of the untangler.
Definition at line 101 of file UntangleWrapper.cpp.
References movementFactor.
Referenced by main(), and uwt().
{ movementFactor = f; }
bool MBMesquite::UntangleWrapper::doCulling [private] |
Definition at line 132 of file UntangleWrapper.hpp.
Referenced by enable_culling(), is_culling_enabled(), and run_wrapper().
bool MBMesquite::UntangleWrapper::doJacobi [private] |
Definition at line 132 of file UntangleWrapper.hpp.
Referenced by do_gauss_optimization(), do_jacobi_optimization(), is_gauss_optimization(), is_jacobi_optimization(), and run_wrapper().
int MBMesquite::UntangleWrapper::maxIterations [private] |
Definition at line 131 of file UntangleWrapper.hpp.
Referenced by run_wrapper(), and set_outer_iteration_limit().
double MBMesquite::UntangleWrapper::maxTime [private] |
Definition at line 130 of file UntangleWrapper.hpp.
Referenced by run_wrapper(), and set_cpu_time_limit().
double MBMesquite::UntangleWrapper::metricConstant [private] |
Definition at line 130 of file UntangleWrapper.hpp.
Referenced by run_wrapper(), and set_metric_constant().
double MBMesquite::UntangleWrapper::movementFactor [private] |
Definition at line 130 of file UntangleWrapper.hpp.
Referenced by run_wrapper(), and set_vertex_movement_limit_factor().
Definition at line 129 of file UntangleWrapper.hpp.
Referenced by run_wrapper(), and set_untangle_metric().