Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
Go to the source code of this file.
Functions | |
static double | tet_volume (const CartVect &v0, const CartVect &v1, const CartVect &v2, const CartVect &v3) |
double | edge_length (const double *start_vtx_coords, const double *end_vtx_coords) |
double | measure (moab::EntityType type, int num_vertices, const double *vertex_coordinates) |
double edge_length | ( | const double * | start_vtx_coords, |
const double * | end_vtx_coords | ||
) |
Definition at line 35 of file measure.cpp.
References moab::CartVect::length().
Referenced by gather_set_stats().
double measure | ( | moab::EntityType | type, |
int | num_vertices, | ||
const double * | vertex_coordinates | ||
) |
Definition at line 42 of file measure.cpp.
References length(), MBEDGE, MBHEX, MBPOLYGON, MBPRISM, MBPYRAMID, MBQUAD, MBTET, MBTRI, moab::sum(), and tet_volume().
{ const CartVect* coords = reinterpret_cast< const CartVect* >( vertex_coordinates ); switch( type ) { case moab::MBEDGE: return ( coords[0] - coords[1] ).length(); case moab::MBTRI: return 0.5 * ( ( coords[1] - coords[0] ) * ( coords[2] - coords[0] ) ).length(); case moab::MBQUAD: num_vertices = 4; // fall through case moab::MBPOLYGON: { CartVect mid( 0, 0, 0 ); for( int i = 0; i < num_vertices; ++i ) mid += coords[i]; mid /= num_vertices; double sum = 0.0; for( int i = 0; i < num_vertices; ++i ) { int j = ( i + 1 ) % num_vertices; sum += ( ( mid - coords[i] ) * ( mid - coords[j] ) ).length(); } return 0.5 * sum; } case moab::MBTET: return tet_volume( coords[0], coords[1], coords[2], coords[3] ); case moab::MBPYRAMID: return tet_volume( coords[0], coords[1], coords[2], coords[4] ) + tet_volume( coords[0], coords[2], coords[3], coords[4] ); case moab::MBPRISM: return tet_volume( coords[0], coords[1], coords[2], coords[5] ) + tet_volume( coords[3], coords[5], coords[4], coords[0] ) + tet_volume( coords[1], coords[4], coords[5], coords[0] ); case moab::MBHEX: return tet_volume( coords[0], coords[1], coords[3], coords[4] ) + tet_volume( coords[7], coords[3], coords[6], coords[4] ) + tet_volume( coords[4], coords[5], coords[1], coords[6] ) + tet_volume( coords[1], coords[6], coords[3], coords[4] ) + tet_volume( coords[2], coords[6], coords[3], coords[1] ); default: return 0.0; } }
static double tet_volume | ( | const CartVect & | v0, |
const CartVect & | v1, | ||
const CartVect & | v2, | ||
const CartVect & | v3 | ||
) | [inline, static] |
Definition at line 30 of file measure.cpp.
Referenced by measure().
{
return 1. / 6. * ( ( ( v1 - v0 ) * ( v2 - v0 ) ) % ( v3 - v0 ) );
}