Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
V_PyramidMetric.cpp File Reference
#include "moab/verdict.h"
#include "VerdictVector.hpp"
#include <memory.h>
+ Include dependency graph for V_PyramidMetric.cpp:

Go to the source code of this file.

Macros

#define VERDICT_EXPORTS
 

Functions

C_FUNC_DEF double v_pyramid_volume (int num_nodes, double coordinates[][3])
 Calculates pyramid volume. More...
 
C_FUNC_DEF void v_pyramid_quality (int num_nodes, double coordinates[][3], unsigned int metrics_request_flag, PyramidMetricVals *metric_vals)
 Calculates quality metrics for pyramid elements. More...
 

Macro Definition Documentation

◆ VERDICT_EXPORTS

#define VERDICT_EXPORTS

Definition at line 23 of file V_PyramidMetric.cpp.

Function Documentation

◆ v_pyramid_quality()

C_FUNC_DEF void v_pyramid_quality ( int  num_nodes,
double  coordinates[][3],
unsigned int  metrics_request_flag,
PyramidMetricVals metric_vals 
)

Calculates quality metrics for pyramid elements.

Definition at line 96 of file V_PyramidMetric.cpp.

100 {
101  memset( metric_vals, 0, sizeof( PyramidMetricVals ) );
102 
103  if( metrics_request_flag & V_PYRAMID_VOLUME ) metric_vals->volume = v_pyramid_volume( num_nodes, coordinates );
104 }

References V_PYRAMID_VOLUME, v_pyramid_volume(), and PyramidMetricVals::volume.

◆ v_pyramid_volume()

C_FUNC_DEF double v_pyramid_volume ( int  num_nodes,
double  coordinates[][3] 
)

Calculates pyramid volume.

the volume of a pyramid

the volume is calculated by dividing the pyramid into 2 tets and summing the volumes of the 2 tets.

Definition at line 59 of file V_PyramidMetric.cpp.

60 {
61 
62  double volume = 0;
63  VerdictVector side1, side2, side3;
64 
65  if( num_nodes == 5 )
66  {
67  // divide the pyramid into 2 tets and calculate each
68 
69  side1.set( coordinates[1][0] - coordinates[0][0], coordinates[1][1] - coordinates[0][1],
70  coordinates[1][2] - coordinates[0][2] );
71 
72  side2.set( coordinates[3][0] - coordinates[0][0], coordinates[3][1] - coordinates[0][1],
73  coordinates[3][2] - coordinates[0][2] );
74 
75  side3.set( coordinates[4][0] - coordinates[0][0], coordinates[4][1] - coordinates[0][1],
76  coordinates[4][2] - coordinates[0][2] );
77 
78  // volume of the first tet
79  volume = ( side3 % ( side1 * side2 ) ) / 6.0;
80 
81  side1.set( coordinates[3][0] - coordinates[2][0], coordinates[3][1] - coordinates[2][1],
82  coordinates[3][2] - coordinates[2][2] );
83 
84  side2.set( coordinates[1][0] - coordinates[2][0], coordinates[1][1] - coordinates[2][1],
85  coordinates[1][2] - coordinates[2][2] );
86 
87  side3.set( coordinates[4][0] - coordinates[2][0], coordinates[4][1] - coordinates[2][1],
88  coordinates[4][2] - coordinates[2][2] );
89 
90  // volume of the second tet
91  volume += ( side3 % ( side1 * side2 ) ) / 6.0;
92  }
93  return (double)volume;
94 }

References VerdictVector::set().

Referenced by v_pyramid_quality().