cgma
|
#include <CubitQuadFacet.hpp>
Public Member Functions | |
CubitQuadFacet () | |
virtual | ~CubitQuadFacet () |
virtual int | tri_to_quad_index (int tri_index, int pt_index)=0 |
virtual CubitFacet * | get_tri_facet (int index)=0 |
virtual CubitFacet * | get_tri_facet_at_point (CubitPoint *point_ptr)=0 |
virtual void | remove_tri_facets ()=0 |
virtual void | points (CubitPoint *points[4])=0 |
virtual CubitPoint * | point (int index)=0 |
virtual CubitFacetEdge * | edge (int index)=0 |
void | get_control_points (double *ctrl_pts) |
void | set_control_points (double *ctrl_pts) |
CubitStatus | evaluate (double u, double v, CubitVector *eval_point, CubitVector *eval_normal=NULL, CubitVector *eval_du=NULL, CubitVector *eval_dv=NULL) |
virtual void | debug_draw (int color=-1, int flush_it=1, int draw_uv=0) |
virtual void | get_parents (DLIList< FacetEntity * > &) |
virtual void | points (DLIList< CubitPoint * > &point_list) |
virtual void | facets (DLIList< CubitFacet * > &facet_list) |
virtual void | edges (DLIList< CubitFacetEdge * > &edge_list) |
CubitStatus | init_patch () |
Private Member Functions | |
void | map_to_tri_system (double u, double v, int &tri_index, double &A, double &B, double &C) |
CubitStatus | eval_derivatives (double u, double v, CubitVector &point, CubitVector &du, CubitVector &dv) |
Definition at line 10 of file CubitQuadFacet.hpp.
Definition at line 22 of file CubitQuadFacet.cpp.
{ }
CubitQuadFacet::~CubitQuadFacet | ( | ) | [virtual] |
Definition at line 32 of file CubitQuadFacet.cpp.
{ }
void CubitQuadFacet::debug_draw | ( | int | color = -1 , |
int | flush_it = 1 , |
||
int | draw_uv = 0 |
||
) | [virtual] |
Implements FacetEntity.
Definition at line 159 of file CubitQuadFacet.cpp.
{ CubitFacet *tri_facet = get_tri_facet( 0 ); tri_facet->debug_draw(color, flush_it, draw_uv); tri_facet = get_tri_facet( 1 ); tri_facet->debug_draw(color, flush_it, draw_uv); }
virtual CubitFacetEdge* CubitQuadFacet::edge | ( | int | index | ) | [pure virtual] |
Implemented in CubitQuadFacetData.
void CubitQuadFacet::edges | ( | DLIList< CubitFacetEdge * > & | edge_list | ) | [virtual] |
Implements FacetEntity.
Definition at line 341 of file CubitQuadFacet.cpp.
{ for ( int i = 0; i < 4; i++ ) edge_list.append(this->edge(i)); }
CubitStatus CubitQuadFacet::eval_derivatives | ( | double | u, |
double | v, | ||
CubitVector & | point, | ||
CubitVector & | du, | ||
CubitVector & | dv | ||
) | [private] |
Definition at line 96 of file CubitQuadFacet.cpp.
{ // do a forward, backward or central difference depending on where the // u, v is located on the quad CubitStatus stat = CUBIT_SUCCESS; double incr = 0.001; double min = -1.0; double max = 1.0; double uf, vf, ub, vb; CubitVector pf, pb; if (u < min + incr) { uf = u + incr; stat = evaluate(uf, v, &pf); du = ( pf - point ) / incr; } else if (u > max - incr) { ub = u - incr; stat = evaluate( ub, v, &pb); du = ( point - pb ) / incr; } else { uf = u + incr; ub = u - incr; stat = evaluate( uf, v, &pf ); stat = evaluate( ub, v, &pb ); du = ( pf - pb ) / (2.0 * incr); } if (v < min + incr) { vf = v + incr; stat = evaluate(u, vf, &pf); dv = ( pf - point ) / incr; } else if (v > max - incr) { vb = v - incr; stat = evaluate( u, vb, &pb); dv = ( point - pb ) / incr; } else { vf = v + incr; vb = v - incr; stat = evaluate( u, vf, &pf ); stat = evaluate( u, vb, &pb ); dv = ( pf - pb ) / (2.0 * incr); } return stat; }
CubitStatus CubitQuadFacet::evaluate | ( | double | u, |
double | v, | ||
CubitVector * | eval_point, | ||
CubitVector * | eval_normal = NULL , |
||
CubitVector * | eval_du = NULL , |
||
CubitVector * | eval_dv = NULL |
||
) |
Definition at line 54 of file CubitQuadFacet.cpp.
{ CubitVector normal; CubitStatus stat = CUBIT_SUCCESS; int tri_index; double A, B, C; map_to_tri_system( u, v, tri_index, A, B, C ); CubitVector ac(A,B,C); CubitFacet *tri_facet = get_tri_facet( tri_index ); CubitVector point; stat = tri_facet->evaluate( ac, &point, eval_normal ); if (!stat) return stat; if (eval_point != NULL) *eval_point = point; if (eval_du != NULL || eval_dv != NULL) { CubitVector du, dv; stat = eval_derivatives( u, v, point, du, dv ); normal = du * dv; normal.normalize(); if (eval_du != NULL) *eval_du = du; if (eval_dv != NULL) *eval_dv = dv; if (eval_normal != NULL) *eval_normal = normal; } return stat; }
void CubitQuadFacet::facets | ( | DLIList< CubitFacet * > & | facet_list | ) | [virtual] |
Implements FacetEntity.
Definition at line 328 of file CubitQuadFacet.cpp.
{ facet_list.append( this->get_tri_facet(0) ); facet_list.append( this->get_tri_facet(1) ); }
void CubitQuadFacet::get_control_points | ( | double * | ctrl_pts | ) |
Definition at line 243 of file CubitQuadFacet.cpp.
{ // assumes 6 control points per triangle and 3 along the diagonal edge int ii, jj; int ipt = 0; int index = 0; int numtri = 2; int num_ctrl_pts_per_tri = 6; for (ii=0; ii<numtri; ii++) { CubitFacet *tri_facet = get_tri_facet( ii ); CubitVector *tri_ctrl_pts = tri_facet->control_points(); assert(tri_ctrl_pts != NULL); for (jj=0; jj<num_ctrl_pts_per_tri; jj++) { index = ipt * 3; ctrl_pts[index] = tri_ctrl_pts[jj].x(); ctrl_pts[index+1] = tri_ctrl_pts[jj].y(); ctrl_pts[index+2] = tri_ctrl_pts[jj].z(); ipt++; } } int num_ctrl_pts_per_edge = 3; CubitVector *edge_ctrl_pts = NULL; CubitFacetEdge *edge_ptr = this->point(0)->shared_edge( this->point(2) ); assert(edge_ptr != NULL); edge_ctrl_pts = edge_ptr->control_points(); for (ii=0; ii<num_ctrl_pts_per_edge; ii++) { index = ipt * 3; ctrl_pts[index] = edge_ctrl_pts[ii].x(); ctrl_pts[index+1] = edge_ctrl_pts[ii].y(); ctrl_pts[index+2] = edge_ctrl_pts[ii].z(); ipt++; } }
virtual void CubitQuadFacet::get_parents | ( | DLIList< FacetEntity * > & | ) | [inline, virtual] |
virtual CubitFacet* CubitQuadFacet::get_tri_facet | ( | int | index | ) | [pure virtual] |
Implemented in CubitQuadFacetData.
virtual CubitFacet* CubitQuadFacet::get_tri_facet_at_point | ( | CubitPoint * | point_ptr | ) | [pure virtual] |
Implemented in CubitQuadFacetData.
Definition at line 355 of file CubitQuadFacet.cpp.
{ // compute control point for the internal diagonal edge CubitFacetEdge *edge_ptr = this->point(0)->shared_edge( this->point(2) ); assert(edge_ptr != NULL); CubitPoint *pt0 = edge_ptr->point(0); CubitPoint *pt1 = edge_ptr->point(1); CubitVector P0 = pt0->coordinates(); CubitVector P1 = pt1->coordinates(); CubitVector N0 = pt0->normal( edge_ptr ); CubitVector N1 = pt1->normal( edge_ptr ); CubitVector T0 = P1 - P0; T0.normalize(); CubitVector T1 = T0; CubitVector Pi[3]; CubitStatus stat = FacetEvalTool::init_edge_control_points( P0, P1, N0, N1, T0, T1, Pi); if (stat == CUBIT_FAILURE) return stat; edge_ptr->control_points( Pi, 4 ); // compute control points on the triangles stat = this->get_tri_facet(0)->init_patch(); if (stat != CUBIT_FAILURE) stat = this->get_tri_facet(1)->init_patch(); return stat; }
void CubitQuadFacet::map_to_tri_system | ( | double | u, |
double | v, | ||
int & | tri_index, | ||
double & | A, | ||
double & | B, | ||
double & | C | ||
) | [private] |
Definition at line 173 of file CubitQuadFacet.cpp.
{ double trivert[3][2]; double areacoords[2][3]; int ii, jj, j0, j1; double small_ac[2]; small_ac[0] = small_ac[1] = 1.0; // loop through both tris for (ii=0; ii<2; ii++) { // set up the (u,v) vertex coordinates for the tri for (jj=0; jj<3; jj++) { switch(tri_to_quad_index(ii,jj)) { case 0: trivert[jj][0] = -1.0; trivert[jj][1] = -1.0; break; case 1: trivert[jj][0] = 1.0; trivert[jj][1] = -1.0; break; case 2: trivert[jj][0] = 1.0; trivert[jj][1] = 1.0; break; case 3: trivert[jj][0] = -1.0; trivert[jj][1] = 1.0; break; } } // compute the area coordinates for (jj=0; jj<3; jj++) { j0 = (jj+1)%3; j1 = (jj+2)%3; areacoords[ii][jj] = DETERM( trivert[j0][0], trivert[j0][1], trivert[j1][0], trivert[j1][1], u, v ); if (small_ac[ii] > areacoords[ii][jj]) { small_ac[ii] = areacoords[ii][jj]; } } } tri_index = (small_ac[0] > small_ac[1]) ? 0 : 1; A = areacoords[tri_index][0]; B = areacoords[tri_index][1]; C = areacoords[tri_index][2]; double sum = A + B + C; A /= sum; B /= sum; C /= sum; }
virtual CubitPoint* CubitQuadFacet::point | ( | int | index | ) | [pure virtual] |
Implemented in CubitQuadFacetData.
virtual void CubitQuadFacet::points | ( | CubitPoint * | points[4] | ) | [pure virtual] |
Implemented in CubitQuadFacetData.
void CubitQuadFacet::points | ( | DLIList< CubitPoint * > & | point_list | ) | [virtual] |
Implements FacetEntity.
Reimplemented in CubitQuadFacetData.
Definition at line 315 of file CubitQuadFacet.cpp.
{ for ( int i = 0; i < 4; i++ ) point_list.append(this->point(i)); }
virtual void CubitQuadFacet::remove_tri_facets | ( | ) | [pure virtual] |
Implemented in CubitQuadFacetData.
void CubitQuadFacet::set_control_points | ( | double * | ctrl_pts | ) |
Definition at line 288 of file CubitQuadFacet.cpp.
{ // assumes 6 control points per triangle and 3 along the diagonal edge int ii; int index = 0; int numtri = 2; int num_ctrl_pts_per_tri = 6; for (ii=0; ii<numtri; ii++) { CubitFacet *tri_facet = get_tri_facet( ii ); index = 3 * ii * num_ctrl_pts_per_tri; tri_facet->set_control_points( &(ctrl_pts[index]) ); } CubitFacetEdge *edge_ptr = this->point(0)->shared_edge( this->point(2) ); assert(edge_ptr != NULL); index = 3 * numtri * num_ctrl_pts_per_tri; edge_ptr->set_control_points( &(ctrl_pts[index]) ); }
virtual int CubitQuadFacet::tri_to_quad_index | ( | int | tri_index, |
int | pt_index | ||
) | [pure virtual] |
Implemented in CubitQuadFacetData.