Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/MsqMeshEntity.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  ***************************************************************** */
27 
36 #ifndef MSQMESHENTITY_HPP
37 #define MSQMESHENTITY_HPP
38 
39 #include "Mesquite.hpp"
40 #include "QualityMetric.hpp"
41 #include "TopologyInfo.hpp"
42 
43 #ifdef MSQ_USE_OLD_STD_HEADERS
44 # include <vector.h>
45 #else
46 # include <vector>
47 #endif
48 
49 #ifdef MSQ_USE_OLD_C_HEADERS
50 # include <string.h>
51 # include <assert.h>
52 #else
53 # include <cstring>
54 # include <cassert>
55 #endif
56 
57 
58 namespace Mesquite
59 {
60  class PatchData;
61 
70  {
71  public:
72 
75  {}
76 
79  { return mType; }
80 
83  inline msq_stdc::size_t vertex_count() const;
86  inline msq_stdc::size_t node_count() const
87  { return numVertexIndices; }
88 
90  void get_vertex_indices(msq_std::vector<msq_stdc::size_t> &vertex_list) const;
91  void append_vertex_indices(msq_std::vector<msq_stdc::size_t> &vertex_list) const;
93  void get_node_indices(msq_std::vector<msq_stdc::size_t> &vertex_list) const;
94  void append_node_indices(msq_std::vector<msq_stdc::size_t> &vertex_list) const;
97  inline const msq_stdc::size_t *get_vertex_index_array() const;
98  inline msq_stdc::size_t *get_vertex_index_array();
99 
102  { mType = type; }
103 
111  void set_connectivity( msq_stdc::size_t *indices, size_t num_vertices);
112 
113  msq_stdc::size_t get_vertex_index(msq_stdc::size_t vertex_in_element) const;
114 
115  //fills array of Vector3D's with the jacobian vectors and the
116  //number of jacobian vectors
117  void compute_weighted_jacobian(PatchData &pd, Vector3D& sample_point,
118  Vector3D jacobian_vectors[],
119  short &num_jacobian_vectors,
120  MsqError &err );
121 
124  msq_std::vector<Vector3D> &coords,
125  MsqError &err);
126 
128  void get_centroid(Vector3D& centroid, const PatchData &pd, MsqError &err) const;
129 
132  void get_connected_vertices(msq_stdc::size_t vertex_index,
133  msq_std::vector<msq_stdc::size_t> &vert_indices,
134  MsqError &err);
135 
138  double compute_unsigned_area(PatchData &pd, MsqError &err );
139 
142  double compute_unsigned_volume(PatchData &pd, MsqError &err );
143 
145  double compute_signed_area(PatchData &pd, MsqError &err );
146 
148  double compute_signed_volume(PatchData &pd, MsqError &err );
149 
151  //void compute_corner_normal( msq_stdc::size_t corner_pt,
152  // Vector3D &normal,
153  // PatchData &pd,
154  // MsqError &err);
155  void compute_corner_normals( Vector3D normals[], PatchData& pd, MsqError& err );
156 
159  void compute_corner_matrices(PatchData &pd, Matrix3D A[], int num_m3d, MsqError &err );
160 
161  private:
162  static void get_linear_quad_jac(Vector3D *sp,
163  Vector3D &coord0, Vector3D &coord1,
164  Vector3D &coord2, Vector3D &coord3,
165  Vector3D* jac);
166 
173  size_t* vertexIndices;
175 
176  // output operator for debugging.
177  friend msq_stdio::ostream& operator<<(msq_stdio::ostream &stream,
178  const MsqMeshEntity &entity);
179 
180  };
181 
182 
183  // Returns the number of vertices in this type
184  // of element, or 0 if a variable number.
185  inline size_t MsqMeshEntity::vertex_count() const
186  { return mType == POLYGON || mType == POLYHEDRON ?
188 
189  inline void MsqMeshEntity::set_connectivity( msq_stdc::size_t *indices,
190  size_t num_vertices )
191  {
192  vertexIndices = indices;
193  numVertexIndices = num_vertices;
194  }
195 
196  inline const msq_stdc::size_t *MsqMeshEntity::get_vertex_index_array() const
197  { return vertexIndices; }
198 
199  inline msq_stdc::size_t *MsqMeshEntity::get_vertex_index_array()
200  { return vertexIndices; }
201 
202  inline msq_stdc::size_t
203  MsqMeshEntity::get_vertex_index(msq_stdc::size_t vertex_in_element) const
204  {
205  // Make sure we're in range
206  assert(vertex_in_element < vertex_count());
207  // Return the index
208  return vertexIndices[vertex_in_element];
209  }
210 
212  Vector3D &coord0,
213  Vector3D &coord1,
214  Vector3D &coord2,
215  Vector3D &coord3,
216  Vector3D* jac)
217  {
218  jac[0]=coord1-coord0+(*sp)[1]*(coord2+coord0-coord3-coord1);
219  jac[1]=coord3-coord0+(*sp)[0]*(coord2+coord0-coord3-coord1);
220  }
221 } //namespace
222 
223 
224 #endif // MsqMeshEntity_hpp
msq_stdc::size_t get_vertex_index(msq_stdc::size_t vertex_in_element) const
void get_node_indices(msq_std::vector< msq_stdc::size_t > &vertex_list) const
gets the vertices of the mesh entity
friend msq_stdio::ostream & operator<<(msq_stdio::ostream &stream, const MsqMeshEntity &entity)
Used to hold the error state and return it to the application.
EntityTopology
Definition: Mesquite.hpp:92
double compute_signed_area(PatchData &pd, MsqError &err)
Computes the signed area of the element.
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...
void get_vertex_indices(msq_std::vector< msq_stdc::size_t > &vertex_list) const
gets the vertices of the mesh entity
double compute_unsigned_volume(PatchData &pd, MsqError &err)
Computes the volume of the element.
void set_element_type(EntityTopology type)
Sets element data.
size_t * vertexIndices
Pointer to connectivity array.
rational * A
Definition: vinci_lass.c:67
msq_stdc::size_t vertex_count() const
Returns the number of vertices in this element, based on its element type.
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
static unsigned corners(EntityTopology topo)
Get the number of defining vertices for a given element topology.
void append_vertex_indices(msq_std::vector< msq_stdc::size_t > &vertex_list) const
void compute_weighted_jacobian(PatchData &pd, Vector3D &sample_point, Vector3D jacobian_vectors[], short &num_jacobian_vectors, MsqError &err)
void get_centroid(Vector3D &centroid, const PatchData &pd, MsqError &err) const
Returns the centroid of the element.
double compute_unsigned_area(PatchData &pd, MsqError &err)
Computes the area of the element.
void append_node_indices(msq_std::vector< msq_stdc::size_t > &vertex_list) const
void set_connectivity(msq_stdc::size_t *indices, size_t num_vertices)
Set connectivity data (vertex array) for element.
void get_connected_vertices(msq_stdc::size_t vertex_index, msq_std::vector< msq_stdc::size_t > &vert_indices, MsqError &err)
Fills a vector&lt;size_t&gt; with vertices connected to the given vertex through the edges of this MsqMeshE...
EntityTopology get_element_type() const
Returns element type.
double compute_signed_volume(PatchData &pd, MsqError &err)
Computes the signed volume of the element.
const msq_stdc::size_t * get_vertex_index_array() const
Very efficient retrieval of vertices indexes (corresponding to the PatchData vertex array)...
static void get_linear_quad_jac(Vector3D *sp, Vector3D &coord0, Vector3D &coord1, Vector3D &coord2, Vector3D &coord3, Vector3D *jac)
void get_sample_points(QualityMetric::ElementEvaluationMode mode, msq_std::vector< Vector3D > &coords, MsqError &err)
Returns a list of sample points given an evaluationmode.
void compute_corner_matrices(PatchData &pd, Matrix3D A[], int num_m3d, MsqError &err)
Compute matrices which column are the vectors issued from a corner.
void compute_corner_normals(Vector3D normals[], PatchData &pd, MsqError &err)
Uses a MeshDomain call-back function to compute the normal at the corner.
msq_stdc::size_t node_count() const
Return number of nodes in element (number of corner vertices + number of higher-order nodes)...