Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShapeImprovementWrapper Class Reference

Wrapper which performs a Feasible Newton solve using an $\ell_2^2 $ objective function template with inverse mean ratio. More...

#include <ShapeImprovementWrapper.hpp>

Inheritance diagram for ShapeImprovementWrapper:
Collaboration diagram for ShapeImprovementWrapper:

Public Member Functions

 ShapeImprovementWrapper (MsqError &err, double cpu_time=0.0, double grad_norm=1.e-6)
 
virtual ~ShapeImprovementWrapper ()
 Destructor must delete the objects inserted in the queue. More...
 
virtual void run_instructions (MeshSet &ms, MsqError &err)
 run_instructions runs the wrapper on the given MeshSet. More...
 
 ShapeImprovementWrapper (MsqError &err, double cpu_time=0.0, double grad_norm=1.e-6)
 
virtual ~ShapeImprovementWrapper ()
 Destructor must delete the objects inserted in the queue. More...
 
virtual void run_instructions (MeshSet &ms, MsqError &err)
 run_instructions runs the wrapper on the given MeshSet. More...
 
- Public Member Functions inherited from InstructionQueue
 InstructionQueue ()
 
virtual ~InstructionQueue ()
 
void add_target_calculator (TargetCalculator *tc, MsqError &err)
 
void add_preconditioner (QualityImprover *instr, MsqError &err)
 adds a QualityImprover at the end of the instruction list More...
 
void remove_preconditioner (size_t index, MsqError &err)
 removes a QualityImprover* from the instruction queue More...
 
void insert_preconditioner (QualityImprover *instr, size_t index, MsqError &err)
 inserts a QualityImprover* into the instruction queue. More...
 
void add_quality_assessor (QualityAssessor *instr, MsqError &err)
 adds a QualityAssessor to the instruction queue. More...
 
void remove_quality_assessor (size_t index, MsqError &err)
 removes a QualityAssessor* from the instruction queue More...
 
void insert_quality_assessor (QualityAssessor *instr, size_t index, MsqError &err)
 inserts a QualityAssessor* into the instruction queue. More...
 
void set_master_quality_improver (QualityImprover *instr, MsqError &err)
 
void disable_automatic_quality_assessment ()
 
void enable_automatic_quality_assessment ()
 
void disable_automatic_midnode_adjustment ()
 
void enable_automatic_midnode_adjustment ()
 
void clear ()
 
void trap_floating_point_exception (bool enable)
 Generate SIGFPE whenever a floating point exception occurs. More...
 
bool trap_floating_point_exception () const
 
 InstructionQueue ()
 
virtual ~InstructionQueue ()
 
void add_target_calculator (TargetCalculator *tc, MsqError &err)
 
void add_preconditioner (QualityImprover *instr, MsqError &err)
 
void remove_preconditioner (size_t index, MsqError &err)
 
void insert_preconditioner (QualityImprover *instr, size_t index, MsqError &err)
 
void add_quality_assessor (QualityAssessor *instr, MsqError &err)
 
void remove_quality_assessor (size_t index, MsqError &err)
 
void insert_quality_assessor (QualityAssessor *instr, size_t index, MsqError &err)
 
void set_master_quality_improver (QualityImprover *instr, MsqError &err)
 
void disable_automatic_quality_assessment ()
 
void enable_automatic_quality_assessment ()
 
void disable_automatic_midnode_adjustment ()
 
void enable_automatic_midnode_adjustment ()
 
void clear ()
 
void trap_floating_point_exception (bool enable)
 Generate SIGFPE whenever a floating point exception occurs. More...
 
bool trap_floating_point_exception () const
 

Private Attributes

ShapeQualityMetricinverseMeanRatio
 
LPtoPTemplateobjFunc
 
FeasibleNewtonfeasNewt
 
QualityAssessormQA
 
TerminationCriteriontermOuter
 
TerminationCriteriontermInner
 
bool timerNeeded
 
double maxTime
 
double untBeta
 
double successiveEps
 

Detailed Description

Wrapper which performs a Feasible Newton solve using an $\ell_2^2 $ objective function template with inverse mean ratio.

Definition at line 68 of file includeLinks/ShapeImprovementWrapper.hpp.

Constructor & Destructor Documentation

ShapeImprovementWrapper ( MsqError err,
double  cpu_time = 0.0,
double  grad_norm = 1.e-6 
)

The consturctor allows for two values. The first is a time bound (in seconds) used as a termination criterion. If this value is non-positive, no time bound will be set. By default, the value is set to zero and no time bound is used. The second value is the tolerance for the gradient norm termination criteria. The default value is 1.e-6.

Definition at line 51 of file Control/Wrappers/ShapeImprovementWrapper.cpp.

References TerminationCriterion::add_criterion_type_with_int(), PatchDataUser::add_culling_method(), ObjectiveFunction::ANALYTICAL_GRADIENT, QualityMetric::ANALYTICAL_GRADIENT, QualityMetric::ANALYTICAL_HESSIAN, QualityAssessor::disable_printing_results(), ShapeImprovementWrapper::feasNewt, PatchData::GLOBAL_PATCH, ShapeImprovementWrapper::inverseMeanRatio, QualityMetric::LINEAR, QualityAssessor::MAXIMUM, ShapeImprovementWrapper::mQA, MSQ_ERRRTN, PatchData::NO_BOUNDARY_VTX, TerminationCriterion::NUMBER_OF_ITERATES, ShapeImprovementWrapper::objFunc, QualityMetric::set_averaging_method(), ObjectiveFunction::set_gradient_type(), QualityMetric::set_gradient_type(), QualityMetric::set_hessian_type(), QualityImprover::set_inner_termination_criterion(), QualityImprover::set_outer_termination_criterion(), PatchDataUser::set_patch_type(), ShapeImprovementWrapper::successiveEps, ShapeImprovementWrapper::termInner, ShapeImprovementWrapper::termOuter, and ShapeImprovementWrapper::untBeta.

54  : inverseMeanRatio(0),
55  objFunc(0),
56  feasNewt(0),
57  mQA(0),
58  termOuter(0),
59  termInner(0)
60 {
61 
62  //arbitrarily chosen variables
63  untBeta=1.e-8;
64  successiveEps=1.e-4;
65 
66  inverseMeanRatio = new IdealWeightInverseMeanRatio(err); MSQ_ERRRTN(err);
70  // creates the l_2 squared objective function
71  objFunc = new LPtoPTemplate(inverseMeanRatio, 2, err); MSQ_ERRRTN(err);
73  //creates a FeasibleNewtone improver
74  feasNewt = new FeasibleNewton(objFunc);
76 
77  mQA = new QualityAssessor(inverseMeanRatio,QualityAssessor::MAXIMUM, err); MSQ_ERRRTN(err);
79  //**************Set stopping criterion*e***************
80  termInner = new TerminationCriterion();
81  termOuter = new TerminationCriterion();
82  //termInner->add_criterion_type_with_double(TerminationCriterion::GRADIENT_L2_NORM_ABSOLUTE,grad_norm,err); MSQ_ERRRTN(err);
83  //termInner->add_criterion_type_with_double(TerminationCriterion::SUCCESSIVE_IMPROVEMENTS_RELATIVE,successiveEps,err); MSQ_ERRRTN(err);
89 
90 }
void set_averaging_method(AveragingMethod method, MsqError &err)
void set_gradient_type(GRADIENT_TYPE grad)
Set gradType to either NUMERICAL_GRADIENT or ANALYTICAL_GRADIENT.
void add_culling_method(enum PatchData::culling_method cm)
Sets on the culling method passed as argument.
virtual void set_patch_type(PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
Sets the Patch Type.
every differentiable function should have an analytical gradient implemented.
void set_hessian_type(HESSIAN_TYPE ht)
Sets hessianType for this metric.
Terminates when the number of iterations exceeds a given integer.
void set_gradient_type(GRADIENT_TYPE grad)
Sets gradType for this metric.
void set_outer_termination_criterion(TerminationCriterion *crit)
Sets in the termination criterion for the outer loop over patches.
void add_criterion_type_with_int(TCType tc_type, int bound, MsqError &err)
Sets the criterion by specifing the TCType and the integer value.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
void set_inner_termination_criterion(TerminationCriterion *crit)
Sets in the termination criterion for the concrete solver&#39;s optimization.
void disable_printing_results()
Do not print results of assessment.

Here is the call graph for this function:

ShapeImprovementWrapper ( MsqError err,
double  cpu_time = 0.0,
double  grad_norm = 1.e-6 
)
virtual ~ShapeImprovementWrapper ( )
virtual

Destructor must delete the objects inserted in the queue.

Member Function Documentation

void run_instructions ( MeshSet ms,
MsqError err 
)
virtual

run_instructions runs the wrapper on the given MeshSet.

Run instructions first calls the global untangler. If the resulting mesh is tangled after that pre-conditioning step, The mesh is iteratively smoothed with a local and then global untangler until the mesh is untangled or until a certain time constraint has been exceeded. If the mesh was successfully untangled and there is still time remaining, an inverse mean ratio shape improvement is then performed.

Reimplemented from InstructionQueue.

Definition at line 111 of file Control/Wrappers/ShapeImprovementWrapper.cpp.

References ShapeImprovementWrapper::feasNewt, VertexMover::loop_over_mesh(), QualityAssessor::loop_over_mesh(), ShapeImprovementWrapper::mQA, and MSQ_ERRRTN.

Referenced by Rocmop::smooth_mesquite().

112 {
113 
114  mQA->loop_over_mesh(ms, err);
115  MSQ_ERRRTN(err);
116 
117  feasNewt->loop_over_mesh(ms, err);
118  MSQ_ERRRTN(err);
119 
120  mQA->loop_over_mesh(ms, err);
121  MSQ_ERRRTN(err);
122 
123 }
virtual double loop_over_mesh(MeshSet &ms, MsqError &err)
Does one sweep over the mesh and assess the quality with the metrics previously added.
virtual double loop_over_mesh(MeshSet &ms, MsqError &err)
Improves the quality of the MeshSet, calling some methods specified in a class derived from VertexMov...
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void run_instructions ( MeshSet ms,
MsqError err 
)
virtual

run_instructions runs the wrapper on the given MeshSet.

Reimplemented from InstructionQueue.

Member Data Documentation

double maxTime
private

Definition at line 93 of file includeLinks/ShapeImprovementWrapper.hpp.

double successiveEps
private
bool timerNeeded
private

Definition at line 92 of file includeLinks/ShapeImprovementWrapper.hpp.

double untBeta
private

The documentation for this class was generated from the following files: