Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
VerdictWrapper.hpp
Go to the documentation of this file.
1 /*
2  * VerdictWrapper.hpp
3  *
4  * Created on: Nov 18, 2014
5  * Author: iulian
6  */
7 
8 #ifndef SRC_VERDICT_MOAB_VERDICTWRAPPER_HPP_
9 #define SRC_VERDICT_MOAB_VERDICTWRAPPER_HPP_
10 
11 #include <map>
12 
13 namespace moab
14 {
15 
16 class Interface;
17 
19 {
20  // order exactly from HexMetricVals
22  MB_EDGE_RATIO = 0, // 0 MBHEX, MBTET, MBQUAD, MBTRI
23  MB_MAX_EDGE_RATIO, // 1 MBHEX, MBQUAD
24  MB_SKEW, // 2 MBHEX, MBQUAD
25  MB_TAPER, // 3 MBHEX, MBQUAD
26  MB_VOLUME, // 4 MBHEX, MBTET, MBPRISM, MBKNIFE
27  MB_STRETCH, // 5 MBHEX, MBQUAD
28  MB_DIAGONAL, // 6 MBHEX,
29  MB_DIMENSION, // 7 MBHEX,
30  MB_ODDY, // 8 MBHEX, MBQUAD
31  MB_MED_ASPECT_FROBENIUS, // 9 MBHEX, MBQUAD
32  MB_MAX_ASPECT_FROBENIUS, // 10 MBHEX, MBTET (aspect_frobenius) MBQUAD, MBTRI
33  // (aspect_frobenius)
34  MB_CONDITION, // 11 MBHEX, MBTET, MBQUAD, MBTRI
35  MB_JACOBIAN, // 12 MBHEX, MBTET, MBQUAD
36  MB_SCALED_JACOBIAN, // 13 MBHEX, MBTET, MBQUAD, MBTRI
37  MB_SHEAR, // 14 MBHEX, MBQUAD, MBTRI
38  MB_SHAPE, // 15 MBHEX, MBTET, MBQUAD, MBTRI
39  MB_RELATIVE_SIZE_SQUARED, // 16 MBHEX, MBTET, MBQUAD, MBTRI
40  MB_SHAPE_AND_SIZE, // 17 MBHEX, MBTET, MBQUAD
41  MB_SHEAR_AND_SIZE, // 18 MBHEX, MBQUAD
42  MB_DISTORTION, // 19 MBHEX, MBTET, MBQUAD
43  // length for edge:
44  MB_LENGTH, // 20 only for MBEDGE
45  // specific to tets
46  MB_RADIUS_RATIO, // 21 MBTET, MBQUAD, MBTRI
47  MB_ASPECT_BETA, // 22 MBTET
48  MB_ASPECT_RATIO, // 23 MBTET, MBQUAD, MBTRI
49  MB_ASPECT_GAMMA, // 24 MBTET
50  MB_MINIMUM_ANGLE, // 25 MBTET, MBQUAD, MBTRI
51  MB_COLLAPSE_RATIO, // 26 MBTET
52  // specific to quads
53  MB_WARPAGE, // 27 MBQUAD
54  MB_AREA, // 28 MBQUAD, MBTRI
55  MB_MAXIMUM_ANGLE, // 29 MBQUAD, MBTRI
56  MB_QUALITY_COUNT // used to size the arrays
57 
58 };
59 
60 inline std::string QualityType_ToString( QualityType qtype )
61 {
62  switch( qtype )
63  {
65  return "MB_UNDEFINED_QUALITY";
66  case MB_EDGE_RATIO:
67  return "MB_EDGE_RATIO";
68  case MB_MAX_EDGE_RATIO:
69  return "MB_MAX_EDGE_RATIO";
70  case MB_SKEW:
71  return "MB_SKEW";
72  case MB_TAPER:
73  return "MB_TAPER";
74  case MB_VOLUME:
75  return "MB_VOLUME";
76  case MB_STRETCH:
77  return "MB_STRETCH";
78  case MB_DIAGONAL:
79  return "MB_DIAGONAL";
80  case MB_DIMENSION:
81  return "MB_DIMENSION";
82  case MB_ODDY:
83  return "MB_ODDY";
85  return "MB_MED_ASPECT_FROBENIUS";
87  return "MB_MAX_ASPECT_FROBENIUS";
88  case MB_CONDITION:
89  return "MB_CONDITION";
90  case MB_JACOBIAN:
91  return "MB_JACOBIAN";
92  case MB_SCALED_JACOBIAN:
93  return "MB_SCALED_JACOBIAN";
94  case MB_SHEAR:
95  return "MB_SHEAR";
96  case MB_SHAPE:
97  return "MB_SHAPE";
99  return "MB_RELATIVE_SIZE_SQUARED";
100  case MB_SHAPE_AND_SIZE:
101  return "MB_SHAPE_AND_SIZE";
102  case MB_SHEAR_AND_SIZE:
103  return "MB_SHEAR_AND_SIZE";
104  case MB_DISTORTION:
105  return "MB_DISTORTION";
106  case MB_LENGTH:
107  return "MB_LENGTH";
108  case MB_RADIUS_RATIO:
109  return "MB_RADIUS_RATIO";
110  case MB_ASPECT_BETA:
111  return "MB_ASPECT_BETA";
112  case MB_ASPECT_RATIO:
113  return "MB_ASPECT_RATIO";
114  case MB_ASPECT_GAMMA:
115  return "MB_ASPECT_GAMMA";
116  case MB_MINIMUM_ANGLE:
117  return "MB_MINIMUM_ANGLE";
118  case MB_COLLAPSE_RATIO:
119  return "MB_COLLAPSE_RATIO";
120  case MB_WARPAGE:
121  return "MB_WARPAGE";
122  case MB_AREA:
123  return "MB_AREA";
124  case MB_MAXIMUM_ANGLE:
125  return "MB_MAXIMUM_ANGLE";
126  default:
127  return "MB_QUALITY_COUNT";
128  }
129 }
130 
132 {
133  public:
135  virtual ~VerdictWrapper();
136  //! return a quality for an entity
137  /** compute the quality for an element; the coordinates and number of nodes can be passed
138  * if available
139  \param eh element entity handle.
140  \param q quality requested
141  \param quality output
142  \param num_nodes optional, number of vertices
143  \param coords options, interleaved coordinates
144  return MB_SUCCESS
145  Example: \code
146  EntityHandle hex;
147  double jac;
148  rval = quality_measure(hex, MB_JACOBIAN, jac); \endcode
149  */
151  QualityType q,
152  double& quality,
153  int num_nodes = 0,
154  EntityType etype = MBMAXTYPE,
155  double* coords = NULL );
156  //! return a quality name
157  /** return quality name (convert an enum QualityType to a string)
158  \param q quality type
159  return string
160  Example: \code
161 
162  const char * name = quality_name(MB_JACOBIAN); \endcode
163  */
164  const char* quality_name( QualityType q );
165  //! return a string with entity type name
166  const char* entity_type_name( EntityType etype );
167  //! return an int with total available qualities for type
168  int num_qualities( EntityType etype );
169  //! return true if quality possible
170  int possible_quality( EntityType et, QualityType q );
171  // relative size needs a base size, that is set at global level, one for each major type (hex,
172  // tet, quad, tri)
173  ErrorCode set_size( double size );
174  //! return all qualities for an element
175  /** compute all qualities for an element
176  \param eh element entity handle.
177  \param qs list of QualityType
178  \param qualities list of qualities
179  return MB_SUCCESS
180  Example: \code
181  EntityHandle hex;
182  std::vector<QualityType> qs;
183  std::vector<double> qualities;
184  all_quality_measures(hex, qs, qualities); \endcode
185  */
186  ErrorCode all_quality_measures( EntityHandle eh, std::map< QualityType, double >& qualities );
187 
188  private:
190 };
191 } // namespace moab
192 #endif /* SRC_VERDICT_MOAB_VERDICTWRAPPER_HPP_ */