cgma
|
00001 //------------------------------------------------------------------------- 00002 // Filename : FacetPoint.cpp 00003 // 00004 // Purpose : 00005 // 00006 // Special Notes : 00007 // 00008 // Creator : Steven J. Owen 00009 // 00010 // Creation Date : 07/15/00 00011 // 00012 // Owner : Steven J. Owen 00013 //------------------------------------------------------------------------- 00014 00015 // ********** BEGIN STANDARD INCLUDES ********** 00016 #include <assert.h> 00017 // ********** END STANDARD INCLUDES ********** 00018 00019 // ********** BEGIN CUBIT INCLUDES ********** 00020 #include "CubitMessage.hpp" 00021 #include "FacetPoint.hpp" 00022 #include "FacetAttrib.hpp" 00023 #include "CubitPoint.hpp" 00024 #include "CubitPointData.hpp" 00025 #include "RefVertex.hpp" 00026 #include "FacetQueryEngine.hpp" 00027 #include "CastTo.hpp" 00028 #include "Curve.hpp" 00029 00030 00031 #include "FacetBody.hpp" 00032 #include "FacetLump.hpp" 00033 #include "FacetShell.hpp" 00034 #include "FacetSurface.hpp" 00035 #include "FacetLoop.hpp" 00036 #include "FacetCoEdge.hpp" 00037 #include "FacetCurve.hpp" 00038 00039 // ********** END CUBIT INCLUDES ********** 00040 00041 // ********** BEGIN STATIC DECLARATIONS ********** 00042 // ********** END STATIC DECLARATIONS ********** 00043 00044 // ********** BEGIN PUBLIC FUNCTIONS ********** 00045 00046 //------------------------------------------------------------------------- 00047 // Purpose : The constructor with a pointer to the associated VERTEX . 00048 // 00049 // Special Notes : 00050 // 00051 // Creator : Steve Owen 00052 // 00053 // Creation Date : 07/16/00 00054 //------------------------------------------------------------------------- 00055 FacetPoint::FacetPoint( const CubitVector &location, DLIList<Curve*> &curves ) 00056 { 00057 myPoint = (CubitPoint *) new CubitPointData( location ); 00058 myCurves += curves; 00059 iCreated = CUBIT_TRUE; 00060 } 00061 00062 //------------------------------------------------------------------------- 00063 // Purpose : The constructor with a pointer to the associated CubitPoint . 00064 // 00065 // Special Notes : 00066 // 00067 // Creator : Steve Owen 00068 // 00069 // Creation Date : 12/28/00 00070 //------------------------------------------------------------------------- 00071 FacetPoint::FacetPoint( CubitPoint *thePoint, DLIList<Curve*> &curves ) 00072 { 00073 myPoint = thePoint; 00074 myCurves += curves; 00075 iCreated = CUBIT_FALSE; 00076 } 00077 00078 //------------------------------------------------------------------------- 00079 // Purpose : The constructor with a pointer to the associated CubitPoint . 00080 // 00081 // Special Notes : Was make especially for save/restore 00082 // 00083 // Creator : Corey Ernst 00084 // 00085 // Creation Date : 02/03/03 00086 //------------------------------------------------------------------------- 00087 FacetPoint::FacetPoint( CubitPoint *thePoint ) 00088 { 00089 myPoint = thePoint; 00090 iCreated = CUBIT_FALSE; 00091 } 00092 00093 //------------------------------------------------------------------------- 00094 // Purpose : The destructor. 00095 // 00096 // Special Notes : 00097 // 00098 // Creator : Steve Owen 00099 // 00100 // Creation Date : 07/16/00 00101 //------------------------------------------------------------------------- 00102 FacetPoint::~FacetPoint() 00103 { 00104 if (iCreated && myPoint != NULL) 00105 { 00106 delete myPoint; 00107 } 00108 myPoint = NULL; 00109 } 00110 00111 //------------------------------------------------------------------------- 00112 // Purpose : The purpose of this function is to append a 00113 // attribute to the GE. The name is attached to the 00114 // underlying solid model entity this one points to. 00115 // 00116 // 00117 // Special Notes : 00118 // 00119 // Creator : Steve Owen 00120 // 00121 // Creation Date : 07/16/00 00122 //------------------------------------------------------------------------- 00123 void FacetPoint::append_simple_attribute_virt(const CubitSimpleAttrib &csa) 00124 { attribSet.append_attribute(csa); } 00125 00126 //------------------------------------------------------------------------- 00127 // Purpose : The purpose of this function is to remove a simple 00128 // attribute attached to this geometry entity. The name is 00129 // removed from the underlying BODY this points to. 00130 // 00131 // Special Notes : 00132 // 00133 // Creator : Steve Owen 00134 // 00135 // Creation Date : 07/16/00 00136 //------------------------------------------------------------------------- 00137 void FacetPoint::remove_simple_attribute_virt(const CubitSimpleAttrib &csa) 00138 { attribSet.remove_attribute(csa); } 00139 00140 //------------------------------------------------------------------------- 00141 // Purpose : The purpose of this function is to remove all simple 00142 // attributes attached to this geometry entity. Also 00143 // removes lingering GTC attributes. 00144 // 00145 // 00146 // Special Notes : 00147 // 00148 // Creator : Steve Owen 00149 // 00150 // Creation Date : 07/16/00 00151 //------------------------------------------------------------------------- 00152 void FacetPoint::remove_all_simple_attribute_virt() 00153 { attribSet.remove_all_attributes(); } 00154 00155 //------------------------------------------------------------------------- 00156 // Purpose : The purpose of this function is to get the 00157 // attributes attached to this geometry entity. The name is 00158 // attached to the underlying BODY this points to. 00159 // 00160 // Special Notes : 00161 // 00162 // Creator : Steve Owen 00163 // 00164 // Creation Date : 07/16/00 00165 //------------------------------------------------------------------------- 00166 CubitStatus FacetPoint::get_simple_attribute(DLIList<CubitSimpleAttrib>& 00167 csa_list) 00168 { return attribSet.get_attributes(csa_list); } 00169 CubitStatus FacetPoint::get_simple_attribute(const CubitString& name, 00170 DLIList<CubitSimpleAttrib>& csa_list ) 00171 { return attribSet.get_attributes( name, csa_list ); } 00172 00173 CubitStatus FacetPoint::save_attribs( FILE *file_ptr ) 00174 { return attribSet.save_attributes(file_ptr); } 00175 00176 CubitStatus FacetPoint::restore_attribs( FILE *file_ptr, unsigned int endian ) 00177 { return attribSet.restore_attributes(file_ptr, endian); } 00178 00179 00180 //------------------------------------------------------------------------- 00181 // Purpose : Returns the coordinates of this Point. 00182 // 00183 // Special Notes : 00184 // 00185 // Creator : Steve Owen 00186 // 00187 // Creation Date : 07/16/00 00188 //------------------------------------------------------------------------- 00189 CubitVector FacetPoint::coordinates() const 00190 { 00191 return myPoint->coordinates(); 00192 } 00193 00194 //------------------------------------------------------------------------- 00195 // Purpose : Get geometry modeling engine: FacetGeometryEngine 00196 // 00197 // Special Notes : 00198 // 00199 // Creator : Steve Owen 00200 // 00201 // Creation Date : 07/16/00 00202 //------------------------------------------------------------------------- 00203 GeometryQueryEngine* FacetPoint::get_geometry_query_engine() const 00204 { 00205 return FacetQueryEngine::instance(); 00206 } 00207 00208 //------------------------------------------------------------------------- 00209 // Purpose : Get the bounding box of the object. 00210 // 00211 // Special Notes : 00212 // 00213 // Creator : Steve Owen 00214 // 00215 // Creation Date : 07/16/00 00216 //------------------------------------------------------------------------- 00217 CubitBox FacetPoint::bounding_box() const 00218 { 00219 CubitVector temp_vector = this->coordinates(); 00220 CubitBox temp_box(temp_vector); 00221 return temp_box; 00222 } 00223 00224 00225 /* 00226 void FacetPoint::bodysms(DLIList<BodySM*> &bodies) 00227 { 00228 int ii; 00229 for ( ii = myCurves.size(); ii > 0; ii-- ) 00230 { 00231 myCurves.get_and_step()->bodysms(bodies); 00232 } 00233 } 00234 00235 void FacetPoint::lumps(DLIList<Lump*> &lumps) 00236 { 00237 int ii; 00238 for ( ii = myCurves.size(); ii > 0; ii-- ) 00239 { 00240 myCurves.get_and_step()->lumps(lumps); 00241 } 00242 } 00243 00244 void FacetPoint::shellsms(DLIList<ShellSM*> &shellsms) 00245 { 00246 int ii; 00247 for ( ii = myCurves.size(); ii > 0; ii-- ) 00248 { 00249 myCurves.get_and_step()->shellsms(shellsms); 00250 } 00251 } 00252 00253 void FacetPoint::surfaces(DLIList<Surface*> &surfaces) 00254 { 00255 int ii; 00256 for ( ii = myCurves.size(); ii > 0; ii-- ) 00257 { 00258 myCurves.get_and_step()->surfaces(surfaces); 00259 } 00260 } 00261 00262 void FacetPoint::loopsms(DLIList<LoopSM*> &loopsms) 00263 { 00264 int ii; 00265 for ( ii = myCurves.size(); ii > 0; ii-- ) 00266 { 00267 myCurves.get_and_step()->loopsms(loopsms); 00268 } 00269 } 00270 00271 void FacetPoint::coedgesms(DLIList<CoEdgeSM*> &coedgesms) 00272 { 00273 int ii; 00274 for ( ii = myCurves.size(); ii > 0; ii-- ) 00275 { 00276 myCurves.get_and_step()->coedgesms(coedgesms); 00277 } 00278 } 00279 00280 00281 void FacetPoint::curves(DLIList<Curve*> &curves) 00282 { 00283 int ii; 00284 for ( ii = myCurves.size(); ii > 0; ii-- ) 00285 { 00286 curves.append_unique( myCurves.get_and_step() ); 00287 } 00288 } 00289 00290 void FacetPoint::points(DLIList<Point*> &points) 00291 { 00292 points.append_unique( this ); 00293 } 00294 */ 00295 00296 00297 void FacetPoint::get_parents_virt( DLIList<TopologyBridge*>& parents ) 00298 { CAST_LIST_TO_PARENT( myCurves, parents ); } 00299 void FacetPoint::get_children_virt( DLIList<TopologyBridge*>& ) 00300 { } 00301 00302 00303 void FacetPoint::get_lumps( DLIList<FacetLump*>& result_list ) 00304 { 00305 DLIList<FacetShell*> shell_list; 00306 get_shells( shell_list ); 00307 shell_list.reset(); 00308 for ( int i = shell_list.size(); i--; ) 00309 { 00310 FacetShell* shell = shell_list.get_and_step(); 00311 shell->get_lumps( result_list ); 00312 FacetLump* lump = dynamic_cast<FacetLump*>(shell->get_lump()); 00313 if (lump) 00314 result_list.append_unique(lump); 00315 } 00316 } 00317 00318 void FacetPoint::get_shells( DLIList<FacetShell*>& result_list ) 00319 { 00320 DLIList<FacetSurface*> surface_list; 00321 DLIList<FacetShell*> temp_list; 00322 get_surfaces( surface_list ); 00323 surface_list.reset(); 00324 for ( int i = surface_list.size(); i--; ) 00325 { 00326 FacetSurface* surface = surface_list.get_and_step(); 00327 temp_list.clean_out(); 00328 surface->get_shells( temp_list ); 00329 result_list.merge_unique( temp_list ); 00330 } 00331 } 00332 00333 void FacetPoint::get_surfaces( DLIList<FacetSurface*>& result_list ) 00334 { 00335 DLIList<FacetLoop*> loop_list; 00336 get_loops( loop_list ); 00337 loop_list.reset(); 00338 for ( int i = loop_list.size(); i--; ) 00339 { 00340 FacetLoop* loop = loop_list.get_and_step(); 00341 FacetSurface* surface = dynamic_cast<FacetSurface*>(loop->get_surface()); 00342 if (surface) 00343 result_list.append_unique(surface); 00344 } 00345 } 00346 00347 void FacetPoint::get_loops( DLIList<FacetLoop*>& result_list ) 00348 { 00349 DLIList<FacetCoEdge*> coedge_list; 00350 get_coedges( coedge_list ); 00351 coedge_list.reset(); 00352 for ( int i = coedge_list.size(); i--; ) 00353 { 00354 FacetCoEdge* coedge = coedge_list.get_and_step(); 00355 FacetLoop* loop = dynamic_cast<FacetLoop*>(coedge->get_loop()); 00356 if (loop) 00357 result_list.append_unique(loop); 00358 } 00359 } 00360 00361 void FacetPoint::get_coedges( DLIList<FacetCoEdge*>& result_list ) 00362 { 00363 DLIList<FacetCurve*> curve_list; 00364 get_curves( curve_list ); 00365 curve_list.reset(); 00366 for ( int i = curve_list.size(); i--; ) 00367 curve_list.get_and_step()->get_coedges( result_list ); 00368 } 00369 00370 void FacetPoint::get_curves( DLIList<FacetCurve*>& result_list ) 00371 { 00372 myCurves.reset(); 00373 for ( int i = 0; i < myCurves.size(); i++ ) 00374 if ( FacetCurve* curve = dynamic_cast<FacetCurve*>(myCurves.next(i)) ) 00375 result_list.append(curve); 00376 } 00377 00378 //------------------------------------------------------------------------- 00379 // Purpose : Tear down topology 00380 // 00381 // Special Notes : 00382 // 00383 // Creator : Jason Kraftcheck 00384 // 00385 // Creation Date : 09/29/03 00386 //------------------------------------------------------------------------- 00387 CubitStatus FacetPoint::disconnect_curve (FacetCurve* curve) 00388 { 00389 if (!myCurves.move_to(curve)) 00390 return CUBIT_FAILURE; 00391 myCurves.remove(); 00392 00393 if (curve->start_point() == this) 00394 curve->remove_start_point(); 00395 00396 if (curve->end_point() == this) 00397 curve->remove_end_point(); 00398 00399 return CUBIT_SUCCESS; 00400 } 00401 00402 00403 // ********** END PUBLIC FUNCTIONS ********** 00404 00405 // ********** BEGIN PROTECTED FUNCTIONS ********** 00406 // ********** END PROTECTED FUNCTIONS ********** 00407 00408 // ********** BEGIN PRIVATE FUNCTIONS ********** 00409 // ********** END PRIVATE FUNCTIONS ********** 00410 00411 // ********** BEGIN HELPER CLASSES ********** 00412 // ********** END HELPER CLASSES ********** 00413 00414 // ********** BEGIN EXTERN FUNCTIONS ********** 00415 // ********** END EXTERN FUNCTIONS ********** 00416 00417 // ********** BEGIN STATIC FUNCTIONS ********** 00418 // ********** END STATIC FUNCTIONS **********