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

#include <VertexMover.hpp>

Inheritance diagram for VertexMover:
Collaboration diagram for VertexMover:

Public Member Functions

virtual ~VertexMover ()
 
virtual double loop_over_mesh (MeshSet &ms, MsqError &err)
 Improves the quality of the MeshSet, calling some methods specified in a class derived from VertexMover. More...
 
virtual ~VertexMover ()
 
virtual double loop_over_mesh (MeshSet &ms, MsqError &err)
 This is the "run" function of PatchDataUser. It can do anything really. More...
 
- Public Member Functions inherited from QualityImprover
virtual ~QualityImprover ()
 
void set_name (msq_std::string name)
 provides a name to the QualityImprover (use it in constructor). More...
 
virtual msq_std::string get_name ()
 retrieves the QualityImprover name. A default name should be set in the constructor. More...
 
virtual AlgorithmType get_algorithm_type ()
 Return the algorithm type (to avoid RTTI use). More...
 
void set_inner_termination_criterion (TerminationCriterion *crit)
 Sets in the termination criterion for the concrete solver's optimization. More...
 
void set_outer_termination_criterion (TerminationCriterion *crit)
 Sets in the termination criterion for the outer loop over patches. More...
 
virtual ~QualityImprover ()
 
void set_name (msq_std::string name)
 provides a name to the QualityImprover (use it in constructor). More...
 
virtual msq_std::string get_name ()
 retrieves the QualityImprover name. A default name should be set in the constructor. More...
 
virtual AlgorithmType get_algorithm_type ()
 Return the algorithm type (to avoid RTTI use). More...
 
void set_inner_termination_criterion (TerminationCriterion *crit)
 Sets in the termination criterion for the concrete solver's optimization. More...
 
void set_outer_termination_criterion (TerminationCriterion *crit)
 Sets in the termination criterion for the outer loop over patches. More...
 
- Public Member Functions inherited from PatchDataUser
virtual ~PatchDataUser ()
 
virtual void set_patch_type (PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
 Sets the Patch Type. More...
 
PatchData::PatchType get_patch_type ()
 Returns the Patch Type. More...
 
int get_nb_layers (MsqError &err)
 Returns number of layers (if relevant for partition algorythm). More...
 
void add_culling_method (enum PatchData::culling_method cm)
 Sets on the culling method passed as argument. More...
 
void no_culling_method ()
 Sets off all culling methods. More...
 
void remove_culling_method (enum PatchData::culling_method cm)
 Sets off the culling method passed as argument. More...
 
long unsigned int get_culling_method_bits ()
 Returns the bitset containing culling methods flags. More...
 
void set_all_parameters (PatchDataParameters &params)
 
PatchDataParametersget_all_parameters ()
 Returns the PatchDataParameters object. More...
 
void set_global_patch (PatchData *pd, MsqError &err)
 Sets the Global Patch, so that it can be use by contiguoug PatchDataUser. More...
 
PatchDataget_global_patch ()
 Returns the Global Patch. More...
 
void no_global_patch ()
 Sets the Global Patch pointer to NULL. More...
 
virtual ~PatchDataUser ()
 
virtual void set_patch_type (PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
 Sets the Patch Type. More...
 
PatchData::PatchType get_patch_type ()
 Returns the Patch Type. More...
 
int get_nb_layers (MsqError &err)
 Returns number of layers (if relevant for partition algorythm). More...
 
void add_culling_method (enum PatchData::culling_method cm)
 Sets on the culling method passed as argument. More...
 
void no_culling_method ()
 Sets off all culling methods. More...
 
void remove_culling_method (enum PatchData::culling_method cm)
 Sets off the culling method passed as argument. More...
 
long unsigned int get_culling_method_bits ()
 Returns the bitset containing culling methods flags. More...
 
void set_all_parameters (PatchDataParameters &params)
 
PatchDataParametersget_all_parameters ()
 Returns the PatchDataParameters object. More...
 
void set_global_patch (PatchData *pd, MsqError &err)
 Sets the Global Patch, so that it can be use by contiguoug PatchDataUser. More...
 
PatchDataget_global_patch ()
 Returns the Global Patch. More...
 
void no_global_patch ()
 Sets the Global Patch pointer to NULL. More...
 

Protected Member Functions

 VertexMover ()
 
virtual void initialize (PatchData &pd, MsqError &err)=0
 
virtual void cleanup ()=0
 
virtual void optimize_vertex_positions (PatchData &pd, MsqError &err)=0
 
virtual void initialize_mesh_iteration (PatchData &pd, MsqError &err)=0
 
virtual void terminate_mesh_iteration (PatchData &, MsqError &err)=0
 
size_t check_feasible (PatchData &pd, MsqError &err)
 CHECK FEASIBLE IS NOT YET IMPLEMENTED. More...
 
 VertexMover ()
 
virtual void initialize (PatchData &pd, MsqError &err)=0
 
virtual void cleanup ()=0
 
virtual void optimize_vertex_positions (PatchData &pd, MsqError &err)=0
 
virtual void initialize_mesh_iteration (PatchData &pd, MsqError &err)=0
 
virtual void terminate_mesh_iteration (PatchData &, MsqError &err)=0
 
size_t check_feasible (PatchData &pd, MsqError &err)
 CHECK FEASIBLE IS NOT YET IMPLEMENTED. More...
 
- Protected Member Functions inherited from QualityImprover
 QualityImprover ()
 
const MeshSetget_mesh_set () const
 
MeshSetget_mesh_set ()
 
void set_mesh_set (MeshSet *ms)
 
TerminationCriterionget_outer_termination_criterion ()
 return the outer termination criterion pointer More...
 
TerminationCriterionget_inner_termination_criterion ()
 return the inner termination criterion pointer More...
 
 QualityImprover ()
 
const MeshSetget_mesh_set () const
 
MeshSetget_mesh_set ()
 
void set_mesh_set (MeshSet *ms)
 
TerminationCriterionget_outer_termination_criterion ()
 return the outer termination criterion pointer More...
 
TerminationCriterionget_inner_termination_criterion ()
 return the inner termination criterion pointer More...
 
- Protected Member Functions inherited from PatchDataUser
 PatchDataUser ()
 
 PatchDataUser ()
 

Protected Attributes

ObjectiveFunctionobjFunc
 

Additional Inherited Members

- Public Types inherited from PatchDataUser
enum  AlgorithmType {
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR,
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR
}
 
enum  AlgorithmType {
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR,
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR
}
 

Detailed Description

Base class for all Vertex Movers.

Definition at line 52 of file includeLinks/VertexMover.hpp.

Constructor & Destructor Documentation

VertexMover ( )
protected

Definition at line 45 of file QualityImprover/VertexMover/VertexMover.cpp.

References VertexMover::objFunc.

45  :
47 {
48  objFunc=NULL;
49 }
virtual ~VertexMover ( )
inlinevirtual

Definition at line 58 of file includeLinks/VertexMover.hpp.

58 { };
VertexMover ( )
protected
virtual ~VertexMover ( )
inlinevirtual

Definition at line 58 of file src/QualityImprover/VertexMover/VertexMover.hpp.

58 { };

Member Function Documentation

size_t check_feasible ( PatchData pd,
MsqError err 
)
inlineprotected

CHECK FEASIBLE IS NOT YET IMPLEMENTED.

Takes a PatchData object (by reference) and returns whether the patch is within the feasible region, 0, or outside the region, 1.

Definition at line 85 of file includeLinks/VertexMover.hpp.

References MsqMeshEntity::compute_weighted_jacobian(), QualityMetric::ELEMENT_VERTICES, PatchData::get_element_array(), MsqMeshEntity::get_sample_points(), i, and PatchData::num_elements().

86  {
87  MsqMeshEntity* elems=pd.get_element_array(err);
88  size_t num_elements=pd.num_elements();
89  msq_std::vector<Vector3D> sample_points;
90  Vector3D jacobian_vectors[3];
91  short num_jacobian_vectors;
92  size_t i =0;
93  for(i=0;i<num_elements;++i){
94  elems[i].get_sample_points(QualityMetric::ELEMENT_VERTICES,sample_points,err);
95  msq_std::vector<Vector3D>::iterator iter=sample_points.begin();
96  while(iter!=sample_points.end()){
97  elems[i].compute_weighted_jacobian(pd, (*iter),
98  jacobian_vectors,
99  num_jacobian_vectors, err);
100  if(num_jacobian_vectors==2){
101  //2-d not yet implemented
102  }
103  else if(num_jacobian_vectors==3){
104  if(jacobian_vectors[0]%(jacobian_vectors[1]*
105  jacobian_vectors[2])<=0.0){
106  return 1;
107  }
108  }
109  ++iter;
110  }
111  }
112 
113  return 0;
114  }
NVec< 3, double > Vector3D
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

size_t check_feasible ( PatchData pd,
MsqError err 
)
protected

CHECK FEASIBLE IS NOT YET IMPLEMENTED.

virtual double loop_over_mesh ( MeshSet ms,
MsqError err 
)
virtual

This is the "run" function of PatchDataUser. It can do anything really.

Implements QualityImprover.

double loop_over_mesh ( MeshSet ms,
MsqError err 
)
virtual

Improves the quality of the MeshSet, calling some methods specified in a class derived from VertexMover.

Parameters
constMeshSet &: this MeshSet is looped over. Only the mutable data members are changed (such as currentVertexInd).

Implements QualityImprover.

Definition at line 118 of file QualityImprover/VertexMover/VertexMover.cpp.

References TerminationCriterion::accumulate_outer(), TerminationCriterion::accumulate_patch(), VertexMover::cleanup(), TerminationCriterion::cleanup(), TerminationCriterion::cull_vertices(), PatchDataUser::get_global_patch(), QualityImprover::get_inner_termination_criterion(), MeshSet::get_next_patch(), QualityImprover::get_outer_termination_criterion(), PatchDataUser::get_patch_type(), PatchData::GLOBAL_PATCH, VertexMover::initialize(), VertexMover::initialize_mesh_iteration(), MsqError::INVALID_STATE, MSQ_CHKERR, MSQ_SETERR, VertexMover::objFunc, VertexMover::optimize_vertex_positions(), MeshSet::reset(), TerminationCriterion::reset_inner(), TerminationCriterion::reset_outer(), TerminationCriterion::reset_patch(), TerminationCriterion::set_debug_output_level(), QualityImprover::set_mesh_set(), TerminationCriterion::terminate(), VertexMover::terminate_mesh_iteration(), and PatchData::update_mesh().

Referenced by ShapeImprovementWrapper::run_instructions().

119 {
120  set_mesh_set(&ms);
121 
122  // Get the patch data to use for the first iteration
123  bool next_patch = true;
124  PatchData local_patch_data;
125  PatchData* patch_data=0;
126  if (get_global_patch() != 0) {
128  MSQ_SETERR(err)("PatchDataUser::globalPatch should be NULL.", MsqError::INVALID_STATE);
129  return 0;
130  }
131  patch_data = get_global_patch();
132  }
133  else {
134  patch_data = &local_patch_data;
135  }
136 
137  // Get termination criteria
138  TerminationCriterion* outer_crit=this->get_outer_termination_criterion();
139  TerminationCriterion* inner_crit=this->get_inner_termination_criterion();
140  if(outer_crit == 0){
141  MSQ_SETERR(err)("Termination Criterion pointer is Null", MsqError::INVALID_STATE);
142  return 0.;
143  }
144  if(inner_crit == 0){
145  MSQ_SETERR(err)("Termination Criterion pointer for inner loop is Null", MsqError::INVALID_STATE);
146  return 0.;
147  }
148 
149  // If using a local patch, suppress output of inner termination criterion
151  inner_crit->set_debug_output_level(3);
152  }
153 
154  // Initialize outer loop
155 
156  this->initialize(*patch_data, err);
157  if (MSQ_CHKERR(err)) goto ERROR;
158 
159  outer_crit->reset_outer(ms, objFunc, err);
160  if (MSQ_CHKERR(err)) goto ERROR;
161 
162  // Loop until outer termination criterion is met
163  while (!outer_crit->terminate())
164  {
165  if (get_global_patch() == 0)
166  {
167  next_patch = ms.get_next_patch( *patch_data, this, err );
168  if (MSQ_CHKERR(err)) goto ERROR;
169  }
170 
171  if (!next_patch) // all vertices culled
172  break;
173 
174  // Loop over each patch
175  do
176  {
177  // Initialize for inner iteration
178 
179  this->initialize_mesh_iteration(*patch_data, err);
180  if (MSQ_CHKERR(err)) goto ERROR;
181 
182  outer_crit->reset_patch( *patch_data, err );
183  if (MSQ_CHKERR(err)) goto ERROR;
184 
185  inner_crit->reset_inner( *patch_data, objFunc, err );
186  if (MSQ_CHKERR(err)) goto ERROR;
187 
188  inner_crit->reset_patch( *patch_data, err );
189  if (MSQ_CHKERR(err)) goto ERROR;
190 
191  // Don't even call optimizer if inner termination
192  // criterion has already been met.
193  if (!inner_crit->terminate())
194  {
195  // Call optimizer - should loop on inner_crit->terminate()
196  this->optimize_vertex_positions( *patch_data, err );
197  if (MSQ_CHKERR(err)) goto ERROR;
198 
199  // Update for changes during inner iteration
200  // (during optimizer loop)
201 
202  outer_crit->accumulate_patch( *patch_data, err );
203  if (MSQ_CHKERR(err)) goto ERROR;
204 
205  inner_crit->cull_vertices( *patch_data, objFunc, err );
206  if (MSQ_CHKERR(err)) goto ERROR;
207 
208  patch_data->update_mesh( err );
209  if (MSQ_CHKERR(err)) goto ERROR;
210  }
211 
212  // If a global patch, then we're done with the inner loop.
213  next_patch = false;
215  {
216  next_patch = ms.get_next_patch( *patch_data, this, err );
217  if (MSQ_CHKERR(err)) goto ERROR;
218  }
219 
220  } while (next_patch);
221 
222  this->terminate_mesh_iteration(*patch_data, err);
223  if (MSQ_CHKERR(err)) goto ERROR;
224 
225  if (get_global_patch() == 0)
226  {
227  ms.reset(err);
228  if (MSQ_CHKERR(err)) goto ERROR;
229  }
230 
231  outer_crit->accumulate_outer( ms, err );
232  if (MSQ_CHKERR(err)) goto ERROR;
233  }
234 
235 
236 ERROR:
237  //call the criteria's cleanup funtions.
238  outer_crit->cleanup(ms,err);
239  inner_crit->cleanup(ms,err);
240  //call the optimization cleanup function.
241  this->cleanup();
242 
243  return 0.;
244 }
virtual void terminate_mesh_iteration(PatchData &, MsqError &err)=0
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
PatchData::PatchType get_patch_type()
Returns the Patch Type.
virtual void initialize(PatchData &pd, MsqError &err)=0
TerminationCriterion * get_inner_termination_criterion()
return the inner termination criterion pointer
virtual void cleanup()=0
TerminationCriterion * get_outer_termination_criterion()
return the outer termination criterion pointer
PatchData * get_global_patch()
Returns the Global Patch.
virtual void optimize_vertex_positions(PatchData &pd, MsqError &err)=0
object is in an invalid state
virtual void initialize_mesh_iteration(PatchData &pd, MsqError &err)=0

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation


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