|
cgma
|
#include <GeoTet.hpp>
Public Member Functions | |
| GeoTet (GeoNode *nodes[4]) | |
| ~GeoTet () | |
| void | tet_nodes (GeoNode *&na, GeoNode *&nb, GeoNode *&nc, GeoNode *&nd) |
| void | tet_face_nodes (int face_index, GeoNode *&na, GeoNode *&nb, GeoNode *&nc) |
| GeoTet * | get_connected_tet (GeoNode *na, GeoNode *nb, GeoNode *nc) |
| GeoTet * | get_connected_tet (int face_index) |
| int | node_index (GeoNode *node_ptr) |
| void | opposite_edge (GeoNode *a_node, GeoNode *b_node, GeoNode *&c_node, GeoNode *&d_node) |
| void | marked (int flag) |
| int | marked () |
| void | inside (int is_inside) |
| int | inside () |
| CubitStatus | circumsphere (CubitVector &circumcenter, double *radius=NULL) |
Private Attributes | |
| GeoNode * | mNodes [4] |
| cBit | isMarked: 1 |
| cBit | isInside: 1 |
Definition at line 26 of file GeoTet.hpp.
| GeoTet::GeoTet | ( | GeoNode * | nodes[4] | ) |
| GeoTet::~GeoTet | ( | ) |
Definition at line 45 of file GeoTet.cpp.
{
}
| CubitStatus GeoTet::circumsphere | ( | CubitVector & | circumcenter, |
| double * | radius = NULL |
||
| ) |
Definition at line 199 of file GeoTet.cpp.
{
double reltol = DBL_EPSILON * 100.0;
CubitVector a = mNodes[0]->coordinates();
CubitVector b = mNodes[1]->coordinates();
CubitVector c = mNodes[2]->coordinates();
CubitVector d = mNodes[3]->coordinates();
CubitVector da = a - d;
CubitVector db = b - d;
CubitVector dc = c - d;
double rhsa = 0.5*(SQR(da.x()) + SQR(da.y()) + SQR(da.z()));
double rhsb = 0.5*(SQR(db.x()) + SQR(db.y()) + SQR(db.z()));
double rhsc = 0.5*(SQR(dc.x()) + SQR(dc.y()) + SQR(dc.z()));
double cpa = db.y()*dc.z() - dc.y()*db.z();
double cpb = dc.y()*da.z() - da.y()*dc.z();
double cpc = da.y()*db.z() - db.y()*da.z();
double det = da.x()*cpa + db.x()*cpb + dc.x()*cpc;
double xmax = CUBIT_MAX(fabs(a.x()),fabs(b.x()));
xmax = CUBIT_MAX(xmax,fabs(c.x()));
xmax = CUBIT_MAX(xmax,fabs(d.x()));
double ymax = CUBIT_MAX(fabs(a.y()),fabs(b.y()));
ymax = CUBIT_MAX(ymax,fabs(c.y()));
ymax = CUBIT_MAX(ymax,fabs(d.y()));
double zmax = CUBIT_MAX(fabs(a.z()),fabs(b.z()));
zmax = CUBIT_MAX(zmax,fabs(c.z()));
zmax = CUBIT_MAX(zmax,fabs(d.z()));
double tolabs = reltol*xmax*ymax*zmax;
if (fabs(det) <= tolabs) {
return CUBIT_FAILURE;
}
center.x( (rhsa*cpa + rhsb*cpb + rhsc*cpc)/det );
cpa = db.x()*rhsc - dc.x()*rhsb;
cpb = dc.x()*rhsa - da.x()*rhsc;
cpc = da.x()*rhsb - db.x()*rhsa;
center.y( (da.z()*cpa + db.z()*cpb + dc.z()*cpc)/det );
center.z( -(da.y()*cpa + db.y()*cpb + dc.y()*cpc)/det );
center += d;
if ( radius )
{
double radsq = SQR(center.x()) + SQR(center.y()) + SQR(center.z());
*radius = sqrt( radsq );
}
return CUBIT_SUCCESS;
}
| GeoTet * GeoTet::get_connected_tet | ( | GeoNode * | na, |
| GeoNode * | nb, | ||
| GeoNode * | nc | ||
| ) |
Definition at line 100 of file GeoTet.cpp.
{
GeoTet *adj_tet = NULL;
int ii;
// get the tets adjacent
DLIList<GeoTet *> *tet_list_ptr = na->tet_list();
GeoTet *tet_ptr;
for (ii=0; ii<tet_list_ptr->size() && !adj_tet; ii++)
{
tet_ptr = tet_list_ptr->get_and_step();
if (tet_ptr != this)
{
if (tet_ptr->node_index( nb ) >= 0 &&
tet_ptr->node_index( nc ) >= 0)
{
adj_tet = tet_ptr;
}
}
}
return adj_tet;
}
| GeoTet * GeoTet::get_connected_tet | ( | int | face_index | ) |
Definition at line 87 of file GeoTet.cpp.
{
GeoNode *n1, *n2, *n3;
tet_face_nodes( face_indx, n1, n2, n3 );
return get_connected_tet( n1, n2, n3 );
}
| void GeoTet::inside | ( | int | is_inside | ) | [inline] |
Definition at line 72 of file GeoTet.hpp.
{ isInside = is_inside; }
| int GeoTet::inside | ( | ) | [inline] |
Definition at line 73 of file GeoTet.hpp.
{ return isInside; }
| void GeoTet::marked | ( | int | flag | ) | [inline] |
Definition at line 68 of file GeoTet.hpp.
{ isMarked = flag; }
| int GeoTet::marked | ( | ) | [inline] |
Definition at line 69 of file GeoTet.hpp.
{ return isMarked; }
| int GeoTet::node_index | ( | GeoNode * | node_ptr | ) |
Definition at line 130 of file GeoTet.cpp.
{
int ii;
for (ii=0; ii<4; ii++)
{
if (mNodes[ii] == node_ptr)
return ii;
}
return -1;
}
| void GeoTet::opposite_edge | ( | GeoNode * | a_node, |
| GeoNode * | b_node, | ||
| GeoNode *& | c_node, | ||
| GeoNode *& | d_node | ||
| ) |
Definition at line 149 of file GeoTet.cpp.
{
int ii;
c_node = d_node = NULL;
for (ii=0; ii<4; ii++)
{
if (mNodes[ii] != a_node && mNodes[ii] != b_node)
{
if (!c_node)
{
c_node = mNodes[ii];
}
else if(!d_node)
{
d_node = mNodes[ii];
}
else
{
PRINT_ERROR("a_node or b_node are not on this tet.\n");
return;
}
}
}
}
| void GeoTet::tet_face_nodes | ( | int | face_index, |
| GeoNode *& | na, | ||
| GeoNode *& | nb, | ||
| GeoNode *& | nc | ||
| ) |
Definition at line 69 of file GeoTet.cpp.
| void GeoTet::tet_nodes | ( | GeoNode *& | na, |
| GeoNode *& | nb, | ||
| GeoNode *& | nc, | ||
| GeoNode *& | nd | ||
| ) |
cBit GeoTet::isInside [private] |
Definition at line 36 of file GeoTet.hpp.
cBit GeoTet::isMarked [private] |
Definition at line 33 of file GeoTet.hpp.
GeoNode* GeoTet::mNodes[4] [private] |
Definition at line 30 of file GeoTet.hpp.