Branch data Line data Source code
1 : : #ifndef OLD_UNMERGE_CODE_HPP
2 : : #define OLD_UNMERGE_CODE_HPP
3 : :
4 : : #include "CubitDefines.h"
5 : : #include "DLIList.hpp"
6 : : #include "CGMGeomConfigure.h"
7 : :
8 : : class RefEntity;
9 : : class Body;
10 : : class RefVolume;
11 : : class RefFace;
12 : : class Loop;
13 : : class RefEdge;
14 : : class RefVertex;
15 : : class UnMergeEvent;
16 : :
17 : : class TopologyBridge;
18 : : class Surface;
19 : : class LoopSM;
20 : : class Curve;
21 : : class TBPoint;
22 : :
23 : :
24 [ # # ][ # # ]: 0 : class CUBIT_GEOM_EXPORT OldUnmergeCode
[ # # ]
25 : : {
26 : : public:
27 : :
28 : : static OldUnmergeCode& instance();
29 : :
30 : : static void initialize_settings();
31 : :
32 : : CubitStatus unmerge_all();
33 : : //- Unmerge everything.
34 : :
35 : : CubitStatus
36 : : unmerge( DLIList<RefEntity*>& entity_list, CubitBoolean descend = CUBIT_TRUE );
37 : : //- Unmerge entities in list.
38 : : //- If decend is true, will decend topology graph, unmerging child topology
39 : : //- of the passed topology. If decend is false, a.) passing bodies or volumes
40 : : //- in entity list will have no effect and b.) when a surface is unmerged
41 : : //- its child curves will not be unmerged, and the child vertices will not be
42 : : //- unmerged when an edge is unmerged.
43 : :
44 : : CubitStatus unmerge( RefEntity* entity_ptr, CubitBoolean descend = CUBIT_TRUE );
45 : : CubitStatus unmerge( RefFace* face_ptr, CubitBoolean descend = CUBIT_TRUE );
46 : : CubitStatus unmerge( RefEdge* edge_ptr, CubitBoolean descend = CUBIT_TRUE );
47 : : CubitStatus unmerge( Body* body_ptr );
48 : : CubitStatus unmerge( RefVolume* vol_ptr );
49 : : CubitStatus unmerge( RefVertex* vertex_ptr );
50 : : //- Unmerge the passed entity. All parents must already be
51 : : //- unmerged.
52 : : //- If decend is true, will decend topology graph, unmerging child topology
53 : : //- of the passed topology. If decend is false, a.) passing bodies or volumes
54 : : //- in entity list will have no effect and b.) when a surface is unmerged
55 : : //- its child curves will not be unmerged, and the child vertices will not be
56 : : //- unmerged when an edge is unmerged.
57 : :
58 : :
59 : : static bool get_use_old_unmerge_code();
60 : : static void set_use_old_unmerge_code( bool value );
61 : : // If false (default), functions in this class
62 : : // will just return the result of the new code
63 : : // in MergeTool. If true, the old unmerge code
64 : : // in this class will be used.
65 : :
66 : : private:
67 : :
68 : : RefFace* unmerge( RefFace* face_ptr, RefVolume* parent_ptr );
69 : : RefEdge* unmerge( RefEdge* edge_ptr, RefFace* parent_ptr );
70 : : RefVertex* unmerge( RefVertex* vtx_ptr, RefEdge* parent_ptr );
71 : : //- Split out the merged entity in entity_ptr that is associated
72 : : //- with the passed parent, remove entity_ptr from parent, attach
73 : : //- new, unmerged entity to parent.
74 : : //-
75 : : //- If the passed entity is not a merged entity, no change is made
76 : : //- and the passed entity is returned.
77 : : //-
78 : : //- If the passed entity is a merged entity, the new entity created
79 : : //- by the unmerge is returned.
80 : : //-
81 : : //- NULL is returned if an error was encountered. It is an error
82 : : //- if the passed parent_ptr is a merged entity.
83 : :
84 : : RefFace* split_out_Surface( Surface* surface_ptr, CubitBoolean& reversed );
85 : : RefEdge* split_out_Curves ( DLIList<Curve*>& curve_list, CubitBoolean& reversed );
86 : : RefVertex* split_out_Points ( DLIList<TBPoint*>& point_list );
87 : : //- Split out merged entities from owning BridgeManager, and
88 : : //- construct new topology, including new child GroupingEntities
89 : : //- and child SenseEntities.
90 : : //-
91 : : //- NOTE: All passed TopologyBridges MUST belong to the same BridgeManager.
92 : :
93 : : Loop* split_out_Loop ( LoopSM* loopsm, RefFace* new_loop_owner,
94 : : CubitBoolean reverse );
95 : : //- Unmerge a loop and its child coedges. Loop and coedge directions
96 : : //- for new entities are reversed if reverse == CUBIT_TRUE.
97 : :
98 : : void cleanup_unmerge();
99 : : //- Does post-processing for unmerge (sending events and such.)
100 : :
101 : : static void remove_CAEntityId_attrib( TopologyBridge* tb_ptr );
102 : :
103 : :
104 : : static void find_curves( TBPoint* point_ptr, DLIList<Curve*>& result_set );
105 : : static void find_surfaces( Curve* curve_ptr, DLIList<Surface*>& result_set);
106 : : //- Virtual Geometry will provide all downward topology bridge queries,
107 : : //- but not always the corresponding upwards queries of the topology
108 : : //- bridges. These methods are an implementation of the upward queries
109 : : //- from the downward ones. While somewhat more expensive, this works
110 : : //- around the shortcomming of the VG topology bridge traversals.
111 : :
112 : : DLIList<RefEntity*> new_unmerged;
113 : : DLIList<RefEntity*> old_unmerged;
114 : : DLIList<RefEntity*> unmerge_modified;
115 : : DLIList<UnMergeEvent*> event_list;
116 : : CubitBoolean unmerged_list_in_use;
117 : : //- A list new entities created by unmerging, and a list of
118 : : //- existing entities that were unmerged, and a flag set by the highest
119 : : //- level method called to begin an unmerge. The flag signifies
120 : : //- that lower-level methods should not clear the list when
121 : : //- starting/finishing, and should not try to update the graphics.
122 : : //-
123 : : //- Any method that sets unmerged_list_in_use to true MUST
124 : : //- set it to false before returning.
125 : :
126 : : CubitBoolean start_unmerge();
127 : : void end_unmerge( CubitBoolean top );
128 : : //- Handle setting unmerged_list_in_use, clearing lists,
129 : : //- and calling cleanup_unmerge().
130 : :
131 [ # # ][ # # ]: 0 : OldUnmergeCode() : unmerged_list_in_use(false) {}
[ # # ]
132 : :
133 : : static bool useOldUnmergeCode;
134 : :
135 : : };
136 : :
137 : : //-------------------------------------------------------------------------
138 : : // Purpose : Start/stop unmerge
139 : : //
140 : : // Special Notes :
141 : : //
142 : : // Creator : Jason Kraftcheck
143 : : //
144 : : // Creation Date : 01/18/01
145 : : //-------------------------------------------------------------------------
146 : 0 : inline CubitBoolean OldUnmergeCode::start_unmerge()
147 : : {
148 [ # # ]: 0 : if( unmerged_list_in_use ) return CUBIT_FALSE;
149 : 0 : new_unmerged.clean_out();
150 : 0 : old_unmerged.clean_out();
151 : 0 : unmerge_modified.clean_out();
152 : 0 : unmerged_list_in_use = CUBIT_TRUE;
153 : 0 : return CUBIT_TRUE;
154 : : }
155 : 0 : inline void OldUnmergeCode::end_unmerge( CubitBoolean top )
156 : : {
157 [ # # ]: 0 : if( top )
158 : : {
159 : 0 : unmerged_list_in_use = CUBIT_FALSE;
160 : 0 : cleanup_unmerge();
161 : : }
162 : 0 : }
163 : :
164 : :
165 : : #endif
|