cgma
PartitionTool.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : PartitionTool.hpp
00003 //
00004 // Purpose       : Functions for splitting geometry
00005 //
00006 // Special Notes :
00007 //
00008 // Creator       : Jason Kraftcheck
00009 //
00010 // Creation Date : 12/13/98
00011 //-------------------------------------------------------------------------
00012 
00013 #ifndef PARTITION_TOOL_HPP
00014 #define PARTITION_TOOL_HPP
00015 
00016 class SenseEntity;
00017 class PartitionEntity;
00018 class PartitionCurve;
00019 class PartitionSurface;
00020 class Loop;
00021 class Shell;
00022 
00023 class RefEdge;
00024 class RefVertex;
00025 class Curve;
00026 template <class X> class DLIList;
00027 class PartitionCurve;
00028 
00029 class CubitFacet;
00030 
00031 #include "CubitDefines.h"
00032 #include "RefEdge.hpp"
00033 
00034 class PartitionTool
00035 {
00036 public:
00037 
00038   static PartitionTool* instance();
00039 /*
00040   virtual CubitStatus partition( RefEdge* edge_ptr,
00041                                  RefVertex* split_point,
00042                                  RefEdge*& first_new_edge,
00043                                  RefEdge*& second_new_edge,
00044                                  CubitBoolean ignore_mesh = CUBIT_FALSE );
00045 */
00046   virtual RefVertex* partition( RefEdge* edge_ptr,
00047                                  const CubitVector& split_point,
00048                                  RefEdge*& first_new_edge,
00049                                  RefEdge*& second_new_edge,
00050                                  CubitBoolean ignore_mesh = CUBIT_FALSE );
00051   virtual RefVertex* partition( RefEdge* edge_ptr,
00052                                  const CubitVector& split_point,
00053                                  DLIList<RefEdge*>& result_edges,
00054                                  CubitBoolean ignore_mesh = CUBIT_FALSE );
00055   //R CubitStatus
00056   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00057   //I edge_ptr
00058   //I- A pointer to the RefEdge to Partition.
00059   //I split_point
00060   //I- A pointer to the Vertex at the split location.
00061   //O first_new_edge / second_new_edge
00062   //O- Pointers to the new RefEdges created.
00063   //- Partition a RefEdge.
00064 
00065   virtual RefFace* insert_edge( RefFace* face_ptr,
00066                                 DLIList<CubitVector*>& segments,
00067                                 CubitBoolean       is_meshed,
00068                                 DLIList<RefEdge*>& created_curves,
00069                                 int level_of_recursion = 0,
00070                                 const double *tolerance_length = NULL);
00071 
00072   virtual CubitStatus insert_edge( DLIList<RefFace*>& input_faces,
00073                                    DLIList<CubitVector*>& segments,
00074                                    DLIList<RefFace*>& result_faces,
00075                                    DLIList<RefEdge*>& created_edges,
00076                                    CubitBoolean do_split_curves = CUBIT_FALSE);
00077 
00078 
00079   virtual CubitStatus partition( RefFace* face_ptr,
00080                                  RefEdge* edge_ptr,
00081                                  RefFace*& new_face1,
00082                                  RefFace*& new_face2,
00083                                  CubitBoolean );
00084 
00085   virtual CubitStatus partition( RefFace* face_ptr,
00086                                  DLIList<RefEdge*>& split_edges,
00087                                  RefFace*& first_new_face,
00088                                  RefFace*& second_new_face,
00089                                  CubitBoolean ignore_mesh = CUBIT_FALSE );
00090   //R CubitStatus
00091   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00092   //I face_ptr
00093   //I- A pointer to the RefFace to split.
00094   //I split_edges
00095   //I- The list of edges defining split location.
00096   //O first_new_face / second_new_face
00097   //O- The new RefFaces created.
00098   //- Partition a RefFace.
00099 
00100   virtual CubitStatus partition( RefVolume* vol_ptr,
00101                                  DLIList<RefFace*>& split_faces,
00102                                  RefVolume*& first_new_volume,
00103                                  RefVolume*& second_new_volume,
00104                                  CubitBoolean ignore_mesh = CUBIT_FALSE );
00105   virtual CubitStatus partition( RefVolume* vol_ptr,
00106                                  DLIList<CubitFacet*>& split_faces,
00107                                  RefVolume*& first_new_volume,
00108                                  RefVolume*& second_new_volume,
00109                                  DLIList<RefFace*>& new_surfaces,
00110                                  CubitBoolean ignore_mesh = CUBIT_FALSE );
00111   //R CubitStatus
00112   //I vol_ptr
00113   //I- A pointer to the RefVolume to split.
00114   //I split_faces
00115   //I- The list of faces defining the split location
00116   //O first_new_volume/second_new_volume
00117   //O- The new RefVolumes created
00118   //- Partition a RefVolume.
00119 
00120   CubitStatus destroy_volume_partition( RefVolume* partition );
00121 
00122   //CubitStatus partition( RefEdge* edge_ptr,
00123   //                       DLIList<RefVertex*>& split_points,
00124   //                       DLIList<RefEdge*>& new_edges,
00125   //                       CubitBoolean ignore_mesh = CUBIT_FALSE );
00126   CubitStatus partition( RefEdge* edge_ptr,
00127                          DLIList<CubitVector*>& split_points,
00128                          DLIList<RefEdge*>& new_edges,
00129                          CubitBoolean ignore_mesh = CUBIT_FALSE );
00130   CubitStatus partition( RefEdge* edge_ptr,
00131                          DLIList<CubitVector*>& split_points,
00132                          DLIList<RefVertex*>& new_vertices,
00133                          DLIList<RefEdge*>& new_edges,
00134                          CubitBoolean ignore_mesh = CUBIT_FALSE );
00135   //R CubitStatus
00136   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00137   //I edge_ptr
00138   //I- A pointer to the RefEdge to Partition.
00139   //I split_points
00140   //I- A list of Vertices at which to split the curve.
00141   //O new_edges
00142   //O- The new RefEdges created.
00143   //- Partition a RefEdge.
00144 
00145   CubitStatus partition_face_by_curves( RefFace* face_ptr,
00146                          const DLIList<Curve*>& split_curves,
00147                          DLIList<RefFace*>& result_faces,
00148                          CubitBoolean do_split_curves = CUBIT_FALSE,
00149                          DLIList<RefEdge*>* new_edges = NULL,
00150                          CubitBoolean ignore_mesh = CUBIT_FALSE );
00151   //- Similar to the next function but takes curves as input
00152 
00153   CubitStatus partition( RefFace* face_ptr,
00154                          const DLIList<RefEdge*>& split_edges,
00155                          DLIList<RefFace*>& result_faces,
00156                          CubitBoolean do_split_curves = CUBIT_FALSE,
00157                          DLIList<RefEdge*>* new_edges = NULL,
00158                          CubitBoolean ignore_mesh = CUBIT_FALSE );
00159   //R CubitStatus
00160   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00161   //I face_ptr
00162   //I- A pointer to the RefFace to partition
00163   //I split_edges
00164   //I- A list of RefEdges with which to partition the RefFace
00165   //O result_faces
00166   //O- The RefFaces resulting from the splitting operation
00167   //I split_curves
00168   //I- If true, spatially compare all RefVertices in the split_edge
00169   //I- list with edges in that list and on the RefFace, and partition
00170   //I- RefEdges as necessary.
00171   //O new_edges
00172   //O- If split_curves in CUBIT_TRUE, and this is non-null, a list
00173   //O- of new RefEdges created by partitioning will be passed back.
00174   //I ignore_mesh
00175   //I- If true, operator will not fail if the passed RefFace is meshed,
00176   //I- or if split_curves in true and any of the RefEdges are meshed.
00177   //I- NOTE: If this is passed as CUBIT_TRUE, it is the responsibility
00178   //I-       of the caller to remove the mesh from hidden entities.
00179   //- Do multiple partitioning of a RefFace.
00180 
00181   RefEdge* unpartition( RefEdge* first_partition_edge,
00182                         RefEdge* second_partition_edge );
00183   //R RefEdge*
00184   //R- The RefEdge restored to the model.
00185   //I first_partition_edge / second_partition_edge
00186   //I- Pointers to RefEdges with PartitionCurve geometry.
00187   //O free_vertex
00188   //O- A pointer to the freed vertex.
00189   //I keep_dead
00190   //I- If true, the passed-in RefEdges are not destroyed, but the
00191   //I- attached PartitionCurve is.
00192   //- Undo a partitioning operation.
00193 
00194   RefFace* unpartition( RefFace* first_partition_face,
00195                         RefFace* second_partition_face );
00196   //R RefFace*
00197   //R- The RefFace restored to the model.
00198   //I first_partition_face / second_partition_face
00199   //I- Pointers to RefFaces with PartitionSurface geometry.
00200   //O free_edges
00201   //O- A list of edges freed by this operation.
00202   //I keep_dead
00203   //I- If true, the passed-in RefFaces are not destroyed, but the
00204   //I- attached PartitionSurface is.
00205   //- Undo a partitioning operation.
00206 
00207    RefVolume* unpartition( RefVolume* first_partition_volume,
00208                            RefVolume* second_partition_volume );
00209   //R RefVolume*
00210   //R- The RefVolume restored to the model.
00211   //I first_partition_volume / second_partition_volume
00212   //I- Pointers to RefVolumes with PartitionLump geometry.
00213   //O free_faces
00214   //O- A list of faces freed by this operation.
00215   //- Undo a partitioning operation.
00216 
00217   RefVolume* unpartition( DLIList<RefVolume*>& partition_volumes );
00218 
00219 
00220   virtual CubitStatus unpartitionAll( DLIList<RefEdge*>& partition_edges,
00221                               DLIList<RefEdge*>& restored_edges );
00222   //R CubitStatus
00223   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00224   //I partition_edges
00225   //I- A list of RefEdges with PartitionCurve geometry.
00226   //O restored_edges
00227   //O- A list of RefEdges restored to the model.
00228   //- Remove a bunch of partitions.
00229   //-
00230   //- Note: Any vertices freed by this operation will be deleted.
00231 
00232   virtual CubitStatus unpartitionAll( DLIList<RefFace*>& partition_faces,
00233                               DLIList<RefFace*>& restored_faces );
00234   //R CubitStatus
00235   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00236   //I partition_faces
00237   //I- A list of RefFaces with PartitionSurfaces geometry.
00238   //O restored_faces
00239   //O- A list of RefFaces restored to the model.
00240   //- Remove a bunch of partitions.
00241   //-
00242   //- Note: any RefEdges freed by this operation and thier child
00243   //-       RefVertices will be deleted.
00244 
00245 
00246   virtual CubitStatus unpartitionAll( DLIList<RefVolume*>& partition_vols,
00247                               DLIList<RefVolume*>& restored_vols );
00248 
00249   RefVertex* make_point_curve( RefFace* ref_face,
00250                                const CubitVector& position );
00251 
00252   CubitStatus make_point_curves( RefFace* ref_face,
00253                                  DLIList<CubitVector> &position,
00254                                  DLIList<RefVertex*> &new_vertices);
00255 
00256   virtual ~PartitionTool();
00257 
00258   virtual CubitStatus can_remove( RefVertex* vertex );
00259   virtual CubitStatus can_remove( RefEdge* edge );
00260   virtual CubitStatus can_remove( RefFace* face );
00261 
00262   int get_faceting_tolerance() {return facetingTolerance;}
00263 
00264 protected:
00265 
00266   static PartitionTool* instance_;
00267 
00268   PartitionTool();
00269 
00270   DLIList<Surface*>* group_merged_surfaces( DLIList<RefFace*>& face_list,
00271                                             int& num_result_sets );
00272 
00273 
00274 private:
00275 
00276   void notify_partition( DLIList<RefEntity*> &partitioning_entities,
00277                          BasicTopologyEntity *first_partitioned_entity,
00278                          BasicTopologyEntity *second_partitioned_entity,
00279                          BasicTopologyEntity *old_entity );
00280     // notify observers that the old_entity was partitioned
00281 
00282 
00283 
00284   CubitStatus commonGroupingEntities( BasicTopologyEntity* first_bte_ptr,
00285                                       BasicTopologyEntity* secnd_bte_ptr,
00286                                       GroupingEntity*& first_gpe_ptr,
00287                                       GroupingEntity*& second_gpe_ptr ) const;
00288     //R CubitStatus
00289     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00290     //I first_bte_ptr/second_bte_ptr
00291     //I- Pointers to two BTEs of the same type.
00292     //O first_gpe_ptr/second_gpe_ptr
00293     //O- Child grouping entities of first_bte_ptr and second_bte_ptr,
00294     //O- respectively.
00295     //- This function searches for a grouping entity from each
00296     //- of the BTEs for which those GroupingEntites have atleast one
00297     //- common child.
00298     //- If there is only one pair of grouping entities which meet this
00299     //- criteria, they are passed back, and CUBIT_SUCCESS is returned.
00300     //- If there is more than one pair, an arbitrary pair is passed
00301     //- back, and CUBIT_FAILURE is returned.
00302     //- If no common GpEs are found, both pointers are passed back as
00303     //- NULL, and CUBIT_FAILURE is returned.
00304 
00305   int facetingTolerance;
00306 
00307 };
00308 
00309 //-------------------------------------------------------------------------
00310 // Purpose       : Singleton class
00311 //
00312 // Special Notes :
00313 //
00314 // Creator       : Jason Kraftcheck
00315 //
00316 // Creation Date : 12/13/98
00317 //-------------------------------------------------------------------------
00318 inline PartitionTool* PartitionTool::instance()
00319 {
00320   if( instance_ == NULL ) instance_ = new PartitionTool();
00321   return instance_;
00322 }
00323 
00324 #endif
00325 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines