Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/VertexMover.hpp
Go to the documentation of this file.
1 /* *****************************************************************
2  MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4  Copyright 2004 Sandia Corporation and Argonne National
5  Laboratory. Under the terms of Contract DE-AC04-94AL85000
6  with Sandia Corporation, the U.S. Government retains certain
7  rights in this software.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  (lgpl.txt) along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 
23  diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
24  pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
25 
26  ***************************************************************** */
37 #ifndef Mesquite_VertexMover_hpp
38 #define Mesquite_VertexMover_hpp
39 
40 
41 #include "Mesquite.hpp"
42 #include "QualityImprover.hpp"
43 #include "PatchData.hpp"
44 #include "ObjectiveFunction.hpp"
45 
46 namespace Mesquite
47 {
48 
52  class VertexMover : public QualityImprover
53  {
54  protected:
55  VertexMover();
56  public:
57  // virtual destructor ensures use of polymorphism during destruction
58  virtual ~VertexMover() { };
59 
60  virtual double loop_over_mesh(MeshSet &ms, MsqError &err);
61 
62  protected:
63 
64  virtual void initialize(PatchData &pd, MsqError &err) = 0;
65  virtual void cleanup() = 0;
66  virtual void optimize_vertex_positions(PatchData &pd,
67  MsqError &err) = 0; // modifies the PatchData object
68 
69  virtual void initialize_mesh_iteration(PatchData &pd,
70  MsqError &err) = 0;
71  virtual void terminate_mesh_iteration(PatchData &,
72  MsqError &err) = 0;
73 
75  size_t check_feasible(PatchData &pd, MsqError &err);
76 
78  };
79 
80 
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  }
115 
116 
117 } // namespace
118 #endif // Mesquite_VertexMover_hpp
virtual void terminate_mesh_iteration(PatchData &, MsqError &err)=0
Used to hold the error state and return it to the application.
size_t check_feasible(PatchData &pd, MsqError &err)
CHECK FEASIBLE IS NOT YET IMPLEMENTED.
Base class for all quality improvers. Mote that the PatchData settings are inherited from the PathDat...
MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh...
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
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...
size_t num_elements() const
number of elements in the Patch.
blockLoc i
Definition: read.cpp:79
void compute_weighted_jacobian(PatchData &pd, Vector3D &sample_point, Vector3D jacobian_vectors[], short &num_jacobian_vectors, MsqError &err)
virtual void initialize(PatchData &pd, MsqError &err)=0
virtual void cleanup()=0
virtual void optimize_vertex_positions(PatchData &pd, MsqError &err)=0
const MsqMeshEntity * get_element_array(MsqError &err) const
Returns a pointer to the start of the element array.
void get_sample_points(QualityMetric::ElementEvaluationMode mode, msq_std::vector< Vector3D > &coords, MsqError &err)
Returns a list of sample points given an evaluationmode.
Base class for concrete Objective Functions ObjectiveFunction contains a pointer to a QualityMetric...
The MeshSet class stores one or more Mesquite::Mesh pointers and manages access to the mesh informati...
virtual void initialize_mesh_iteration(PatchData &pd, MsqError &err)=0