Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
VerdictWrapper.cpp
Go to the documentation of this file.
1 /*
2  * VerdictWrapper.cpp
3  *
4  * Created on: Nov 18, 2014
5  *
6  */
7 
8 #include "moab/Interface.hpp"
10 #include "Internals.hpp"
11 #include "moab/verdict.h"
12 
13 namespace moab
14 {
16 {
17  // TODO Auto-generated constructor stub
18 }
19 
21 {
22  // TODO Auto-generated destructor stub
23 }
24 
26  /*
27  MB_EDGE_RATIO = 0, // 0
28  | MB_MAX_EDGE_RATIO , // 1
29  | | MB_SKEW, // 2
30  | | | MB_TAPER, // 3
31  | | | | MB_VOLUME, // 4
32  | | | | | MB_STRETCH, // 5
33  | | | | | | MB_DIAGONAL, // 6
34  | | | | | | | MB_DIMENSION, // 7
35  | | | | | | | | MB_ODDY, // 8
36  | | | | | | | | | MB_MED_ASPECT_FROBENIUS,// 9
37  | | | | | | | | | | MB_MAX_ASPECT_FROBENIUS, // 10
38  | | | | | | | | | | | MB_CONDITION, // 11
39  | | | | | | | | | | | | MB_JACOBIAN, // 12
40  | | | | | | | | | | | | | MB_SCALED_JACOBIAN, // 13
41  | | | | | | | | | | | | | | MB_SHEAR, // 14
42  | | | | | | | | | | | | | | | MB_SHAPE, // 15
43  | | | | | | | | | | | | | | | | MB_RELATIVE_SIZE_SQUARED, // 16
44  | | | | | | | | | | | | | | | | | MB_SHAPE_AND_SIZE, // 17
45  | | | | | | | | | | | | | | | | | | MB_SHEAR_AND_SIZE, // 18
46  | | | | | | | | | | | | | | | | | | | MB_DISTORTION, // 19
47  | | | | | | | | | | | | | | | | | | | | MB_LENGTH, // 20
48  only for edge | | | | | | | | | | | | | | | | | | | | | MB_RADIUS_RATIO
49  // 21 tet | | | | | | | | | | | | | | | | | | | | | | MB_ASPECT_BETA //
50  22 tet (very similar to 21) | | | | | | | | | | | | | | | | | | | | | |
51  | MB_ASPECT_RATIO // 23 tet | | | | | | | | | | | | | | | | | | | | |
52  | | | MB_ASPECT_GAMMA // 24 tet | | | | | | | | | | | | | | | | | | | |
53  | | | | | MB_MINIMUM_ANGLE // 25 tet | | | | | | | | | | | | | | | | | |
54  | | | | | | | | MB_COLLAPSE_RATIO // 26 tet | | | | | | | | | | | | | |
55  | | | | | | | | | | | | | MB_WARPAGE // 27 quad | | | | | | | | | |
56  | | | | | | | | | | | | | | | | | | MB_AREA // 28 quad | | | | | |
57  | | | | | | | | | | | | | | | | | | | | | | | MB_MAXIMUM_ANGLE // 29
58  quad | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
59  | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
60  */
61  /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29*/
62  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBVERTEX
63  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBEDGE
64  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1 }, // MBTRI
65  { 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1 }, // MBQUAD
66  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBPOLYGON
67  { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 }, // MBTET
68  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBPYRAMID
69  { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBPRISM
70  { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBKNIFE
71  { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBHEX
72  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // MBPOLYHEDRON
73  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // MBENTITYSET
74 };
75 
76 static int numQualities[MBMAXTYPE] = {
77  0, // "MBVERTEX"
78  1, // "MBEDGE", /**< Mesh Edge */
79  13, // "MBTRI", /**< Triangular element (including shells) */
80  22, // "MBQUAD", /**< Quadrilateral element (including shells) */
81  0, // "MBPOLYGON", /**< Polygon */
82  14, // "MBTET", /**< Tetrahedral element */
83  0, //"MBPYRAMID", /**< Pyramid element (where are the face ids for this defined?) */
84  1, // "MBPRISM", /**< Wedge element (Exodus has one, Cubit doesn't. Does Mesh need it?) */
85  1, // "MBKNIFE", /**< Knife element */
86  20, // "MBHEX", /**< Hexahedral element */
87  0, //"MBPOLYHEDRON", /**< Polyhedron */
88  0, // "MBENTITYSET", /**< MeshSet */
89 };
90 static char const* nameQuality[MB_QUALITY_COUNT] = {
91  " edge ratio", // MB_EDGE_RATIO = 0, // 0
92  " maximum edge ratio", // MB_MAX_EDGE_RATIO , // 1
93  " skew", // MB_SKEW, // 2
94  " taper", // MB_TAPER, // 3
95  " volume", // MB_VOLUME, // 4
96  " stretch", // MB_STRETCH, // 5
97  " diagonal", // MB_DIAGONAL, // 6
98  " characteristic length", // MB_DIMENSION, // 7
99  " oddy", // MB_ODDY, // 8
100  " average Frobenius aspect", // MB_MED_ASPECT_FROBENIUS,// 9
101  " maximum Frobenius aspect", // MB_MAX_ASPECT_FROBENIUS, // 10
102  " condition number", // MB_CONDITION, // 11
103  " jacobian", // MB_JACOBIAN, // 12
104  " scaled jacobian", // MB_SCALED_JACOBIAN, // 13
105  " shear", // MB_SHEAR, // 14
106  " shape", // MB_SHAPE, // 15
107  " relative size squared", // MB_RELATIVE_SIZE_SQUARED, // 16
108  " shape and size", // MB_SHAPE_AND_SIZE, // 17
109  " shear and size", // MB_SHEAR_AND_SIZE, // 18
110  " distortion", // MB_DISTORTION, // 19
111  // next are QuadMetricVals that are not in hex metrics
112  // length for edge:
113  " length", // MB_LENGTH, // 20 only for edge
114  " radius ratio", // MB_RADIUS_RATIO // 21 tet
115  " aspect beta", // MB_ASPECT_BETA // 22 tet
116  " aspect ratio", // MB_ASPECT_RATIO, // 23 MBTET
117  " aspect gamma", // MB_ASPECT_GAMMA // 24 tet
118  " minimum angle", // MB_MINIMUM_ANGLE, // 25 MBTET
119  " collapse ratio", // MB_COLLAPSE_RATIO, // 26 MBTET
120  " warpage", // MB_WARPAGE // 27 MBQUAD
121  " area", // MB_AREA // 28 MBQAD
122  " maximum angle" // MB_MAXIMUM_ANGLE // 29 MBQUAD
123 };
124 
125 static const char* nameType[MBMAXTYPE] = {
126  "MBVERTEX", /**< Mesh Vertex AKA node */
127  "MBEDGE", /**< Mesh Edge */
128  "MBTRI", /**< Triangular element (including shells) */
129  "MBQUAD", /**< Quadrilateral element (including shells) */
130  "MBPOLYGON", /**< Polygon */
131  "MBTET", /**< Tetrahedral element */
132  "MBPYRAMID", /**< Pyramid element (where are the face ids for this defined?) */
133  "MBPRISM", /**< Wedge element (Exodus has one, Cubit doesn't. Does Mesh need it?) */
134  "MBKNIFE", /**< Knife element */
135  "MBHEX", /**< Hexahedral element */
136  "MBPOLYHEDRON", /**< Polyhedron */
137  "MBENTITYSET", /**< MeshSet */
138 };
139 
141  QualityType q,
142  double& quality,
143  int num_nodes,
144  EntityType etype,
145  double* coords )
146 {
147  double coordinates[27][3]; // at most 27 nodes per element
148 
149  if( 0 == num_nodes && NULL == coords )
150  {
151  etype = TYPE_FROM_HANDLE( eh );
152  if( possibleQuality[etype][q] == 0 ) return MB_NOT_IMPLEMENTED;
153 
154  // get coordinates of points, if not passed already
155  const EntityHandle* conn = NULL;
156  // int num_nodes;
157  ErrorCode rval = mbImpl->get_connectivity( eh, conn, num_nodes );
158  if( rval != MB_SUCCESS ) return rval;
159  if( etype != MBPOLYHEDRON )
160  {
161  rval = mbImpl->get_coords( conn, num_nodes, &( coordinates[0][0] ) );
162  if( rval != MB_SUCCESS ) return rval;
163  }
164  }
165  else
166  {
167  if( num_nodes > 27 ) return MB_FAILURE;
168  for( int i = 0; i < num_nodes; i++ )
169  {
170  for( int j = 0; j < 3; j++ )
171  coordinates[i][j] = coords[3 * i + j];
172  }
173  }
174  VerdictFunction func = 0;
175 
176  switch( etype )
177  {
178  case MBHEX: {
179  num_nodes = 8;
180  switch( q )
181  {
182  case MB_EDGE_RATIO:
183  func = v_hex_edge_ratio;
184  break; // 0
185  case MB_MAX_EDGE_RATIO:
186  func = v_hex_max_edge_ratio;
187  break; // 1
188  case MB_SKEW:
189  func = v_hex_skew;
190  break; // 2
191  case MB_TAPER:
192  func = v_hex_taper;
193  break; // 3
194  case MB_VOLUME:
195  func = v_hex_volume;
196  break; // 4
197  case MB_STRETCH:
198  func = v_hex_stretch;
199  break; // 5
200  case MB_DIAGONAL:
201  func = v_hex_diagonal;
202  break; // 6
203  case MB_DIMENSION:
204  func = v_hex_dimension;
205  break; // 7
206  case MB_ODDY:
207  func = v_hex_oddy;
208  break; // 8
211  break; // 9
214  break; // 10
215  case MB_CONDITION:
216  func = v_hex_condition;
217  break; // 11
218  case MB_JACOBIAN:
219  func = v_hex_jacobian;
220  break; // 12
221  case MB_SCALED_JACOBIAN:
222  func = v_hex_scaled_jacobian;
223  break; // 13
224  case MB_SHEAR:
225  func = v_hex_shear;
226  break; // 14
227  case MB_SHAPE:
228  func = v_hex_shape;
229  break; // 15
232  break; // 16
233  case MB_SHAPE_AND_SIZE:
234  func = v_hex_shape_and_size;
235  break; // 17
236  case MB_SHEAR_AND_SIZE:
237  func = v_hex_shear_and_size;
238  break; // 18
239  case MB_DISTORTION:
240  func = v_hex_distortion;
241  break; // 19
242  default:
243  return MB_FAILURE;
244  }
245  break;
246  }
247  case MBEDGE: {
248  num_nodes = 2;
249  switch( q )
250  {
251  case MB_LENGTH:
252  func = v_edge_length;
253  break; // 20
254  default:
255  return MB_FAILURE;
256  }
257  break;
258  }
259  case MBTET: {
260  num_nodes = 4;
261  switch( q )
262  {
263  case MB_EDGE_RATIO:
264  func = v_tet_edge_ratio;
265  break; // 0 //! Calculates tet edge ratio metric.
266  case MB_RADIUS_RATIO:
267  func = v_tet_radius_ratio;
268  break; // 21
269  case MB_ASPECT_BETA:
270  func = v_tet_aspect_beta;
271  break; // 22
272  case MB_ASPECT_RATIO:
273  func = v_tet_aspect_ratio;
274  break; // 23
275  case MB_ASPECT_GAMMA:
276  func = v_tet_aspect_gamma;
277  break; // 24
279  func = v_tet_aspect_frobenius;
280  break; // 10
281  case MB_MINIMUM_ANGLE:
282  func = v_tet_minimum_angle;
283  break; // 25
284  case MB_COLLAPSE_RATIO:
285  func = v_tet_collapse_ratio;
286  break; // 26
287  case MB_VOLUME:
288  func = v_tet_volume;
289  break; // 4
290  case MB_CONDITION:
291  func = v_tet_condition;
292  break; // 11
293  case MB_JACOBIAN:
294  func = v_tet_jacobian;
295  break; // 12
296  case MB_SCALED_JACOBIAN:
297  func = v_tet_scaled_jacobian;
298  break; // 13
299  case MB_SHAPE:
300  func = v_tet_shape;
301  break; // 15
304  break; // 16
305  case MB_SHAPE_AND_SIZE:
306  func = v_tet_shape_and_size;
307  break; // 17
308  case MB_DISTORTION:
309  func = v_tet_distortion;
310  break; // 19
311  default:
312  return MB_FAILURE;
313  }
314  break;
315  }
316  case MBPRISM: {
317  num_nodes = 6;
318  switch( q )
319  {
320  case MB_VOLUME:
321  func = v_wedge_volume;
322  break; // 4
323  default:
324  return MB_FAILURE;
325  }
326  break;
327  }
328  case MBKNIFE: {
329  num_nodes = 7;
330  switch( q )
331  {
332  case MB_VOLUME:
333  func = v_knife_volume;
334  break; // 4
335  default:
336  return MB_FAILURE;
337  }
338  break;
339  }
340  case MBQUAD: {
341  num_nodes = 4;
342  switch( q )
343  {
344  case MB_EDGE_RATIO:
345  func = v_quad_edge_ratio;
346  break; // 0
347  case MB_MAX_EDGE_RATIO:
348  func = v_quad_max_edge_ratio;
349  break; // 1
350  case MB_ASPECT_RATIO:
351  func = v_quad_aspect_ratio;
352  break; // 23
353  case MB_RADIUS_RATIO:
354  func = v_quad_radius_ratio;
355  break; // 21
358  break; // 9
361  break; // 10
362  case MB_SKEW:
363  func = v_quad_skew;
364  break; // 2
365  case MB_TAPER:
366  func = v_quad_taper;
367  break; // 3
368  case MB_WARPAGE:
369  func = v_quad_warpage;
370  break; // 27
371  case MB_AREA:
372  func = v_quad_area;
373  break; // 28
374  case MB_STRETCH:
375  func = v_quad_stretch;
376  break; // 5
377  case MB_MINIMUM_ANGLE:
378  func = v_quad_minimum_angle;
379  break; // 25
380  case MB_MAXIMUM_ANGLE:
381  func = v_quad_maximum_angle;
382  break; // 29
383  case MB_ODDY:
384  func = v_quad_oddy;
385  break; // 8
386  case MB_CONDITION:
387  func = v_quad_condition;
388  break; // 11
389  case MB_JACOBIAN:
390  func = v_quad_jacobian;
391  break; // 12
392  case MB_SCALED_JACOBIAN:
393  func = v_quad_scaled_jacobian;
394  break; // 13
395  case MB_SHEAR:
396  func = v_quad_shear;
397  break; // 14
398  case MB_SHAPE:
399  func = v_quad_shape;
400  break; // 15
403  break; // 16
404  case MB_SHAPE_AND_SIZE:
405  func = v_quad_shape_and_size;
406  break; // 17
407  case MB_SHEAR_AND_SIZE:
408  func = v_quad_shear_and_size;
409  break; // 18
410  case MB_DISTORTION:
411  func = v_quad_distortion;
412  break; // 19
413  default:
414  return MB_FAILURE;
415  }
416  break;
417  }
418 
419  case MBTRI: {
420  num_nodes = 3;
421  switch( q )
422  {
423  case MB_EDGE_RATIO:
424  func = v_tri_edge_ratio;
425  break; // 0
426  case MB_ASPECT_RATIO:
427  func = v_tri_aspect_ratio;
428  break; // 23
429  case MB_RADIUS_RATIO:
430  func = v_tri_radius_ratio;
431  break; // 21
433  func = v_tri_aspect_frobenius;
434  break; // 10
435  case MB_AREA:
436  func = v_tri_area;
437  break; // 28
438  case MB_MINIMUM_ANGLE:
439  func = v_tri_minimum_angle;
440  break; // 25
441  case MB_MAXIMUM_ANGLE:
442  func = v_tri_maximum_angle;
443  break; // 29
444  case MB_CONDITION:
445  func = v_tri_condition;
446  break; // 11
447  case MB_SCALED_JACOBIAN:
448  func = v_tri_scaled_jacobian;
449  break; // 13
450  // does not exist, even though it was defined in verdict.h; remove it from there too
451  // case MB_SHEAR: func = v_tri_shear; break; // 14
454  break; // 16
455  case MB_SHAPE:
456  func = v_tri_shape;
457  break; // 15
458  case MB_SHAPE_AND_SIZE:
459  func = v_tri_shape_and_size;
460  break; // 17
461  case MB_DISTORTION:
462  func = v_tri_distortion;
463  break; // 19
464  default:
465  return MB_FAILURE;
466  }
467  break;
468  }
469  default:
470  break; // some have no measures
471  }
472 
473  if( !func ) return MB_NOT_IMPLEMENTED;
474  // actual computation happens here
475  quality = ( *func )( num_nodes, coordinates );
476 
477  return MB_SUCCESS;
478 }
480 {
481  return nameQuality[q];
482 }
483 const char* VerdictWrapper::entity_type_name( EntityType etype )
484 {
485  return nameType[etype];
486 }
487 int VerdictWrapper::num_qualities( EntityType etype )
488 {
489  return numQualities[etype];
490 }
492 {
493  return possibleQuality[et][q];
494 }
495 // relative size needs a base size, that is set at global level, one for each major type (hex, tet,
496 // quad, tri)
498 {
499  // set the sizes for all of them; maybe we can set by type, this should be enough for simplicity
500  v_set_hex_size( size );
501  v_set_tet_size( size );
503  v_set_tri_size( size );
504  return MB_SUCCESS;
505 }
506 
507 ErrorCode VerdictWrapper::all_quality_measures( EntityHandle eh, std::map< QualityType, double >& qualities )
508 {
509  EntityType etype = TYPE_FROM_HANDLE( eh );
510  if( etype == MBPOLYHEDRON || etype == MBVERTEX || etype == MBENTITYSET )
511  return MB_SUCCESS; // no quality for polyhedron or vertex or set
512 
513  double coordinates[27][3]; // at most 27 nodes per element
514  // get coordinates of points, if not passed already
515  const EntityHandle* conn = NULL;
516  int num_nodes;
517  ErrorCode rval = mbImpl->get_connectivity( eh, conn, num_nodes );
518  if( rval != MB_SUCCESS ) return rval;
519  rval = mbImpl->get_coords( conn, num_nodes, &( coordinates[0][0] ) );
520  if( rval != MB_SUCCESS ) return rval;
521 
522  switch( etype )
523  {
524  case MBEDGE: {
525  double leng = v_edge_length( 2, coordinates );
526  qualities[MB_LENGTH] = leng;
527  break;
528  }
529  case MBHEX: {
530  num_nodes = 8;
531  HexMetricVals hexMetric;
532  v_hex_quality( num_nodes, coordinates, V_HEX_ALL, &hexMetric );
533  qualities[MB_EDGE_RATIO] = hexMetric.edge_ratio;
534  qualities[MB_MAX_EDGE_RATIO] = hexMetric.max_edge_ratio;
535  qualities[MB_SKEW] = hexMetric.skew;
536  qualities[MB_TAPER] = hexMetric.taper;
537  qualities[MB_VOLUME] = hexMetric.volume;
538  qualities[MB_STRETCH] = hexMetric.stretch;
539  qualities[MB_DIAGONAL] = hexMetric.diagonal;
540  qualities[MB_DIMENSION] = hexMetric.dimension;
541  qualities[MB_ODDY] = hexMetric.oddy;
542  qualities[MB_MED_ASPECT_FROBENIUS] = hexMetric.med_aspect_frobenius;
543  // MB_CONDITION is the same as MB_MAX_ASPECT_FROBENIUS
544  qualities[MB_MAX_ASPECT_FROBENIUS] = hexMetric.condition;
545  qualities[MB_CONDITION] = hexMetric.condition;
546  qualities[MB_JACOBIAN] = hexMetric.jacobian;
547  qualities[MB_SCALED_JACOBIAN] = hexMetric.scaled_jacobian;
548  qualities[MB_SHEAR] = hexMetric.shear;
549  qualities[MB_SHAPE] = hexMetric.shape;
550  qualities[MB_RELATIVE_SIZE_SQUARED] = hexMetric.relative_size_squared;
551  qualities[MB_SHAPE_AND_SIZE] = hexMetric.shape_and_size;
552  qualities[MB_SHEAR_AND_SIZE] = hexMetric.shear_and_size;
553  qualities[MB_DISTORTION] = hexMetric.distortion;
554  break;
555  }
556 
557  case MBTET: {
558  num_nodes = 4;
559  TetMetricVals tetMetrics;
560  v_tet_quality( num_nodes, coordinates, V_TET_ALL, &tetMetrics );
561  qualities[MB_EDGE_RATIO] = tetMetrics.edge_ratio;
562  qualities[MB_RADIUS_RATIO] = tetMetrics.radius_ratio;
563  qualities[MB_ASPECT_BETA] = tetMetrics.aspect_beta;
564  qualities[MB_ASPECT_RATIO] = tetMetrics.aspect_ratio;
565  qualities[MB_ASPECT_GAMMA] = tetMetrics.aspect_gamma;
566  qualities[MB_MAX_ASPECT_FROBENIUS] = tetMetrics.aspect_frobenius;
567  qualities[MB_MINIMUM_ANGLE] = tetMetrics.minimum_angle;
568  qualities[MB_COLLAPSE_RATIO] = tetMetrics.collapse_ratio;
569  qualities[MB_VOLUME] = tetMetrics.volume;
570  qualities[MB_CONDITION] = tetMetrics.condition;
571  qualities[MB_JACOBIAN] = tetMetrics.jacobian;
572  qualities[MB_SCALED_JACOBIAN] = tetMetrics.scaled_jacobian;
573  qualities[MB_SHAPE] = tetMetrics.shape;
574  qualities[MB_RELATIVE_SIZE_SQUARED] = tetMetrics.relative_size_squared;
575  qualities[MB_SHAPE_AND_SIZE] = tetMetrics.shape_and_size;
576  qualities[MB_DISTORTION] = tetMetrics.distortion;
577  break;
578  }
579  case MBPRISM: {
580  num_nodes = 6;
581  double volu = v_wedge_volume( num_nodes, coordinates );
582  qualities[MB_VOLUME] = volu;
583  break;
584  }
585  case MBKNIFE: {
586  num_nodes = 7;
587  double volu = v_knife_volume( num_nodes, coordinates );
588  qualities[MB_VOLUME] = volu;
589  break;
590  }
591  case MBQUAD: {
592  num_nodes = 4;
593  QuadMetricVals quadMetrics;
594  v_quad_quality( num_nodes, coordinates, V_QUAD_ALL, &quadMetrics );
595  qualities[MB_EDGE_RATIO] = quadMetrics.edge_ratio;
596  qualities[MB_MAX_EDGE_RATIO] = quadMetrics.max_edge_ratio;
597  qualities[MB_ASPECT_RATIO] = quadMetrics.aspect_ratio; // 23
598  qualities[MB_RADIUS_RATIO] = quadMetrics.radius_ratio; // 21
599  qualities[MB_MED_ASPECT_FROBENIUS] = quadMetrics.med_aspect_frobenius; // 9
600  qualities[MB_MAX_ASPECT_FROBENIUS] = quadMetrics.max_aspect_frobenius; // 10
601  qualities[MB_SKEW] = quadMetrics.skew; // 2
602  qualities[MB_TAPER] = quadMetrics.taper; // 3
603  qualities[MB_WARPAGE] = quadMetrics.warpage; // 27
604  qualities[MB_AREA] = quadMetrics.area; // 28
605  qualities[MB_STRETCH] = quadMetrics.stretch; // 5
606  qualities[MB_MINIMUM_ANGLE] = quadMetrics.minimum_angle; // 25
607  qualities[MB_MAXIMUM_ANGLE] = quadMetrics.maximum_angle; // 29
608  qualities[MB_ODDY] = quadMetrics.oddy; // 8
609  qualities[MB_CONDITION] = quadMetrics.condition; // 11
610  qualities[MB_JACOBIAN] = quadMetrics.jacobian; // 12
611  qualities[MB_SCALED_JACOBIAN] = quadMetrics.scaled_jacobian; // 13
612  qualities[MB_SHEAR] = quadMetrics.shear; // 14
613  qualities[MB_SHAPE] = quadMetrics.shape; // 15
614  qualities[MB_RELATIVE_SIZE_SQUARED] = quadMetrics.relative_size_squared; // 16
615  qualities[MB_SHAPE_AND_SIZE] = quadMetrics.shape_and_size; // 17
616  qualities[MB_SHEAR_AND_SIZE] = quadMetrics.shear_and_size; // 18
617  qualities[MB_DISTORTION] = quadMetrics.distortion; // 19
618  break;
619  }
620 
621  case MBTRI: {
622  num_nodes = 3;
623  TriMetricVals triMetrics;
624  v_tri_quality( num_nodes, coordinates, V_TRI_ALL, &triMetrics );
625  qualities[MB_EDGE_RATIO] = triMetrics.edge_ratio; // 0
626  qualities[MB_ASPECT_RATIO] = triMetrics.aspect_ratio; // 23
627  qualities[MB_RADIUS_RATIO] = triMetrics.radius_ratio; // 21
628  qualities[MB_MAX_ASPECT_FROBENIUS] = triMetrics.aspect_frobenius; // 10
629  qualities[MB_AREA] = triMetrics.area; // 28
630  qualities[MB_MINIMUM_ANGLE] = triMetrics.minimum_angle; // 25
631  qualities[MB_MAXIMUM_ANGLE] = triMetrics.maximum_angle; // 29
632  qualities[MB_CONDITION] = triMetrics.condition; // 11
633  qualities[MB_SCALED_JACOBIAN] = triMetrics.scaled_jacobian; // 13
634  // does not exist, even though it was defined in verdict.h; remove it from there too
635  // case MB_SHEAR: func = v_tri_shear; break; // 14
636  qualities[MB_RELATIVE_SIZE_SQUARED] = triMetrics.relative_size_squared; // 16
637  qualities[MB_SHAPE] = triMetrics.shape; // 15
638  qualities[MB_SHAPE_AND_SIZE] = triMetrics.shape_and_size; // 17
639  qualities[MB_DISTORTION] = triMetrics.distortion; // 19
640  break;
641  }
642  default:
643  return MB_NOT_IMPLEMENTED;
644  }
645  return MB_SUCCESS;
646 }
647 
648 } // namespace moab