moab
|
Go to the source code of this file.
Classes | |
class | CartVect |
Functions | |
CartVect | operator+ (const CartVect &v1, const CartVect &v2) |
CartVect | operator- (const CartVect &v1, const CartVect &v2) |
double | operator% (const CartVect &v1, const CartVect &v2) |
CartVect | operator* (const CartVect &v1, const CartVect &v2) |
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 | ||
) |
double measure | ( | moab::EntityType | type, |
int | num_vertices, | ||
const double * | vertex_coordinates | ||
) |
Definition at line 153 of file measure.cpp.
{ const CartVect* coords = reinterpret_cast<const CartVect*>(vertex_coordinates); switch( type ) { case moab::MBEDGE: return (coords[0] - coords[1]).len(); case moab::MBTRI: return 0.5 * ((coords[1] - coords[0]) * (coords[2] - coords[0])).len(); case moab::MBQUAD: num_vertices = 4; 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])).len(); } 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; } }
Definition at line 96 of file measure.cpp.
{ CartVect rval(v1); rval += v2; return rval; }
Definition at line 103 of file measure.cpp.
{ CartVect rval(v1); rval -= v2; return rval; }
static double tet_volume | ( | const CartVect & | v0, |
const CartVect & | v1, | ||
const CartVect & | v2, | ||
const CartVect & | v3 | ||
) | [inline, static] |
Definition at line 137 of file measure.cpp.
{
return 1./6. * ( ((v1 - v0) * (v2 - v0)) % (v3 - v0) );
}