Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
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.

Defines

#define VERDICT_EXPORTS

Functions

C_FUNC_DEF double v_pyramid_volume (int num_nodes, double coordinates[][3])
 Calculates pyramid volume.
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.

Define Documentation

#define VERDICT_EXPORTS

Definition at line 23 of file V_PyramidMetric.cpp.


Function Documentation

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.

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

{
    memset( metric_vals, 0, sizeof( PyramidMetricVals ) );

    if( metrics_request_flag & V_PYRAMID_VOLUME ) metric_vals->volume = v_pyramid_volume( num_nodes, coordinates );
}
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.

References VerdictVector::set().

Referenced by v_pyramid_quality().

{

    double volume = 0;
    VerdictVector side1, side2, side3;

    if( num_nodes == 5 )
    {
        // divide the pyramid into 2 tets and calculate each

        side1.set( coordinates[1][0] - coordinates[0][0], coordinates[1][1] - coordinates[0][1],
                   coordinates[1][2] - coordinates[0][2] );

        side2.set( coordinates[3][0] - coordinates[0][0], coordinates[3][1] - coordinates[0][1],
                   coordinates[3][2] - coordinates[0][2] );

        side3.set( coordinates[4][0] - coordinates[0][0], coordinates[4][1] - coordinates[0][1],
                   coordinates[4][2] - coordinates[0][2] );

        // volume of the first tet
        volume = ( side3 % ( side1 * side2 ) ) / 6.0;

        side1.set( coordinates[3][0] - coordinates[2][0], coordinates[3][1] - coordinates[2][1],
                   coordinates[3][2] - coordinates[2][2] );

        side2.set( coordinates[1][0] - coordinates[2][0], coordinates[1][1] - coordinates[2][1],
                   coordinates[1][2] - coordinates[2][2] );

        side3.set( coordinates[4][0] - coordinates[2][0], coordinates[4][1] - coordinates[2][1],
                   coordinates[4][2] - coordinates[2][2] );

        // volume of the second tet
        volume += ( side3 % ( side1 * side2 ) ) / 6.0;
    }
    return (double)volume;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines