cgma
|
#include <ChollaCurve.hpp>
Definition at line 27 of file ChollaCurve.hpp.
ChollaCurve::ChollaCurve | ( | int | block_id | ) |
Definition at line 29 of file ChollaCurve.cpp.
{ static int count = 1; id = count++; myCurve = NULL; myEvalTool = NULL; startPoint = NULL; endPoint = NULL; blockID = block_id; myLength = MYLENGTH_UNINITIALIZED; myMergePartner = NULL; }
Definition at line 45 of file ChollaCurve.cpp.
{ }
void ChollaCurve::add_facet | ( | FacetEntity * | exterior_edge | ) | [inline] |
Definition at line 66 of file ChollaCurve.hpp.
{myLength = MYLENGTH_UNINITIALIZED; curveEdgeList.append(exterior_edge);}
int ChollaCurve::add_facet_unique | ( | FacetEntity * | exterior_edge | ) | [inline] |
Definition at line 71 of file ChollaCurve.hpp.
{myLength = MYLENGTH_UNINITIALIZED; return curveEdgeList.append_unique(exterior_edge);}
void ChollaCurve::add_point | ( | ChollaPoint * | fpm_ptr | ) | [inline] |
Definition at line 120 of file ChollaCurve.hpp.
{pointList.append_unique( fpm_ptr );}
void ChollaCurve::add_surface | ( | ChollaSurface * | fsm_ptr | ) | [inline] |
Definition at line 103 of file ChollaCurve.hpp.
{surfaceList.append_unique( fsm_ptr );}
bool ChollaCurve::adj_facet_edges | ( | CubitPoint * | cubit_pnt, |
CubitFacetEdge *& | adj_edge1, | ||
CubitFacetEdge *& | adj_edge2 | ||
) |
Definition at line 528 of file ChollaCurve.cpp.
{ // initialize adj_edge1 and adj_edge2 adj_edge1 = adj_edge2 = NULL; DLIList<CubitFacetEdge*> node_edge_list; node_ptr->edges( node_edge_list ); DLIList<CubitFacetEdge*> curve_edge_list; CAST_LIST(curveEdgeList, curve_edge_list, CubitFacetEdge); curve_edge_list.intersect(node_edge_list); assert(curve_edge_list.size() < 3); if (0 == curve_edge_list.size()) return false; curve_edge_list.reset(); adj_edge1 = curve_edge_list.get(); if (curve_edge_list.size() > 1) adj_edge2 = curve_edge_list.next(); return true; }
void ChollaCurve::assign_eval_tool | ( | CurveFacetEvalTool * | curv_eval_tool | ) | [inline] |
Definition at line 150 of file ChollaCurve.hpp.
{myEvalTool = curv_eval_tool;}
void ChollaCurve::assign_geometric_curve | ( | void * | curv | ) | [inline] |
Definition at line 141 of file ChollaCurve.hpp.
{myCurve = curv;}
Definition at line 699 of file ChollaCurve.cpp.
{ //debug this function as point list is not valid if( this->get_eval_tool() ) { assert(false); //WARNING: Curve facet eval tool already exist! } CurveFacetEvalTool *curv_eval_tool_ptr = new CurveFacetEvalTool(); // Step 1: Initialize facet_edge_list and point_list CubitStatus stat; DLIList<CubitPoint *> point_list; int i; // insert start point of every facet_edge curveEdgeList.reset(); for( i = 0; i < curveEdgeList.size(); i++ ) { point_list.append( CAST_TO( curveEdgeList.get_and_step(), CubitFacetEdge )->point(0) ); } // insert end point of last facet_edge curveEdgeList.step( curveEdgeList.size() - 1 ); point_list.append( CAST_TO( curveEdgeList.get(), CubitFacetEdge )->point(1) ); DLIList<CubitFacetEdge *> edge_list; CAST_LIST( curveEdgeList, edge_list, CubitFacetEdge ); stat = curv_eval_tool_ptr->initialize( edge_list, point_list ); if( stat != CUBIT_SUCCESS ) { return stat; } /* // Step 2: find sense of curve_facet_eval_tool /// this is done internally in next Step in initialize() if( this->startPoint ) { stat = curv_eval_tool_ptr->find_curv_sense( this->startPoint ); if( stat != CUBIT_SUCCESS ) { return stat; } } */ // Step 2: Initialize adj_surface_facet_eval_tool with orientation_wrt_surface if( surfaceList.size() ) { CubitSense orientation_wrt_surface; if( CUBIT_SUCCESS == ChollaEngine::determine_curve_orientation( surfaceList.get(), this, orientation_wrt_surface ) ) { if( this->startPoint && this->endPoint ) { stat = curv_eval_tool_ptr->initialize( surfaceList.get()->get_eval_tool(), this->startPoint, this->endPoint, orientation_wrt_surface); } } else { assert(false); } if( stat != CUBIT_SUCCESS ) { assert( false ); return stat; } } else { assert(false); //WARNING: No adjacent cholla surface available } // Step 4: assign the new curv_eval_tool to cholla_curve assign_eval_tool( curv_eval_tool_ptr ); return stat; }
CubitStatus ChollaCurve::build_curve_from_edges | ( | CubitPoint * | start_point, |
int | periodic, | ||
int | max_edges, | ||
CubitFacetEdge * | start_edge_ptr, | ||
ChollaCurve * | parent_curve | ||
) |
Definition at line 266 of file ChollaCurve.cpp.
{ // find the first edge. Match the chollacurve owner with this curve // do this only if the start_edge_ptr was not passed in DLIList<CubitFacetEdge *> point_edge_list; start_point->edges(point_edge_list); CubitFacetEdge *edge_ptr; if (start_edge_ptr == NULL) { for (int ii=0; ii<point_edge_list.size() && !start_edge_ptr; ii++) { edge_ptr = point_edge_list.get_and_step(); TDGeomFacet *td_geom = TDGeomFacet::get_geom_facet( edge_ptr ); // assumes that the TDGeomFacet info has already been set up for the edges assert(td_geom != NULL); DLIList<ChollaCurve *> cholla_curves; td_geom->get_cholla_curves(cholla_curves); // currently should be only one-to-one relationship // could also be edge on surface in which case no curves associated assert(cholla_curves.size() <= 1); if (cholla_curves.size()) { if (cholla_curves.get() == this) start_edge_ptr = edge_ptr; } } assert(start_edge_ptr != NULL); // didn't find an edge that marched this chollacurve } // create a new curve to hold the edge info this->set_start( start_point ); start_point->set_as_feature(); this->add_facet( start_edge_ptr ); int iedgecount = 0; edge_ptr = start_edge_ptr; CubitPoint *point0_ptr = start_point, *point1_ptr; CubitPoint *end_point = NULL; while(!end_point) { point1_ptr = edge_ptr->other_point( point0_ptr ); if ((edge_ptr = parent_curve->next_edge( point1_ptr, edge_ptr )) == NULL) { end_point = point1_ptr; } else { iedgecount++; if (iedgecount > max_edges) { PRINT_ERROR("ChollaCurve has start, but no end\n"); return CUBIT_FAILURE; } this->add_facet( edge_ptr ); if (periodic && point1_ptr == start_point) end_point = start_point; point0_ptr = point1_ptr; } } this->set_end( end_point ); end_point->set_as_feature(); // make sure all the edges are oriented correctly int i; DLIList<FacetEntity *> flist = this->get_facet_list(); flist.reset(); DLIList<CubitFacetEdge *> elist; CAST_LIST( flist, elist, CubitFacetEdge ); elist.reset(); CubitPoint *cur_pt = start_point, *tmp_pt; for ( i = elist.size(); i > 0; i-- ) { edge_ptr = elist.get_and_step(); point0_ptr = edge_ptr->point(0); point1_ptr = edge_ptr->point(1); if (point0_ptr != cur_pt) { assert( cur_pt == point1_ptr ); edge_ptr->flip(); tmp_pt = point0_ptr; point0_ptr = point1_ptr; point1_ptr = tmp_pt; assert( point0_ptr == edge_ptr->point(0) && point1_ptr == edge_ptr->point(1) ); } cur_pt = point1_ptr; } int mydebug = 0; if (mydebug) { int i; DLIList<FacetEntity *> flist = this->get_facet_list(); flist.reset(); DLIList<CubitFacetEdge *> elist; CAST_LIST( flist, elist, CubitFacetEdge ); elist.reset(); for ( i = elist.size(); i > 0; i-- ) { CubitFacetEdge *edge = elist.get_and_step(); CubitVector pt0_v = edge->point(0)->coordinates(); CubitVector pt1_v = edge->point(1)->coordinates(); GfxDebug::draw_point(pt0_v, CUBIT_GREEN_INDEX ); GfxDebug::draw_point(pt1_v, CUBIT_RED_INDEX ); GfxDebug::draw_line( pt0_v, pt1_v, CUBIT_YELLOW_INDEX ); GfxDebug::flush(); int view = 0; if (view) dview(); } } return CUBIT_SUCCESS; }
void ChollaCurve::clean_out_edges | ( | ) | [inline] |
Definition at line 214 of file ChollaCurve.hpp.
{ curveEdgeList.clean_out(); }
void ChollaCurve::debug_draw | ( | ) |
Definition at line 892 of file ChollaCurve.cpp.
CubitStatus ChollaCurve::determine_ends | ( | ) | [private] |
Definition at line 625 of file ChollaCurve.cpp.
{ int ii, jj, kk, inode; CubitFacetEdge *edge_ptr; CubitPoint *node0_ptr, *node1_ptr, *node_ptr; startPoint = endPoint = NULL; int done = 0; for(ii=0; ii<curveEdgeList.size() && !done; ii++) { edge_ptr = (CubitFacetEdge *)curveEdgeList.get_and_step(); node0_ptr = edge_ptr->point(0); node1_ptr = edge_ptr->point(1); for (inode=0; inode<2 && !done; inode++) { node_ptr = (inode==0) ? node0_ptr : node1_ptr; DLIList<CubitFacetEdge*> edge_list; node_ptr->edges( edge_list ); for (jj=0; jj<edge_list.size() && !done; jj++) { CubitFacetEdge *node_edge_ptr = edge_list.get_and_step(); if (node_edge_ptr != edge_ptr) { TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(node_edge_ptr); if (td_gm_edge != NULL) { int found = 0; DLIList<ChollaCurve*> fcurve_list; td_gm_edge->get_cholla_curves( fcurve_list ); for (kk=0; kk<fcurve_list.size() && !found; kk++) { ChollaCurve *fcm_ptr = fcurve_list.get_and_step(); if (fcm_ptr == this) found = 1; } if (!found) { if (startPoint == NULL) { startPoint = node_ptr; } else { endPoint = node_ptr; done = 1; } } } } } } } // check for periodic condition - just choose an arbitrary node to serve as // both start and end of the curve if (startPoint == NULL && endPoint == NULL) { curveEdgeList.reset(); edge_ptr = (CubitFacetEdge *)curveEdgeList.get(); node_ptr = edge_ptr->point(0); startPoint = node_ptr; endPoint = node_ptr; } else if ( ( startPoint == NULL && endPoint != NULL ) || ( startPoint != NULL && endPoint == NULL ) ) { PRINT_ERROR("Could not determine start and end of curve in ChollaCurve\n"); return CUBIT_FAILURE; } return CUBIT_SUCCESS; }
Definition at line 921 of file ChollaCurve.cpp.
{ /* if( startPoint ) { startPoint->remove_curve( this ); startPoint = NULL; } if( endPoint ) { endPoint->remove_curve( this ); endPoint = NULL; } */ int i; for( i = 0; i < pointList.size(); i++ ) { pointList.get_and_step()->remove_curve( this ); } pointList.clean_out(); return CUBIT_SUCCESS; }
Definition at line 948 of file ChollaCurve.cpp.
{ int i; for( i = 0; i < surfaceList.size(); i++ ) { surfaceList.get_and_step()->remove_curve( this ); } surfaceList.clean_out(); return CUBIT_SUCCESS; }
CubitStatus ChollaCurve::feature_angle | ( | double | min_dot | ) |
Definition at line 787 of file ChollaCurve.cpp.
{ // first compute all of the edge vector and store with the edge tooldata int ii, jj; FacetEntity *facet_ptr; CubitFacetEdge *edge_ptr; CubitPoint *start_node; CubitPoint *end_node; CubitVector tangent; TDGeomFacet *td_gm; for (ii=0; ii<curveEdgeList.size(); ii++) { // compute the tangent vector of the edge and store it with its tooldata facet_ptr = curveEdgeList.get_and_step(); edge_ptr = CAST_TO( facet_ptr, CubitFacetEdge ); start_node = edge_ptr->point(0); end_node = edge_ptr->point(1); tangent = end_node->coordinates() - start_node->coordinates(); tangent.normalize(); td_gm = TDGeomFacet::get_geom_facet( edge_ptr ); td_gm->set_normal( tangent ); // initialize the nodes tooldata hit flags - set them all to -1 td_gm = TDGeomFacet::get_geom_facet(start_node); td_gm->set_hit_flag(-1); td_gm = TDGeomFacet::get_geom_facet(end_node); td_gm->set_hit_flag(-1); } // now go through them again and compute the dot product between edges CubitVector tang0; CubitVector tang1; double dot; CubitPoint *node_ptr; CubitFacetEdge *next_edge_ptr; TDGeomFacet *td_gm_node; for (ii=0; ii<curveEdgeList.size(); ii++) { facet_ptr = curveEdgeList.get_and_step(); edge_ptr = CAST_TO( facet_ptr, CubitFacetEdge ); start_node = edge_ptr->point(0); end_node = edge_ptr->point(1); for (jj=0; jj<2; jj++) { node_ptr = (jj==0) ? start_node : end_node; td_gm_node = TDGeomFacet::get_geom_facet( node_ptr ); if (td_gm_node->get_hit_flag() == -1) { next_edge_ptr = next_edge( node_ptr, edge_ptr ); if (next_edge_ptr == NULL) { td_gm_node->set_hit_flag( 1 ); node_ptr->set_as_feature(); } else { td_gm = TDGeomFacet::get_geom_facet( edge_ptr ); tang0 = td_gm->get_normal(); td_gm = TDGeomFacet::get_geom_facet( next_edge_ptr ); tang1 = td_gm->get_normal(); // change the sign of the tangent vectors if the // sense of the edges are not the same if (node_ptr == start_node) { if (node_ptr != next_edge_ptr->point(1)) tang0 = -tang0; } else { if (node_ptr != next_edge_ptr->point(0)) tang0 = -tang0; } // compute the dot product between tangemt vectors dot = tang0 % tang1; // set the hit flag if there needs to be a feature break here if (dot <= min_dot) { td_gm_node->set_hit_flag( 1 ); node_ptr->set_as_feature(); } else { td_gm_node->set_hit_flag( 0 ); } } } } } return CUBIT_SUCCESS; }
int ChollaCurve::get_block_id | ( | ) | [inline] |
Definition at line 60 of file ChollaCurve.hpp.
{ return blockID; }
CubitStatus ChollaCurve::get_ends | ( | CubitVector & | start, |
CubitVector & | end | ||
) |
Definition at line 77 of file ChollaCurve.cpp.
{ if (startPoint && endPoint) { start = startPoint->coordinates(); end = endPoint->coordinates(); } else { CubitStatus stat = determine_ends(); if (stat == CUBIT_FAILURE) return stat; start = startPoint->coordinates(); end = endPoint->coordinates(); } return CUBIT_SUCCESS; }
CubitStatus ChollaCurve::get_ends | ( | CubitPoint *& | start_ptr, |
CubitPoint *& | end_ptr | ||
) |
Definition at line 102 of file ChollaCurve.cpp.
{ if (startPoint && endPoint ) { start_ptr = startPoint; end_ptr = endPoint; } else { CubitStatus stat = determine_ends(); if (stat == CUBIT_FAILURE) return stat; start_ptr = startPoint; end_ptr = endPoint; } return CUBIT_SUCCESS; }
CurveFacetEvalTool* ChollaCurve::get_eval_tool | ( | ) | [inline] |
Definition at line 154 of file ChollaCurve.hpp.
{return myEvalTool;}
DLIList<FacetEntity*>& ChollaCurve::get_facet_list | ( | ) | [inline] |
Definition at line 91 of file ChollaCurve.hpp.
{return curveEdgeList;}
DLIList<FacetEntity*>* ChollaCurve::get_facet_list_ptr | ( | ) | [inline] |
Definition at line 94 of file ChollaCurve.hpp.
{return &curveEdgeList;}
void ChollaCurve::get_facet_points | ( | DLIList< CubitPoint * > & | point_list, |
CubitBoolean | inclusive | ||
) |
Definition at line 1037 of file ChollaCurve.cpp.
{ FacetEntity *fe_ptr; CubitFacetEdge *edge_ptr; CubitPoint *pts[2]; for (int ii=0; ii<curveEdgeList.size(); ii++) { fe_ptr = curveEdgeList.get_and_step(); edge_ptr = dynamic_cast<CubitFacetEdge *> (fe_ptr); assert(edge_ptr != NULL); for (int jj=0; jj<2; jj++) { pts[jj] = edge_ptr->point(jj); if (inclusive) { point_list.append(pts[jj]); } else { if (pts[jj] != startPoint && pts[jj] != endPoint) { point_list.append(pts[jj]); } } } } point_list.uniquify_ordered(); }
int ChollaCurve::get_flag | ( | ) | [inline] |
Definition at line 198 of file ChollaCurve.hpp.
{ return flag; }
void* ChollaCurve::get_geometric_curve | ( | ) | [inline] |
Definition at line 146 of file ChollaCurve.hpp.
{return myCurve;}
int ChollaCurve::get_id | ( | ) | [inline] |
Definition at line 200 of file ChollaCurve.hpp.
{return id;}
DLIList<ChollaPoint*>& ChollaCurve::get_points | ( | ) | [inline] |
Definition at line 128 of file ChollaCurve.hpp.
{return pointList;}
DLIList<ChollaSurface*>* ChollaCurve::get_surface_list_ptr | ( | ) | [inline] |
Definition at line 117 of file ChollaCurve.hpp.
{return &surfaceList;}
DLIList<ChollaSurface*>& ChollaCurve::get_surfaces | ( | ) | [inline] |
Definition at line 111 of file ChollaCurve.hpp.
{return surfaceList;}
void ChollaCurve::get_surfaces | ( | DLIList< ChollaSurface * > & | surf_list | ) | [inline] |
Definition at line 113 of file ChollaCurve.hpp.
{ surf_list += surfaceList; }
Definition at line 1071 of file ChollaCurve.cpp.
{ for(int ii=0; ii<pointList.size(); ii++) { ChollaPoint *pt = pointList.get_and_step(); if (pt == chpt) return CUBIT_TRUE; } return CUBIT_FALSE; }
CubitStatus ChollaCurve::insert_facet | ( | FacetEntity * | old_edge, |
FacetEntity * | new_edge | ||
) |
Definition at line 969 of file ChollaCurve.cpp.
{ curveEdgeList.move_to( old_edge ); curveEdgeList.insert( new_edge ); return CUBIT_SUCCESS; }
CubitStatus ChollaCurve::is_contain | ( | FacetEntity * | edge | ) |
Definition at line 977 of file ChollaCurve.cpp.
{ if( curveEdgeList.is_in_list( edge ) ) return CUBIT_SUCCESS; else return CUBIT_FAILURE; }
CubitBoolean ChollaCurve::is_in_surface | ( | ChollaSurface * | chsurf_ptr | ) |
Definition at line 1015 of file ChollaCurve.cpp.
{ for (int ii=0; ii<surfaceList.size(); ii++) { ChollaSurface *mysurf_ptr = surfaceList.get_and_step(); if (mysurf_ptr == chsurf_ptr) { return CUBIT_TRUE; } } return CUBIT_FALSE; }
CubitBoolean ChollaCurve::is_in_volume | ( | ChollaVolume * | chvol_ptr | ) |
Definition at line 992 of file ChollaCurve.cpp.
{ for (int ii=0; ii<surfaceList.size(); ii++) { ChollaSurface *chsurf_ptr = surfaceList.get_and_step(); DLIList<ChollaVolume *> chvol_list; chsurf_ptr->get_volumes(chvol_list); for (int jj=0; jj<chvol_list.size(); jj++) { ChollaVolume *mychvol_ptr = chvol_list.get_and_step(); if (mychvol_ptr == chvol_ptr) return CUBIT_TRUE; } } return CUBIT_FALSE; }
double ChollaCurve::length | ( | ) |
Definition at line 503 of file ChollaCurve.cpp.
{ if (myLength > MYLENGTH_UNINITIALIZED) return myLength; CubitFacetEdge *edge; FacetEntity *fent; myLength = 0.0; for (int iedge=0; iedge<curveEdgeList.size(); iedge++) { fent = curveEdgeList.get_and_step(); edge = dynamic_cast<CubitFacetEdge *> (fent); myLength += edge->length(); } return myLength; }
ChollaCurve* ChollaCurve::merge_partner | ( | ) | [inline] |
Definition at line 218 of file ChollaCurve.hpp.
{ return myMergePartner; }
CubitFacetEdge * ChollaCurve::next_edge | ( | CubitPoint * | node_ptr, |
CubitFacetEdge * | edge_ptr | ||
) | [private] |
Definition at line 561 of file ChollaCurve.cpp.
{ // check if this node has its hit flag set - we are at a feature break. TDGeomFacet *td_gm_node = TDGeomFacet::get_geom_facet(node_ptr); if (td_gm_node->get_hit_flag() == 1 || node_ptr->is_feature()) return NULL; int jj, kk; // find the next edge CubitFacetEdge *next_edge_on_curve = NULL; DLIList<CubitFacetEdge*> edge_list; node_ptr->edges( edge_list ); int num_adj_curves = 1; // keep track of the number of curves at this node for (jj=0; jj<edge_list.size(); jj++) { CubitFacetEdge *node_edge_ptr = edge_list.get_and_step(); if (node_edge_ptr != edge_ptr) { TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(node_edge_ptr); if (td_gm_edge != NULL) { DLIList<ChollaCurve*> fcurve_list; td_gm_edge->get_cholla_curves( fcurve_list ); if (fcurve_list.size() > 0) { // if 3 or more curves meet at this node, then force the curve to terminate here num_adj_curves++; if (num_adj_curves >= 3) { return NULL; } // otherwise try to match the curve to the edge to find the next edge for (kk=0; kk<fcurve_list.size(); kk++) { ChollaCurve *fcm_ptr = fcurve_list.get_and_step(); if (fcm_ptr == this) { next_edge_on_curve = node_edge_ptr; } } } } } } return next_edge_on_curve; }
int ChollaCurve::num_edges | ( | ) | [inline] |
Definition at line 100 of file ChollaCurve.hpp.
{return curveEdgeList.size();}
int ChollaCurve::num_volumes | ( | ) |
Definition at line 1098 of file ChollaCurve.cpp.
{ DLIList<ChollaVolume *> chvol_list; for (int i=0; i<surfaceList.size(); i++) { ChollaSurface *chsurf_ptr = surfaceList.get_and_step(); DLIList<ChollaVolume*> tmp_vols; chsurf_ptr->get_volumes(tmp_vols); chvol_list += tmp_vols; } chvol_list.uniquify_unordered(); return chvol_list.size(); }
Definition at line 391 of file ChollaCurve.cpp.
{ int i; bool periodic = false; if (NULL == startPoint) { DLIList<ChollaPoint *> cholla_points = get_points(); periodic = (cholla_points.size() == 1); ChollaPoint *chpt = cholla_points.get(); CubitPoint *start_point = dynamic_cast<CubitPoint *> (chpt->get_facets()); this->set_start( start_point ); if (NULL == start_point) return CUBIT_FAILURE; start_point->set_as_feature(); if (periodic) { this->set_end(start_point); } else { chpt = cholla_points.step_and_get(); CubitPoint *end_point = dynamic_cast<CubitPoint *> (chpt->get_facets()); if (NULL == end_point) return CUBIT_FAILURE; this->set_end(end_point); end_point->set_as_feature(); } } assert(startPoint); assert(endPoint); if (curveEdgeList.size() > 1) { DLIList<CubitFacetEdge*> edges_ordered; CAST_LIST(curveEdgeList, edges_ordered, CubitFacetEdge); CubitStatus stat = CubitFacetEdge::order_edge_list(edges_ordered, startPoint, endPoint); if (CUBIT_FAILURE == stat) return CUBIT_FAILURE; // store the edges in the correct order clean_out_edges(); edges_ordered.reset(); for (i=0; i< edges_ordered.size(); i++) { this->add_facet(edges_ordered.get_and_step()); } } // make sure all the edges are oriented correctly DLIList<FacetEntity *> flist = this->get_facet_list(); flist.reset(); DLIList<CubitFacetEdge *> elist; CAST_LIST( flist, elist, CubitFacetEdge ); elist.reset(); CubitPoint *cur_pt = startPoint, *tmp_pt; for ( i = elist.size(); i > 0; i-- ) { CubitFacetEdge *edge_ptr = elist.get_and_step(); CubitPoint *point0_ptr = edge_ptr->point(0); CubitPoint *point1_ptr = edge_ptr->point(1); if (point0_ptr != cur_pt) { assert( cur_pt == point1_ptr ); edge_ptr->flip(); tmp_pt = point0_ptr; point0_ptr = point1_ptr; point1_ptr = tmp_pt; assert( point0_ptr == edge_ptr->point(0) && point1_ptr == edge_ptr->point(1) ); } cur_pt = point1_ptr; } int mydebug = 0; if (mydebug) { int i; DLIList<FacetEntity *> flist = this->get_facet_list(); flist.reset(); DLIList<CubitFacetEdge *> elist; CAST_LIST( flist, elist, CubitFacetEdge ); elist.reset(); for ( i = elist.size(); i > 0; i-- ) { CubitFacetEdge *edge = elist.get_and_step(); CubitVector pt0_v = edge->point(0)->coordinates(); CubitVector pt1_v = edge->point(1)->coordinates(); GfxDebug::draw_point(pt0_v, CUBIT_GREEN_INDEX ); GfxDebug::draw_point(pt1_v, CUBIT_RED_INDEX ); GfxDebug::draw_line( pt0_v, pt1_v, CUBIT_YELLOW_INDEX ); GfxDebug::flush(); int view = 0; if (view) dview(); } } return CUBIT_SUCCESS; }
void ChollaCurve::print | ( | ) |
Definition at line 900 of file ChollaCurve.cpp.
{ FILE *fp = fopen("debug.curve", "a"); fprintf(fp,"*** Curve %d ***\n", id); for (int ii=0; ii<curveEdgeList.size(); ii++) { FacetEntity *fe_ptr = curveEdgeList.get_and_step(); CubitFacetEdge *cfe_ptr = CAST_TO(fe_ptr, CubitFacetEdge ); CubitPoint *cp0_ptr = cfe_ptr->point(0); CubitPoint *cp1_ptr = cfe_ptr->point(1); fprintf(fp," Edge (%d)\n", cfe_ptr->id() ); fprintf(fp," Point (%d) %8.4f %8.4f %8.4f\n", cp0_ptr->id(), cp0_ptr->x(), cp0_ptr->y(), cp0_ptr->z()); fprintf(fp," Point (%d) %8.4f %8.4f %8.4f\n", cp1_ptr->id(), cp1_ptr->x(), cp1_ptr->y(), cp1_ptr->z()); } fclose(fp); }
void ChollaCurve::remove_facet | ( | FacetEntity * | facet_edge | ) | [inline] |
Definition at line 76 of file ChollaCurve.hpp.
{myLength = MYLENGTH_UNINITIALIZED; curveEdgeList.remove( facet_edge ); }
void ChollaCurve::remove_point | ( | ChollaPoint * | fpm_ptr | ) | [inline] |
Definition at line 124 of file ChollaCurve.hpp.
void ChollaCurve::remove_surface | ( | ChollaSurface * | fsm_ptr | ) | [inline] |
Definition at line 107 of file ChollaCurve.hpp.
{surfaceList.remove(fsm_ptr);}
void ChollaCurve::remove_td_associativity | ( | ChollaSurface * | fsm_ptr | ) |
Definition at line 52 of file ChollaCurve.cpp.
{ int i; TDGeomFacet *td; FacetEntity *edge_ptr; for(i=0; i<curveEdgeList.size(); i++) { edge_ptr = curveEdgeList.get_and_step(); td = TDGeomFacet::get_geom_facet( edge_ptr ); if (td) { td->remove_cholla_curve( this ); td->remove_cholla_surf( fsm_ptr ); } } }
CubitStatus ChollaCurve::replace_facet | ( | FacetEntity * | remove_edge, |
FacetEntity * | replace_edge | ||
) |
Definition at line 960 of file ChollaCurve.cpp.
{ curveEdgeList.move_to( remove_edge ); curveEdgeList.insert( replace_edge ); curveEdgeList.remove( remove_edge ); myLength = MYLENGTH_UNINITIALIZED; return CUBIT_SUCCESS; }
void ChollaCurve::set_end | ( | CubitPoint * | end_pt | ) | [inline] |
Definition at line 167 of file ChollaCurve.hpp.
{ endPoint = end_pt; }
void ChollaCurve::set_flag | ( | int | flg | ) | [inline] |
Definition at line 199 of file ChollaCurve.hpp.
{ flag = flg; }
void ChollaCurve::set_merge_partner | ( | ChollaCurve * | merge_partner | ) | [inline] |
Definition at line 220 of file ChollaCurve.hpp.
{ myMergePartner = merge_partner;}
void ChollaCurve::set_start | ( | CubitPoint * | start_pt | ) | [inline] |
Definition at line 163 of file ChollaCurve.hpp.
{ startPoint = start_pt; }
CubitStatus ChollaCurve::split_curve | ( | DLIList< ChollaCurve * > & | facet_curve_list | ) |
Definition at line 128 of file ChollaCurve.cpp.
{ DLIList<ChollaCurve*> new_curve_list; // Go through the curveEdgeList and pull edges off one by one as we // determine which curve it belongs to. Continue until we have depleted // the list int periodic = 0; int start_size = curveEdgeList.size(); int icount = 0; curveEdgeList.reset(); while( curveEdgeList.size() > 0) { // First, find an edge that has a start point on it CubitFacetEdge *start_edge_ptr = (CubitFacetEdge *)curveEdgeList.get_and_step(); CubitPoint *point0_ptr = start_edge_ptr->point(0); CubitPoint *point1_ptr = start_edge_ptr->point(1); CubitPoint *start_point = NULL; if (periodic) { start_point = startPoint; } else { if (next_edge( point0_ptr, start_edge_ptr ) == NULL) start_point = point0_ptr; else if(next_edge( point1_ptr, start_edge_ptr ) == NULL) start_point = point1_ptr; } if (start_point != NULL || periodic) { // create a new curve to hold the edge info TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(start_edge_ptr); int block_id = (td_gm_edge == NULL) ? -1 : td_gm_edge->get_block_id(); ChollaCurve *fcm_ptr = new ChollaCurve( block_id ); new_curve_list.append( fcm_ptr ); // assign the edges to the new curve in the correct order and orientation CubitStatus rv = fcm_ptr->build_curve_from_edges( start_point, periodic, start_size, start_edge_ptr, this ); if (rv != CUBIT_SUCCESS) return rv; // remove the edges in the new curve from this curve int ii; DLIList<FacetEntity *> flist = fcm_ptr->get_facet_list(); DLIList<CubitFacetEdge *> elist; CubitFacetEdge *edge_ptr; CAST_LIST( flist, elist, CubitFacetEdge ); for ( ii = elist.size(); ii > 0; ii-- ) { edge_ptr = elist.get_and_step(); curveEdgeList.remove( edge_ptr ); } start_size = curveEdgeList.size(); icount = 0; periodic = 0; } // if we have gone through all of the edges without finding an end, // then we have a periodic curve. Choose an arbirary node to act as // the beginning and end if (curveEdgeList.size() > 0) { icount++; if (icount > start_size) { curveEdgeList.reset(); CubitFacetEdge *edge = (CubitFacetEdge *)curveEdgeList.get(); CubitPoint *point_ptr = edge->point(0); startPoint = point_ptr; endPoint = point_ptr; periodic = 1; } } } // add the new curves to the global curve list int ii, jj; for (ii=new_curve_list.size(); ii>0; ii--) { ChollaCurve *fcm_ptr = new_curve_list.get_and_step(); facet_curve_list.append( fcm_ptr ); // update the surface info for (jj=surfaceList.size(); jj>0; jj--) { ChollaSurface *fsm_ptr = surfaceList.get_and_step(); fcm_ptr->add_surface( fsm_ptr ); fsm_ptr->remove_curve( this ); fsm_ptr->add_curve( fcm_ptr ); } // update the geometric curve pointer fcm_ptr->assign_geometric_curve( NULL ); // update the curve pointers in the edge tool data DLIList<FacetEntity*> facet_list = fcm_ptr->get_facet_list(); for (jj=facet_list.size(); jj > 0; jj--) { FacetEntity *edge_ptr = facet_list.get_and_step(); TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr); td_gm_edge->remove_cholla_curve( this ); td_gm_edge->add_cholla_curve( fcm_ptr ); } } return CUBIT_SUCCESS; }
Definition at line 1087 of file ChollaCurve.cpp.
{ for(int ii=0; ii<pointList.size(); ii++) { ChollaPoint *pt = pointList.get_and_step(); if (!pt->is_in_curve(this)) return CUBIT_FAILURE; } return CUBIT_SUCCESS; }
int ChollaCurve::blockID [private] |
Definition at line 39 of file ChollaCurve.hpp.
DLIList<FacetEntity*> ChollaCurve::curveEdgeList [private] |
Definition at line 32 of file ChollaCurve.hpp.
CubitPoint* ChollaCurve::endPoint [private] |
Definition at line 36 of file ChollaCurve.hpp.
int ChollaCurve::flag [private] |
Definition at line 38 of file ChollaCurve.hpp.
int ChollaCurve::id [private] |
Definition at line 40 of file ChollaCurve.hpp.
void* ChollaCurve::myCurve [private] |
Definition at line 33 of file ChollaCurve.hpp.
CurveFacetEvalTool* ChollaCurve::myEvalTool [private] |
Definition at line 34 of file ChollaCurve.hpp.
double ChollaCurve::myLength [private] |
Definition at line 41 of file ChollaCurve.hpp.
ChollaCurve* ChollaCurve::myMergePartner [private] |
Definition at line 42 of file ChollaCurve.hpp.
DLIList<ChollaPoint*> ChollaCurve::pointList [private] |
Definition at line 37 of file ChollaCurve.hpp.
CubitPoint* ChollaCurve::startPoint [private] |
Definition at line 35 of file ChollaCurve.hpp.
DLIList<ChollaSurface*> ChollaCurve::surfaceList [private] |
Definition at line 31 of file ChollaCurve.hpp.