Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/LocalSizeQualityMetric.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 // -*- Mode : c++; tab-width: 3; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 3 -*-
28 
38 #ifndef LocalSizeQualityMetric_hpp
39 #define LocalSizeQualityMetric_hpp
40 
41 
42 #include "Mesquite.hpp"
43 #include "VolumeQualityMetric.hpp"
44 #include "Vector3D.hpp"
45 #include "PatchData.hpp"
46 #include "MsqMeshEntity.hpp"
47 
48 
49 namespace Mesquite
50 {
59  class MsqVertex;
60 
62  {
63  public:
64  //Default constructor.
66  {
67  avgMethod=RMS;
68  feasible=0;
70  set_name("Local Size Quality Metric");
71  }
72 
73  // virtual destructor ensures use of polymorphism during destruction
75  {}
76 
77 
78  protected:
80  bool evaluate_vertex(PatchData &pd, MsqVertex *vert, double &fval,
81  MsqError &err);
82 
83  private:
85  inline double compute_corner_area(PatchData &pd, size_t vert_1,
86  size_t vert_2, size_t vert_3,
87  MsqError &err);
88 
90  inline double compute_corner_volume(PatchData &pd, size_t vert_1,
91  size_t vert_2, size_t vert_3,
92  size_t vert_4, MsqError &err);
93 
94  };
95 
98  size_t vert_1,
99  size_t vert_2,
100  size_t vert_3,
101  MsqError &err)
102  {
103  MsqVertex* verts = pd.get_vertex_array(err);
104  Vector3D vec_1=verts[vert_2]-verts[vert_1];
105  Vector3D vec_2=verts[vert_3]-verts[vert_1];
106  Vector3D cross_vec=vec_1*vec_2;
107  return (cross_vec.length()/2.0);
108  }
109 
112  size_t vert_1,
113  size_t vert_2,
114  size_t vert_3,
115  size_t vert_4,
116  MsqError &err)
117  {
118  MsqVertex* verts = pd.get_vertex_array(err);
119  Vector3D vec_1=verts[vert_2]-verts[vert_1];
120  Vector3D vec_2=verts[vert_3]-verts[vert_1];
121  Vector3D vec_3=verts[vert_4]-verts[vert_1];
122  return fabs((vec_3%(vec_1*vec_2))/6.0);
123 
124  }
125 
126 
127 } //namespace
128 
129 
130 #endif // LocalSizeQualityMetric_hpp
131 
132 
Used to hold the error state and return it to the application.
double compute_corner_area(PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, MsqError &err)
Calculate the area of the triangle formed by the three vertices.
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
bool evaluate_vertex(PatchData &pd, MsqVertex *vert, double &fval, MsqError &err)
For the given vertex, vert, calculate the local size metric value.
const MsqVertex * get_vertex_array(MsqError &err) const
Returns a pointer to the start of the vertex array.
double compute_corner_volume(PatchData &pd, size_t vert_1, size_t vert_2, size_t vert_3, size_t vert_4, MsqError &err)
Calculate the volume of the tetrahedron formed by the four vertices.
void set_metric_type(MetricType t)
This function should be used in the constructor of every concrete quality metric. ...
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
Computes the local size metric for a given vertex.
void set_name(msq_std::string st)
Sets the name of this metric.