Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
V_KnifeMetric.cpp File Reference
#include "moab/verdict.h"
#include "VerdictVector.hpp"
#include <memory.h>
+ Include dependency graph for V_KnifeMetric.cpp:

Go to the source code of this file.

Defines

#define VERDICT_EXPORTS

Functions

C_FUNC_DEF double v_knife_volume (int num_nodes, double coordinates[][3])
 Calculates knife volume.
C_FUNC_DEF void v_knife_quality (int num_nodes, double coordinates[][3], unsigned int metrics_request_flag, KnifeMetricVals *metric_vals)
 Calculates quality metrics for knife elements.

Define Documentation

#define VERDICT_EXPORTS

Definition at line 23 of file V_KnifeMetric.cpp.


Function Documentation

C_FUNC_DEF void v_knife_quality ( int  num_nodes,
double  coordinates[][3],
unsigned int  metrics_request_flag,
KnifeMetricVals metric_vals 
)

Calculates quality metrics for knife elements.

calculate the quality metrics of a knife element.

There is only one, but we put this here to be consistent with functions for other element types. Who knows if we'll add more metrics.

Definition at line 117 of file V_KnifeMetric.cpp.

References V_KNIFE_VOLUME, v_knife_volume(), and KnifeMetricVals::volume.

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

    if( metrics_request_flag & V_KNIFE_VOLUME ) metric_vals->volume = v_knife_volume( num_nodes, coordinates );
}
C_FUNC_DEF double v_knife_volume ( int  num_nodes,
double  coordinates[][3] 
)

Calculates knife volume.

calculates the volume of a knife element

this is done by dividing the knife into 4 tets and summing the volumes of each.

Definition at line 58 of file V_KnifeMetric.cpp.

References VerdictVector::set().

Referenced by moab::VerdictWrapper::all_quality_measures(), moab::VerdictWrapper::quality_measure(), and v_knife_quality().

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

    if( num_nodes == 7 )
    {

        // divide the knife into 4 tets and calculate the volume

        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 = side3 % ( side1 * side2 ) / 6;

        side1.set( coordinates[5][0] - coordinates[1][0], coordinates[5][1] - coordinates[1][1],
                   coordinates[5][2] - coordinates[1][2] );
        side2.set( coordinates[3][0] - coordinates[1][0], coordinates[3][1] - coordinates[1][1],
                   coordinates[3][2] - coordinates[1][2] );
        side3.set( coordinates[4][0] - coordinates[1][0], coordinates[4][1] - coordinates[1][1],
                   coordinates[4][2] - coordinates[1][2] );

        volume += side3 % ( side1 * side2 ) / 6;

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

        volume += side3 % ( side1 * side2 ) / 6;

        side1.set( coordinates[3][0] - coordinates[1][0], coordinates[3][1] - coordinates[1][1],
                   coordinates[3][2] - coordinates[1][2] );
        side2.set( coordinates[5][0] - coordinates[1][0], coordinates[5][1] - coordinates[1][1],
                   coordinates[5][2] - coordinates[1][2] );
        side3.set( coordinates[6][0] - coordinates[1][0], coordinates[6][1] - coordinates[1][1],
                   coordinates[6][2] - coordinates[1][2] );

        volume += side3 % ( side1 * side2 ) / 6;
    }

    return (double)volume;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines