cgma
ChollaSurface.cpp
Go to the documentation of this file.
00001 //- Class:       ChollaSurface
00002 //- Description: Temporary class for constructing the facet-based geometry
00003 //-              
00004 //- Owner:       Steven J. Owen
00005 //- Checked by:
00006 //- Version:
00007 #include "ChollaSurface.hpp"
00008 #include "ChollaCurve.hpp"
00009 #include "ChollaPoint.hpp"
00010 #include "TDGeomFacet.hpp"
00011 #include "CastTo.hpp"
00012 #include "CubitPoint.hpp"
00013 #include "CubitFacet.hpp"
00014 #include "CubitFacetData.hpp"
00015 #include "CubitFacetEdge.hpp"
00016 #include "CubitPointData.hpp"
00017 #include "CubitFacetEdgeData.hpp"
00018 #include "ChollaDebug.hpp"
00019 #include "TDFacetBoundaryPoint.hpp"
00020 #include "TDFacetBoundaryEdge.hpp"
00021 #include "GfxDebug.hpp"
00022 #include "FacetEvalTool.hpp"
00023 #include "FacetDataUtil.hpp"
00024 
00025 //===============================================================================
00026 //Function:  ChollaSurface (PUBLIC) (constructor)
00027 //===============================================================================
00028 ChollaSurface::ChollaSurface(int block_id)
00029 {
00030   static int count = 100;
00031   id = count++;
00032   myFlag = CUBIT_FALSE;
00033   mySurface = NULL;
00034   myEvalTool = NULL;
00035   blockId = block_id;
00036   myMergePartner = NULL;
00037 }
00038 //===============================================================================
00039 //Function:  ~ChollaSurface (PUBLIC) (destructor)
00040 //===============================================================================
00041 ChollaSurface::~ChollaSurface()
00042 {
00043 }
00044 
00045 //===========================================================================
00046 //Function Name: check_faceting
00047 //
00048 //Member Type:  PRIVATE
00049 //Descriptoin:  check the edge/face orientations  
00050 //===========================================================================
00051 void ChollaSurface::check_faceting()
00052 {
00053 
00054 }
00055 
00056 
00057 //=============================================================================
00058 //Function:  split_surface (PUBLIC)
00059 //Description: split this surface into multiple ChollaSurface where there are
00060 //             discontinuous faces.  
00061 //Author: sjowen
00062 //Date: 12/22/00
00063 //=============================================================================
00064 CubitStatus ChollaSurface::split_surface( 
00065   DLIList<ChollaSurface*> &facet_surface_list 
00066   )
00067 {
00068   DLIList<ChollaSurface*> new_surface_list;
00069   CubitStatus stat = CUBIT_SUCCESS;
00070 
00071   // Go through the surfaceElemList and pull faces off one by one as we
00072   // determine which surface it belongs to.  Continue until we have depleted
00073   // the list
00074 
00075   int jj;
00076   int mydebug = 0;
00077   int num_surfs_created = 0;
00078   while( surfaceElemList.size() > 0)
00079   {
00080 
00081     // start with the first face and create a list of all elements 
00082     // attached to the face
00083 
00084     DLIList<FacetEntity*> face_list;
00085     FacetEntity *start_face_ptr = surfaceElemList.get_and_step();
00086     stat = get_adj_facets( start_face_ptr, face_list, mydebug );
00087     if (stat != CUBIT_SUCCESS)
00088       return stat;
00089 
00090     // if we have the same number of faces on the face_list as we do
00091     // on the surfaceElemList, then we are done.  This surface is
00092     // not multiply connected.  Oherwise continue...
00093 
00094     if (face_list.size() == surfaceElemList.size())
00095     {
00096 
00097       // if this surface had a curve already defined (its a 2D topology
00098       // defined in skin2D) then its no longer valid if the surface was split
00099       // (for 3D the curves aren't defined until later)
00100 
00101       if (num_surfs_created > 0 && curveList.size() > 0)
00102       {
00103         ChollaCurve *fcm_ptr = curveList.get();  // there should only be 1
00104         curveList.remove();
00105         fcm_ptr->remove_td_associativity( this );
00106         delete fcm_ptr;
00107       }
00108       return CUBIT_SUCCESS;
00109     }
00110 
00111     // create a new surface to hold the face info
00112 
00113     num_surfs_created++;
00114     ChollaSurface *fsm_ptr = new ChollaSurface( blockId );
00115     facet_surface_list.append( fsm_ptr );
00116 
00117     // update the geometric curve pointer
00118 
00119     fsm_ptr->assign_geometric_surface( NULL );
00120 
00121     // add the faces to this surface and update the surface 
00122     // pointers in the face tool data
00123 
00124       // surfaceElemList: nullify the items then compress the list
00125       // afterwards, instead of removing the items one by one, for
00126       // speed.
00127     for (jj=face_list.size(); jj > 0; jj--)
00128     {
00129       FacetEntity *face_ptr = face_list.get_and_step();
00130       TDGeomFacet *td_gm_face = TDGeomFacet::get_geom_facet(face_ptr); 
00131       td_gm_face->remove_cholla_surf( this );
00132       td_gm_face->add_cholla_surf( fsm_ptr );
00133       surfaceElemList.move_to_nearby( face_ptr );
00134       surfaceElemList.extract();
00135       fsm_ptr->add_facet( face_ptr );
00136     }
00137   }
00138 
00139   return CUBIT_SUCCESS;
00140 }
00141 
00142 
00143 #if 0
00144 //=============================================================================
00145 //Function:  get_adj_facets (PRIVATE)
00146 //Description: recursive funstion that creates a list of all faces connected
00147 //             the passed in face  
00148 //Author: sjowen
00149 //Date: 12/22/00
00150 //=============================================================================
00151 CubitStatus ChollaSurface::get_adj_facets( 
00152   FacetEntity *start_face_ptr,
00153   DLIList<FacetEntity*> &face_list,
00154   int mydebug)
00155 {
00156   CubitStatus stat = CUBIT_SUCCESS;
00157 
00158   // add this face to the list
00159 
00160   if (mydebug)
00161   {
00162     //start_face_ptr->draw( CUBIT_RED_INDEX );
00163     //CDrawingTool::instance()->flush();
00164   }
00165   face_list.append( start_face_ptr );
00166   TDGeomFacet *td_gm_face = TDGeomFacet::get_geom_facet(start_face_ptr);
00167   td_gm_face->set_hit_flag( 0 );
00168 
00169   // loop through its edges
00170 
00171   CubitFacetEdge *edge_ptr;
00172   FacetEntity *face_ptr;
00173   DLIList<CubitFacetEdge*> edge_list;
00174   start_face_ptr->edges( edge_list );
00175   int ii;
00176   for (ii=0; ii<edge_list.size(); ii++)
00177   {
00178     edge_ptr = edge_list.get_and_step();
00179     
00180     // edges that already have a tool data defined are the result
00181     // of a feature angle.  Don't traverse past a feature angle edge
00182     
00183     TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00184     if (td_gm_edge == NULL)
00185     {
00186       DLIList<FacetEntity*> adj_face_list;
00187       edge_ptr->get_parents( adj_face_list );
00188 
00189       // keep traversing only if there are two adjacent faces to this edge,
00190       // otherwise, this is a boundary
00191 
00192       if (adj_face_list.size() == 2)
00193       {
00194         face_ptr = adj_face_list.get_and_step();
00195         if (face_ptr == start_face_ptr)
00196           face_ptr = adj_face_list.get();
00197 
00198         // go to its neighbor if it is part of the surface
00199 
00200         td_gm_face = TDGeomFacet::get_geom_facet(face_ptr); 
00201         if (td_gm_face->get_hit_flag() == id)
00202         {
00203           stat = get_adj_facets( face_ptr, face_list, mydebug );
00204           if (stat != CUBIT_SUCCESS)
00205             return stat;
00206         }
00207       }
00208     }
00209   }
00210   return stat;
00211 }
00212 #endif
00213 
00214 //=============================================================================
00215 //Function:  get_adj_facets (PRIVATE)
00216 //Description: non recursive function that creates a list of all facets connected
00217 //             to the passed in facet  
00218 //Author: sjowen
00219 //Date: 12/22/00
00220 //=============================================================================
00221 CubitStatus ChollaSurface::get_adj_facets( 
00222   FacetEntity *start_face_ptr,
00223   DLIList<FacetEntity*> &face_list,
00224   int mydebug,
00225   bool bound_check,
00226   bool feature_edge_check)
00227 {
00228   //int found = 0;
00229   int ii;
00230   CubitStatus stat = CUBIT_SUCCESS;
00231   DLIList<FacetEntity*> temp_list;
00232   FacetEntity *face_ptr = NULL;
00233   FacetEntity *adj_face_ptr = NULL;
00234   DLIList<CubitFacetEdge *>edge_list;
00235   CubitFacetEdge *edge_ptr = NULL;
00236   DLIList<FacetEntity *>adj_face_list;
00237 
00238   if (mydebug)
00239   {
00240     for(ii=0; ii<surfaceElemList.size(); ii++)
00241     {
00242       face_ptr = surfaceElemList.get_and_step();
00243       TDGeomFacet *td_gm_face = TDGeomFacet::get_geom_facet(face_ptr);
00244       PRINT_INFO("%d ", td_gm_face->get_hit_flag());
00245       if (ii%10 == 0)
00246       {
00247         PRINT_INFO("\n");
00248       }
00249     }
00250   }
00251 
00252   // add this face to the list
00253 
00254   temp_list.append( start_face_ptr );
00255   TDGeomFacet *td_gm_face = TDGeomFacet::get_geom_facet(start_face_ptr);
00256   td_gm_face->set_hit_flag( 0 );
00257 
00258   while (temp_list.size())
00259   {
00260     face_ptr = temp_list.pop();
00261     td_gm_face = TDGeomFacet::get_geom_facet(face_ptr); 
00262     if (td_gm_face->get_hit_flag() == 0)
00263     {
00264       face_list.append( face_ptr );
00265       if (mydebug)
00266       {
00267         face_ptr->debug_draw( CUBIT_RED_INDEX );
00268         GfxDebug::flush();
00269       }
00270       edge_list.clean_out();
00271       face_ptr->edges( edge_list );
00272       for (ii=0; ii<edge_list.size(); ii++)
00273       {
00274         edge_ptr = edge_list.get_and_step();
00275 
00276         // edges that already have a tool data defined are the result
00277         // of a feature angle.  Don't traverse past a feature angle edge
00278     
00279         TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00280         if (td_gm_edge == NULL || !feature_edge_check )
00281         {
00282           adj_face_list.clean_out();
00283           edge_ptr->get_parents( adj_face_list );
00284 
00285           // keep traversing only if there are two adjacent faces to this edge,
00286           // otherwise, this is a boundary
00287 
00288           if (adj_face_list.size() != 2)
00289           {
00290             continue;
00291           }
00292 
00293           if( bound_check )
00294           {
00295             TDFacetBoundaryEdge *td_facet_bnd_edge = TDFacetBoundaryEdge::get_facet_boundary_edge( edge_ptr );
00296             if( td_facet_bnd_edge )
00297               continue;
00298           }
00299             
00300           adj_face_ptr = adj_face_list.get_and_step();
00301           if (adj_face_ptr == face_ptr)
00302             adj_face_ptr = adj_face_list.get();
00303 
00304           // go to its neighbor if it is part of the surface
00305 
00306           td_gm_face = TDGeomFacet::get_geom_facet(adj_face_ptr); 
00307           if (td_gm_face->get_hit_flag() == id)
00308           {
00309             temp_list.append( adj_face_ptr );
00310             td_gm_face->set_hit_flag( 0 );
00311           }
00312           
00313         }
00314       }
00315     }
00316   }
00317   return stat;
00318 }
00319 
00320 
00321 
00322 //=============================================================================
00323 //Function:  feature_angle (PRIVATE)
00324 //Description: mark all edges that exceed the specified feature angle
00325 //             min_dot is the minimum dot product between adjacent face normals
00326 //Author: sjowen
00327 //Date: 12/22/00
00328 //=============================================================================
00329 CubitStatus ChollaSurface::feature_angle( 
00330   double min_dot,
00331   DLIList<CubitFacetEdge *> &feature_edge_list)
00332 {
00333   //CubitStatus stat = CUBIT_SUCCESS;
00334   int ii, jj;
00335 
00336   // compute face normals
00337   int mydebug = 0;
00338   double dot;
00339   CubitVector face_normal, adj_face_normal;
00340   FacetEntity *face_ptr, *adj_face_ptr;
00341   TDGeomFacet *td_gm_face;
00342   CubitFacet *tri_ptr;
00343   for (ii=0; ii<surfaceElemList.size(); ii++)
00344   {
00345     face_ptr = surfaceElemList.get_and_step();
00346     td_gm_face = TDGeomFacet::get_geom_facet(face_ptr);
00347     tri_ptr = CAST_TO( face_ptr, CubitFacet );
00348     face_normal = tri_ptr->normal( );
00349     face_normal.normalize();
00350     td_gm_face->set_normal( face_normal );
00351   }
00352 
00353   // check adjacencies and compute the dot product between them
00354   // where dot product is less than the min_dot, create a tool data
00355   // on the edge
00356   
00357   if(mydebug)
00358     GfxDebug::clear();
00359   for (ii=0; ii<surfaceElemList.size(); ii++)
00360   {
00361     face_ptr = surfaceElemList.get_and_step();
00362     CubitFacet* curr_facet = CAST_TO(face_ptr, CubitFacet);
00363     CubitFacet* temp_facet = NULL;
00364     double curr_area=curr_facet->area();
00365     td_gm_face = TDGeomFacet::get_geom_facet(face_ptr);
00366     face_normal = td_gm_face->get_normal();
00367     DLIList<CubitFacetEdge*> edge_list;
00368     face_ptr->edges( edge_list );
00369     for (jj=0; jj<edge_list.size(); jj++)
00370     {
00371       CubitFacetEdge *edge_ptr = edge_list.get_and_step();
00372       TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00373       if (!td_gm_edge)
00374       {
00375         DLIList<FacetEntity*> adj_face_list;
00376         edge_ptr->get_parents( adj_face_list );
00377 
00378         // it has to be an internal edge - ignore boundaries
00379         if (adj_face_list.size() == 2)
00380         {
00381           adj_face_ptr = adj_face_list.get_and_step();
00382           
00383           if (adj_face_ptr == face_ptr)
00384             adj_face_ptr = adj_face_list.get();          
00385           td_gm_face = TDGeomFacet::get_geom_facet(adj_face_ptr);
00386 
00387           // make sure the adj face is on the same surface
00388 
00389           if (td_gm_face->get_hit_flag() == id)
00390           {
00391 
00392             // test the dot product between normals
00393 
00394             adj_face_normal = td_gm_face->get_normal();
00395             temp_facet = CAST_TO(adj_face_ptr, CubitFacet);
00396             double adj_area=temp_facet->area();
00397               //mbrewer:: ensure no NULL
00398             dot = adj_face_normal % face_normal;
00399             bool add_an_edge = true;
00400             if(mydebug){
00401               PRINT_INFO("This area %f, other %f\n",curr_area,adj_area);
00402             }
00403             if(curr_area<(1.e-10*adj_area)){
00404               DLIList<CubitFacetEdge*> edge_list_tmp;
00405               CubitFacetEdge* edge_ptr_tmp=NULL;
00406               curr_facet->edges(edge_list_tmp);
00407               double edge_length = edge_ptr->length();
00408               int k = 0;
00409               if(edge_list_tmp.size()>0)
00410                 add_an_edge=false;
00411               for(k=edge_list_tmp.size();k>0;k--){
00412                 edge_ptr_tmp=edge_list_tmp.get_and_step();
00413                 if(edge_ptr_tmp != edge_ptr &&
00414                    edge_ptr_tmp->length() > edge_length){
00415                   add_an_edge=true;
00416                 }
00417               }
00418             }
00419             if(adj_area<(1.e-10*curr_area))
00420             {
00421               DLIList<CubitFacetEdge*> edge_list_tmp;
00422               CubitFacetEdge* edge_ptr_tmp=NULL;
00423               temp_facet->edges(edge_list_tmp);
00424               double edge_length = edge_ptr->length();
00425               int k = 0;
00426               if(edge_list_tmp.size()>0)
00427                 add_an_edge=false;
00428               for(k=edge_list_tmp.size();k>0;k--){
00429                 edge_ptr_tmp=edge_list_tmp.get_and_step();
00430                 if(edge_ptr_tmp != edge_ptr &&
00431                    edge_ptr_tmp->length() > edge_length){
00432                   add_an_edge=true;
00433                 }
00434               }
00435             }
00436             if (dot <= min_dot && add_an_edge )
00437             {
00438               if(mydebug){
00439                 edge_ptr->debug_draw(CUBIT_MAGENTA_INDEX);
00440               }
00441               TDGeomFacet::add_geom_facet(edge_ptr, -1); 
00442               td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00443               edge_ptr->set_as_feature();
00444               feature_edge_list.append( edge_ptr );
00445             }
00446           }
00447         }
00448 
00449         // non-manifold edges (edges with more than 2 adj facets)
00450         // must be features
00451 
00452         else if (adj_face_list.size() > 2)
00453         {
00454           TDGeomFacet::add_geom_facet(edge_ptr, -1); 
00455           td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00456           edge_ptr->set_as_feature();
00457           feature_edge_list.append( edge_ptr );
00458         }
00459       }
00460     }
00461   }
00462   if(mydebug){
00463     GfxDebug::mouse_xforms();
00464   }
00465   return CUBIT_SUCCESS;
00466 }
00467 
00468 //=============================================================================
00469 //Function:  add_preexisting_feature_edges (PRIVATE)
00470 //Description: edges that were marked previously in function ChollaEngine::mark_features
00471 //             are added to the feature edge list
00472 //Author: sjowen
00473 //Date: 01/08
00474 //=============================================================================
00475 CubitStatus ChollaSurface::add_preexisting_feature_edges( 
00476     DLIList<CubitFacetEdge *> &feature_edge_list)
00477 {
00478     DLIList<CubitFacetEdge *> edge_list;
00479     DLIList<CubitFacet *> facet_list;
00480     CAST_LIST( surfaceElemList, facet_list, CubitFacet );
00481     FacetDataUtil::get_edges( facet_list, edge_list );
00482     int iedge;
00483     CubitFacetEdge *edge;
00484     for (iedge=0; iedge < edge_list.size(); iedge++)
00485     {
00486         edge = edge_list.get_and_step();
00487         if (edge->is_feature())
00488             feature_edge_list.append(edge);
00489     }
00490     return CUBIT_SUCCESS;
00491 }
00492     
00493 
00494 //=============================================================================
00495 //Function:  non_manifold_edges (PRIVATE)
00496 //Description: mark all edges that are non-manifold (have more than 2 adj
00497 //             facets)
00498 //Author: sjowen
00499 //Date: 5/01
00500 //=============================================================================
00501 CubitStatus ChollaSurface::non_manifold_edges( 
00502   DLIList<CubitFacetEdge *> &feature_edge_list)
00503 {
00504   //CubitStatus stat = CUBIT_SUCCESS;
00505   int ii, jj;
00506   DLIList<CubitFacetEdge*> edge_list;
00507   FacetEntity *face_ptr;
00508   for (ii=0; ii<surfaceElemList.size(); ii++)
00509   {
00510     face_ptr = surfaceElemList.get_and_step();
00511     edge_list.clean_out();
00512     face_ptr->edges( edge_list );
00513     for (jj=0; jj<edge_list.size(); jj++)
00514     {
00515       CubitFacetEdge *edge_ptr = edge_list.get_and_step();
00516       TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00517       if (!td_gm_edge)
00518       {
00519         DLIList<FacetEntity*> adj_face_list;
00520         edge_ptr->get_parents( adj_face_list );
00521 
00522         // non-manifold edges (edges with more than 2 adj facets)
00523         // must be features
00524 
00525         if (adj_face_list.size() > 2 || edge_ptr->is_feature())
00526         {
00527           TDGeomFacet::add_geom_facet(edge_ptr, -1); 
00528           td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00529           edge_ptr->set_as_feature();
00530           feature_edge_list.append( edge_ptr );
00531         }
00532       }
00533     }
00534   }
00535   return CUBIT_SUCCESS;
00536 }
00537 
00538 
00539 
00540 //=============================================================================
00541 //Function:  clean_features (PRIVATE)
00542 //Description: clean up edges that do not form complete loops as a result 
00543 //             of feature angle
00544 //Author: sjowen
00545 //Date: 12/22/00
00546 //=============================================================================
00547 CubitStatus ChollaSurface::clean_features( )
00548 {
00549   int ii, jj;
00550   for (ii=0; ii<surfaceElemList.size(); ii++)
00551   {
00552     FacetEntity *face_ptr = surfaceElemList.get_and_step();
00553     DLIList<CubitFacetEdge*> edge_list;
00554     face_ptr->edges( edge_list );
00555     for (jj=0; jj<edge_list.size(); jj++)
00556     {
00557       CubitFacetEdge *edge_ptr = edge_list.get_and_step();
00558       TDGeomFacet *td_gm_edge = TDGeomFacet::get_geom_facet(edge_ptr);
00559       if (td_gm_edge != NULL)
00560       {
00561 
00562         // make sure this edge actually forms the boundary between two surfaces
00563 
00564         DLIList<FacetEntity*> adj_face_list;
00565         edge_ptr->get_parents( adj_face_list );
00566 
00567         // it has to be an internal edge - ignore boundaries
00568 
00569         if (adj_face_list.size() == 2)
00570         {
00571           FacetEntity *adj_face_ptr = adj_face_list.get_and_step();
00572           if (adj_face_ptr == face_ptr)
00573             adj_face_ptr = adj_face_list.get();          
00574           TDGeomFacet *td_gm_adjface = TDGeomFacet::get_geom_facet(adj_face_ptr);
00575           if (td_gm_adjface != NULL)
00576           {
00577             DLIList<ChollaSurface*> surf_list;
00578             td_gm_adjface->get_cholla_surfs( surf_list );
00579             ChollaSurface *adj_surf = surf_list.get();  // must be only 1 surf
00580             if (adj_surf == this)
00581             {
00582 
00583               // the same surface is on both sides of this edge - Therefore it
00584               // does not form a complete loop.  Delete the tool data from
00585               // this edge to indicate that it is not at a boundary.
00586 
00587               edge_ptr->delete_TD( &TDGeomFacet::is_geom_facet );
00588             }
00589           }
00590         }
00591       }
00592     }
00593   }
00594   return CUBIT_SUCCESS;
00595 }
00596 
00597 //=============================================================================
00598 //Function:  init_hit_flags (PUBLIC)
00599 //Description: initialize the hit flags to the block surface id - used for 
00600 //             traversing the faces
00601 //Author: sjowen
00602 //Date: 01/22/01
00603 //=============================================================================
00604 void ChollaSurface::init_hit_flags()
00605 {
00606   int ii;
00607   for (ii=0; ii<surfaceElemList.size(); ii++)
00608   {
00609     FacetEntity *face_ptr = surfaceElemList.get_and_step();
00610     TDGeomFacet *td_gm = TDGeomFacet::get_geom_facet(face_ptr);
00611     td_gm->set_hit_flag( id );
00612   }
00613 }
00614 
00615 //=============================================================================
00616 //Function:  get_points (PUBLIC)
00617 //Description: compile a list of points on the surface 
00618 //Author: sjowen
00619 //Date: 4/01
00620 //=============================================================================
00621 void ChollaSurface::get_points( DLIList<CubitPoint *> &point_list )
00622 {
00623   int ii;
00624   CubitPoint *point[3];
00625   CubitFacet *facet;
00626   FacetEntity *facet_entity;
00627   for (ii=0; ii<surfaceElemList.size(); ii++)
00628   {
00629     facet_entity = surfaceElemList.get_and_step();
00630     facet = CAST_TO( facet_entity, CubitFacet );
00631     facet->points( point[0], point[1], point[2] );
00632     point[0]->marked(0);
00633     point[1]->marked(0);
00634     point[2]->marked(0);
00635   }
00636 
00637   int jj;
00638   for (ii=0; ii<surfaceElemList.size(); ii++)
00639   {
00640     facet_entity = surfaceElemList.get_and_step();
00641     facet = CAST_TO( facet_entity, CubitFacet );
00642     facet->points( point[0], point[1], point[2] );
00643     for (jj=0; jj<3; jj++)
00644     {
00645       if (point[jj]->marked() == 0)
00646       {
00647         point[jj]->marked(1);
00648         point_list.append(point[jj]);
00649       }
00650     }
00651   }
00652 }
00653 
00654 //=============================================================================
00655 //Function:  update_boundary_tool_data (PUBLIC)
00656 //Description: update the surface IDs on the boundary facet tooldatas
00657 //Author: sjowen
00658 //Date: 5/01
00659 //=============================================================================
00660 CubitStatus ChollaSurface::update_boundary_tool_data()
00661 {
00662   int ii, jj;
00663   CubitPoint *point_ptr;
00664   CubitFacetEdge *edge_ptr;
00665   CubitFacet *facet_ptr;
00666   FacetEntity *facet_entity;
00667 
00668   TDFacetBoundaryPoint *td_fbp;
00669   TDFacetBoundaryEdge *td_fbe;
00670   for (ii=0; ii<surfaceElemList.size(); ii++)
00671   {
00672     facet_entity = surfaceElemList.get_and_step();
00673     facet_ptr = CAST_TO( facet_entity, CubitFacet );
00674     for (jj=0; jj<3; jj++)
00675     {
00676       point_ptr = facet_ptr->point(jj);
00677       td_fbp = TDFacetBoundaryPoint::get_facet_boundary_point( point_ptr );
00678       if (td_fbp != NULL)
00679       {
00680         td_fbp->set_surf_id( facet_ptr, id );
00681       }
00682 
00683       edge_ptr = facet_ptr->edge(jj);
00684       td_fbe = TDFacetBoundaryEdge::get_facet_boundary_edge( edge_ptr );
00685       if (td_fbe != NULL)
00686       {
00687         td_fbe->set_surf_id( facet_ptr, id );
00688       }
00689     }
00690   }
00691 
00692   return CUBIT_SUCCESS;
00693 }
00694 
00695 //=============================================================================
00696 //Function:  reset_facet_flags (PUBLIC)
00697 //Description: 
00698 //Author: sjowen
00699 //Date: 6/01
00700 //=============================================================================
00701 void ChollaSurface::reset_facet_flags()
00702 {
00703   CubitFacet *facet_ptr;
00704   FacetEntity *fe_ptr;
00705   int ii;
00706   for (ii=0; ii<surfaceElemList.size(); ii++)
00707   {
00708     fe_ptr = surfaceElemList.get_and_step();
00709     facet_ptr = CAST_TO( fe_ptr, CubitFacet );
00710     facet_ptr->marked( 0 );
00711   }
00712 }
00713 
00714 //=============================================================================
00715 //Function:  is_adjacent (PUBLIC)
00716 //Description: determine if this surface is adjacent to the given surface
00717 //Author: sjowen
00718 //Date: 02/11/2004
00719 //=============================================================================
00720 CubitBoolean ChollaSurface::is_adjacent( ChollaSurface *other_surf )
00721 {
00722   DLIList<ChollaSurface *> *adjsurf_list_ptr;
00723   ChollaCurve *curv;
00724   ChollaSurface *surf;
00725   int icurv, ii;
00726   for(icurv=0; icurv< curveList.size(); icurv++)
00727   {
00728     curv = curveList.get_and_step();
00729     adjsurf_list_ptr = curv->get_surface_list_ptr();
00730     for(ii=0; ii<adjsurf_list_ptr->size(); ii++)
00731     {
00732       surf = adjsurf_list_ptr->get_and_step();
00733       if (surf != this && surf == other_surf)
00734       {
00735         return CUBIT_TRUE;
00736       }
00737     }
00738   }
00739   return CUBIT_FALSE; 
00740 }
00741 
00742 //=============================================================================
00743 //Function:  get_loop_edges (PUBLIC)
00744 //Description: return the ordered list of edges on the boundary of this surface 
00745 //Author: sjowen
00746 //Date: 02/23/2004
00747 //=============================================================================
00748 DLIList<DLIList<CubitFacetEdge *>*> *ChollaSurface::get_loop_edges(  )
00749 {
00750   assert(myEvalTool != NULL);
00751   return myEvalTool->loops();
00752 }
00753 
00754 
00755 static int icolor = 0;
00756 void ChollaSurface::debug_draw()
00757 {
00758   icolor++;
00759   icolor = (icolor%15)+1;
00760   dcolor(icolor);
00761   dldraw(surfaceElemList);
00762 }
00763 
00764 //=============================================================================
00765 //Function:  flip_facets (PUBLIC)
00766 //Description: invert all facets on this surface 
00767 //Author: sjowen
00768 //Date: 09/10/09
00769 //=============================================================================
00770 void ChollaSurface::flip_facets()
00771 {
00772   FacetEntity *facet_entity;
00773   CubitFacet *facet_ptr;
00774   for (int ii=0; ii<surfaceElemList.size(); ii++)
00775   {
00776     facet_entity = surfaceElemList.get_and_step();
00777     facet_ptr = dynamic_cast<CubitFacet *> (facet_entity);
00778     assert( facet_ptr != NULL );
00779     facet_ptr->flip();
00780   }
00781 }
00782 
00783 //=============================================================================
00784 //Function:  is_in_volume (PUBLIC)
00785 //Description: return whether this surface is in a particular volume 
00786 //Author: sjowen
00787 //Date: 09/11/09
00788 //=============================================================================
00789 CubitBoolean ChollaSurface::is_in_volume( ChollaVolume *chvol_ptr )
00790 {
00791   ChollaVolume *mychvol_ptr;
00792   for (int ii=0; ii<volList.size(); ii++)
00793   {
00794     mychvol_ptr = volList.get_and_step();
00795     if (mychvol_ptr == chvol_ptr)
00796       return CUBIT_TRUE;
00797   }
00798   return CUBIT_FALSE;
00799 }
00800 
00801 //=============================================================================
00802 //Function:  get_vertices (PUBLIC)
00803 //Description: get the list of ChollaPoints on this surface
00804 //Author: sjowen
00805 //Date: 09/11/09
00806 //=============================================================================
00807 void ChollaSurface::get_vertices( DLIList<ChollaPoint *> &chpt_list )
00808 {
00809   chpt_list.clean_out();
00810   ChollaCurve *chcurv_ptr;
00811   for (int ii=0; ii<curveList.size(); ii++)
00812   {
00813     chcurv_ptr = curveList.get_and_step();
00814     DLIList<ChollaPoint *> chc_pts = chcurv_ptr->get_points(); 
00815     chpt_list += chc_pts;
00816   }
00817   chpt_list.uniquify_unordered();
00818 }
00819 
00820 bool ChollaSurface::is_contain( FacetEntity *facet )
00821 {
00822   if( surfaceElemList.is_in_list( facet ) )
00823     return true;
00824   else
00825     return false;
00826 }
00827 
00828 //EOF
00829 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines