cgma
OldUnmergeCode.hpp
Go to the documentation of this file.
00001 #ifndef OLD_UNMERGE_CODE_HPP
00002 #define OLD_UNMERGE_CODE_HPP
00003 
00004 #include "CubitDefines.h"
00005 #include "DLIList.hpp"
00006 #include "CGMGeomConfigure.h"
00007 
00008 class RefEntity;
00009 class Body;
00010 class RefVolume;
00011 class RefFace;
00012 class Loop;
00013 class RefEdge;
00014 class RefVertex;
00015 class UnMergeEvent;
00016 
00017 class TopologyBridge;
00018 class Surface;
00019 class LoopSM;
00020 class Curve;
00021 class TBPoint;
00022 
00023 
00024 class CUBIT_GEOM_EXPORT OldUnmergeCode
00025 {
00026   public:
00027   
00028    static OldUnmergeCode& instance();
00029 
00030    static void initialize_settings();
00031 
00032    CubitStatus unmerge_all();
00033      //- Unmerge everything.
00034    
00035    CubitStatus 
00036    unmerge( DLIList<RefEntity*>& entity_list, CubitBoolean descend = CUBIT_TRUE );
00037      //- Unmerge entities in list.
00038      //- If decend is true, will decend topology graph, unmerging child topology
00039      //- of the passed topology.  If decend is false, a.) passing bodies or volumes
00040      //- in entity list will have no effect and b.) when a surface is unmerged
00041      //- its child curves will not be unmerged, and the child vertices will not be 
00042      //- unmerged when an edge is unmerged.
00043      
00044    CubitStatus unmerge( RefEntity* entity_ptr, CubitBoolean descend = CUBIT_TRUE );
00045    CubitStatus unmerge( RefFace*   face_ptr,   CubitBoolean descend = CUBIT_TRUE );
00046    CubitStatus unmerge( RefEdge*   edge_ptr,   CubitBoolean descend = CUBIT_TRUE );
00047    CubitStatus unmerge( Body*      body_ptr   );
00048    CubitStatus unmerge( RefVolume* vol_ptr    );
00049    CubitStatus unmerge( RefVertex* vertex_ptr );
00050      //- Unmerge the passed entity.  All parents must already be
00051      //- unmerged.  
00052      //- If decend is true, will decend topology graph, unmerging child topology
00053      //- of the passed topology.  If decend is false, a.) passing bodies or volumes
00054      //- in entity list will have no effect and b.) when a surface is unmerged
00055      //- its child curves will not be unmerged, and the child vertices will not be 
00056      //- unmerged when an edge is unmerged.
00057    
00058    
00059    static bool get_use_old_unmerge_code();
00060    static void set_use_old_unmerge_code( bool value );
00061     // If false (default), functions in this class
00062     // will just return the result of the new code
00063     // in MergeTool.  If true, the old unmerge code
00064     // in this class will be used.
00065    
00066    private:
00067      
00068    RefFace*   unmerge( RefFace*  face_ptr, RefVolume* parent_ptr );
00069    RefEdge*   unmerge( RefEdge*  edge_ptr, RefFace*   parent_ptr );
00070    RefVertex* unmerge( RefVertex* vtx_ptr, RefEdge*   parent_ptr );
00071      //- Split out the merged entity in entity_ptr that is associated
00072      //- with the passed parent, remove entity_ptr from parent, attach
00073      //- new, unmerged entity to parent.
00074      //-
00075      //- If the passed entity is not a merged entity, no change is made
00076      //- and the passed entity is returned.
00077      //-
00078      //- If the passed entity is a merged entity, the new entity created
00079      //- by the unmerge is returned.
00080      //-
00081      //- NULL is returned if an error was encountered.  It is an error
00082      //- if the passed parent_ptr is a merged entity.
00083    
00084    RefFace*    split_out_Surface( Surface* surface_ptr, CubitBoolean& reversed );
00085    RefEdge*    split_out_Curves ( DLIList<Curve*>& curve_list, CubitBoolean& reversed );
00086    RefVertex*  split_out_Points ( DLIList<TBPoint*>& point_list );
00087     //- Split out merged entities from owning BridgeManager, and
00088     //- construct new topology, including new child GroupingEntities
00089     //- and child SenseEntities. 
00090     //-
00091     //- NOTE: All passed TopologyBridges MUST belong to the same BridgeManager.                        
00092 
00093    Loop*       split_out_Loop   ( LoopSM* loopsm, RefFace* new_loop_owner,
00094                                   CubitBoolean reverse );
00095     //- Unmerge a loop and its child coedges.  Loop and coedge directions
00096     //- for new entities are reversed if reverse == CUBIT_TRUE.
00097     
00098    void cleanup_unmerge();
00099     //- Does post-processing for unmerge (sending events and such.)
00100     
00101   static void remove_CAEntityId_attrib( TopologyBridge* tb_ptr );
00102     
00103   
00104   static void find_curves( TBPoint* point_ptr, DLIList<Curve*>& result_set );
00105   static void find_surfaces( Curve* curve_ptr, DLIList<Surface*>& result_set);
00106     //- Virtual Geometry will provide all downward topology bridge queries,
00107     //- but not always the corresponding upwards queries of the topology
00108     //- bridges.  These methods are an implementation of the upward queries
00109     //- from the downward ones.  While somewhat more expensive, this works
00110     //- around the shortcomming of the VG topology bridge traversals.
00111     
00112   DLIList<RefEntity*> new_unmerged;
00113   DLIList<RefEntity*> old_unmerged;
00114   DLIList<RefEntity*> unmerge_modified;
00115   DLIList<UnMergeEvent*> event_list;
00116   CubitBoolean unmerged_list_in_use;
00117      //- A list new entities created by unmerging, and a list of
00118      //- existing entities that were unmerged, and a flag set by the highest
00119      //- level method called to begin an unmerge.  The flag signifies
00120      //- that lower-level methods should not clear the list when
00121      //- starting/finishing, and should not try to update the graphics.
00122      //-
00123      //- Any method that sets unmerged_list_in_use to true MUST
00124      //- set it to false before returning.
00125      
00126   CubitBoolean start_unmerge();
00127   void end_unmerge( CubitBoolean top );
00128      //- Handle setting unmerged_list_in_use, clearing lists,
00129      //- and calling cleanup_unmerge().
00130 
00131   OldUnmergeCode() : unmerged_list_in_use(false) {}
00132   
00133   static bool useOldUnmergeCode;
00134   
00135 };
00136 
00137 //-------------------------------------------------------------------------
00138 // Purpose       : Start/stop unmerge
00139 //
00140 // Special Notes : 
00141 //
00142 // Creator       : Jason Kraftcheck
00143 //
00144 // Creation Date : 01/18/01
00145 //-------------------------------------------------------------------------
00146 inline CubitBoolean OldUnmergeCode::start_unmerge()
00147 { 
00148   if( unmerged_list_in_use ) return CUBIT_FALSE;
00149   new_unmerged.clean_out();
00150   old_unmerged.clean_out();
00151   unmerge_modified.clean_out();
00152   unmerged_list_in_use = CUBIT_TRUE;
00153   return CUBIT_TRUE;
00154 }
00155 inline void OldUnmergeCode::end_unmerge( CubitBoolean top )
00156 {
00157   if( top )
00158   {
00159     unmerged_list_in_use = CUBIT_FALSE;
00160     cleanup_unmerge();
00161   }
00162 } 
00163 
00164 
00165 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines