cgma
FacetLoop.cpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : FacetLoop.cpp
00003 //
00004 // Purpose       : Loops for Facet-based geometry module
00005 //
00006 // Special Notes :
00007 //
00008 // Creator       : Steven J. Owen
00009 //
00010 // Creation Date : 12/06/00
00011 //
00012 // Owner         : Steven J. Owen
00013 //-------------------------------------------------------------------------
00014 
00015 #include "CastTo.hpp"
00016 #include "FacetLoop.hpp"
00017 #include "FacetQueryEngine.hpp"
00018 #include "CoEdgeSM.hpp"
00019 
00020 #include "FacetBody.hpp"
00021 #include "FacetLump.hpp"
00022 #include "FacetShell.hpp"
00023 #include "FacetSurface.hpp"
00024 #include "FacetCoEdge.hpp"
00025 #include "FacetCurve.hpp"
00026 #include "FacetPoint.hpp"
00027 // ********** END CUBIT INCLUDES           **********
00028 
00029 // ********** BEGIN STATIC DECLARATIONS    **********
00030 // ********** END STATIC DECLARATIONS      **********
00031 
00032 // ********** BEGIN PUBLIC FUNCTIONS       **********
00033 
00034 //-------------------------------------------------------------------------
00035 // Purpose       : The constructor with a pointer to the FacetEvalTool.
00036 //
00037 // Special Notes :
00038 //
00039 //-------------------------------------------------------------------------
00040 FacetLoop::FacetLoop( Surface *surf_ptr,
00041                       DLIList<CoEdgeSM*> &coedge_list )
00042 {
00043   mySurface = surf_ptr;
00044   myCoEdges += coedge_list;
00045 }
00046 
00047 //-------------------------------------------------------------------------
00048 // Purpose       : The constructor with coedges.
00049 //
00050 // Special Notes :
00051 //
00052 //-------------------------------------------------------------------------
00053 FacetLoop::FacetLoop( DLIList<CoEdgeSM*> &coedge_list )
00054 {
00055   myCoEdges += coedge_list;
00056 }
00057 
00058 //-------------------------------------------------------------------------
00059 // Purpose       : The default destructor.
00060 //
00061 // Special Notes :
00062 //
00063 //-------------------------------------------------------------------------
00064 FacetLoop::~FacetLoop()
00065 {
00066 }
00067 
00068 //-------------------------------------------------------------------------
00069 // Purpose       : The purpose of this function is to see if a loop is an external
00070 //                  or internal loop of a surface.
00071 //
00072 // Special Notes : 
00073 //
00074 // Creator       : Jonathan Bugman
00075 //
00076 // Creation Date : 9/9/2008
00077 //-------------------------------------------------------------------------
00078 CubitBoolean FacetLoop::is_external()
00079 {
00080           PRINT_ERROR( "This command is not supported with this engine.\n");
00081           return CUBIT_FAILURE;
00082 }
00083 
00084 LoopType FacetLoop::loop_type()
00085 {
00086   return LOOP_TYPE_UNKNOWN;
00087 }
00088 
00089 //-------------------------------------------------------------------------
00090 // Purpose       : The purpose of this function is to append a
00091 //                 attribute to the GE. The name is attached to the
00092 //                 underlying solid model entity this one points to.
00093 //
00094 //
00095 // Special Notes :
00096 //
00097 //-------------------------------------------------------------------------
00098 void FacetLoop::append_simple_attribute_virt(const CubitSimpleAttrib& /*csattrib_ptr*/)
00099 {
00100   //PRINT_ERROR("FacetLoop::append_simple_attribute_virt not defined\n");
00101   return;
00102 
00103 }
00104 
00105 //-------------------------------------------------------------------------
00106 // Purpose       : The purpose of this function is to remove a simple
00107 //                 attribute attached to this geometry entity. The name is
00108 //                 removed from the underlying BODY this points to.
00109 //
00110 // Special Notes :
00111 //
00112 //-------------------------------------------------------------------------
00113 void FacetLoop::remove_simple_attribute_virt(const CubitSimpleAttrib& /*csattrib_ptr*/)
00114 {
00115   //PRINT_ERROR("FacetLoop::remove_simple_attribute_virt not defined\n");
00116   return;
00117 }
00118 
00119 //-------------------------------------------------------------------------
00120 // Purpose       : The purpose of this function is to remove all simple
00121 //                 attributes attached to this geometry entity.  Also
00122 //                 removes lingering GTC attributes.
00123 //
00124 //
00125 // Special Notes :
00126 //
00127 //-------------------------------------------------------------------------
00128 void FacetLoop::remove_all_simple_attribute_virt()
00129 {
00130   //PRINT_ERROR(" FacetLoop::remove_all_simple_attribute_virt not defined\n");
00131   return;
00132 }
00133 
00134 //-------------------------------------------------------------------------
00135 // Purpose       : The purpose of this function is to get the
00136 //                 attributes attached to this geometry entity. The name is
00137 //                 attached to the underlying BODY this points to.
00138 //
00139 // Special Notes :
00140 //
00141 //-------------------------------------------------------------------------
00142 CubitStatus FacetLoop::get_simple_attribute(DLIList<CubitSimpleAttrib>&
00143                                                  /*cubit_simple_attrib_list*/)
00144 {
00145   //PRINT_ERROR("FacetLoop::get_simple_attribute not defined\n");
00146   return CUBIT_FAILURE;
00147 }
00148 CubitStatus FacetLoop::get_simple_attribute(const CubitString&,
00149                                               DLIList<CubitSimpleAttrib>&)
00150   { return CUBIT_FAILURE; }
00151 
00152 //-------------------------------------------------------------------------
00153 // Purpose       : compute bounding box of loop
00154 //
00155 // Special Notes :
00156 //
00157 //-------------------------------------------------------------------------
00158 CubitBox FacetLoop::bounding_box() const
00159 {
00160    CubitBox box;
00161    //PRINT_ERROR("FacetLoop::bounding_box not implemented\n");
00162    return box;
00163 }
00164 
00165 //-------------------------------------------------------------------------
00166 // Purpose       : Get geometry modeling engine: FacetQueryEngine
00167 //
00168 // Special Notes :
00169 //
00170 //-------------------------------------------------------------------------
00171 GeometryQueryEngine* FacetLoop::get_geometry_query_engine() const
00172 {
00173    return FacetQueryEngine::instance();
00174 }                
00175 
00176 /*
00177 void FacetLoop::bodysms(DLIList<BodySM*> &bodies)
00178 {
00179   mySurface->bodysms(bodies);
00180 }
00181 
00182 void FacetLoop::lumps(DLIList<Lump*> &lumps)
00183 {
00184   mySurface->lumps(lumps);
00185 }
00186 
00187 void FacetLoop::shellsms(DLIList<ShellSM*> &shellsms)
00188 {
00189   mySurface->shellsms(shellsms);
00190 }
00191 
00192 void FacetLoop::surfaces(DLIList<Surface*> &surfaces)
00193 {
00194   surfaces.append_unique( mySurface );
00195 }
00196 
00197 void FacetLoop::loopsms(DLIList<LoopSM*> &loopsms)
00198 {
00199   loopsms.append_unique( this );
00200 }
00201 void FacetLoop::coedgesms(DLIList<CoEdgeSM*> &coedgesms)
00202 {
00203   int ii;
00204   for ( ii = myCoEdges.size(); ii > 0; ii-- )
00205   {
00206     coedgesms.append_unique(myCoEdges.get_and_step());
00207   }
00208 }
00209 
00210 void FacetLoop::curves(DLIList<Curve*> &curves)
00211 {
00212   int ii;
00213   for ( ii = myCoEdges.size(); ii > 0; ii-- )
00214   {
00215     myCoEdges.get_and_step()->curves(curves);
00216   }
00217 }
00218 void FacetLoop::points(DLIList<Point*> &points)
00219 {
00220   int ii;
00221   for ( ii = myCoEdges.size(); ii > 0; ii-- )
00222   {
00223     myCoEdges.get_and_step()->points(points);
00224   }
00225 }
00226 */
00227 
00228 
00229 void FacetLoop::get_parents_virt( DLIList<TopologyBridge*>& parents )
00230   { parents.append( mySurface ); }
00231 void FacetLoop::get_children_virt( DLIList<TopologyBridge*>& children )
00232   { CAST_LIST_TO_PARENT( myCoEdges, children ); }
00233 
00234 
00235 void FacetLoop::get_lumps( DLIList<FacetLump*>& result_list )
00236 {
00237   DLIList<FacetShell*> shell_list;
00238   get_shells( shell_list );
00239   shell_list.reset();
00240   for ( int i = shell_list.size(); i--; )
00241   {
00242     FacetShell* shell = shell_list.get_and_step();
00243     shell->get_lumps( result_list );
00244     FacetLump* lump = dynamic_cast<FacetLump*>(shell->get_lump());
00245     if (lump)
00246       result_list.append_unique(lump);
00247   }
00248 }
00249 
00250 void FacetLoop::get_shells( DLIList<FacetShell*>& result_list )
00251 {
00252   if ( FacetSurface* surf = dynamic_cast<FacetSurface*>(mySurface) )
00253     surf->get_shells( result_list );
00254 }
00255 
00256 void FacetLoop::get_coedges( DLIList<FacetCoEdge*>& result_list )
00257 {
00258   myCoEdges.reset();
00259   for ( int i = 0; i < myCoEdges.size(); i++ )
00260     if (FacetCoEdge* coedge = dynamic_cast<FacetCoEdge*>(myCoEdges.next(i)))
00261       result_list.append( coedge );
00262 }
00263 
00264 void FacetLoop::get_curves( DLIList<FacetCurve*>& result_list )
00265 {
00266   DLIList<FacetCoEdge*> coedge_list;
00267   get_coedges( coedge_list );
00268   coedge_list.reset();
00269   for ( int i = coedge_list.size(); i--; )
00270   {
00271     FacetCoEdge* coedge = coedge_list.get_and_step();
00272     FacetCurve* curve = dynamic_cast<FacetCurve*>(coedge->curve());
00273     if (curve)
00274       result_list.append_unique(curve);
00275   }
00276 }
00277 
00278 
00279 //-------------------------------------------------------------------------
00280 // Purpose       : Tear down topology
00281 //
00282 // Special Notes : 
00283 //
00284 // Creator       : Jason Kraftcheck
00285 //
00286 // Creation Date : 09/29/03
00287 //-------------------------------------------------------------------------
00288 void FacetLoop::disconnect_all_coedges()
00289 {
00290   myCoEdges.reset();
00291   for (int i = myCoEdges.size(); i--; )
00292   {
00293     CoEdgeSM* sm_ptr = myCoEdges.get_and_step();
00294     FacetCoEdge* coedge = dynamic_cast<FacetCoEdge*>(sm_ptr);
00295     if (coedge)
00296     {
00297       assert(coedge->get_loop() == this);
00298       coedge->remove_loop();
00299     }
00300   }
00301   myCoEdges.clean_out();
00302 }
00303 
00304 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines