ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/CAD4FE/src/CAD4FE_MCBody.h
Revision: 27
Committed: Thu Jul 5 15:26:40 2007 UTC (17 years, 10 months ago) by foucault
Content type: text/plain
Original Path: magic/lib/CAD4FE/CAD4FE/src/CAD4FE_MCBody.h
File size: 8647 byte(s)
Log Message:

File Contents

# User Rev Content
1 foucault 27 #ifndef CAD4FE_MCBodyh
2     #define CAD4FE_MCBodyh
3    
4     #include "CAD4FE_MCT_platform.h"
5    
6     //---------------------------------------------------------------------------
7     // include MAGIC Headers
8     #include "gestionversion.h"
9     #include <mg_geometrie.h>
10     //---------------------------------------------------------------------------
11     // Graph stuff goes here !
12     #include <CAD4FE_Graph.h>
13     //---------------------------------------------------------------------------
14     #include <map>
15     #include <vector>
16    
17     #pragma hdrstop
18    
19     #define MCBODY_FOR_EACH_MCEDGE(M,E)\
20     HypergraphLib::Graph *G21graph_tmp=M->G21(); \
21     CAD4FE::MCEdge * E=M->GetMCEdge(G21graph_tmp->GetArcs().begin()->second); \
22     if (G21graph_tmp->GetArcs().size() != 0) \
23     for (HypergraphLib::Graph::MapArcsById::const_iterator iteratorArcs_tmp = G21graph_tmp->GetArcs().begin() \
24     ; \
25     E != NULL && G21graph_tmp->GetArcs().size() != 0; \
26     iteratorArcs_tmp++ , E = (iteratorArcs_tmp != G21graph_tmp->GetArcs().end()) ? M->GetMCEdge(iteratorArcs_tmp->second) : NULL )
27    
28    
29     #define MCBODY_FOR_EACH_MCFACE(M,F)\
30     HypergraphLib::Graph *G21graph_tmp=M->G21(); \
31     CAD4FE::MCFace * F=M->GetMCFace(G21graph_tmp->GetNodes().begin()->second); \
32     if (G21graph_tmp->GetNodes().size() != 0)\
33     for (HypergraphLib::Graph::MapNodesById::const_iterator iteratorNodes_tmp = G21graph_tmp->GetNodes().begin() \
34     ; \
35     F != NULL; \
36     iteratorNodes_tmp++ , F = (iteratorNodes_tmp != G21graph_tmp->GetNodes().end()) ? M->GetMCFace(iteratorNodes_tmp->second) : NULL )
37    
38    
39     #define MCBODY_FOR_EACH_MCVERTEX(M,V)\
40     HypergraphLib::Graph *G10graph_tmp=M->G10();\
41     CAD4FE::MCVertex * V=M->GetMCVertex(G10graph_tmp->GetArcs().begin()->second); \
42     if (G10graph_tmp->GetArcs().size() != 0) \
43     for (HypergraphLib::Graph::MapArcsById::const_iterator iteratorArcs_tmp = G10graph_tmp->GetArcs().begin() \
44     ; \
45     V != NULL ; \
46     iteratorArcs_tmp++ , V = (iteratorArcs_tmp != G10graph_tmp->GetArcs().end()) ? M->GetMCVertex(iteratorArcs_tmp->second) : NULL )
47    
48     class MG_ELEMENT_TOPOLOGIQUE;
49     class MG_GEOMETRIE;
50     class MG_COARETE;
51    
52     namespace CAD4FE {
53    
54     class MCEdge;
55     class MCFace;
56     class MCVertex;
57     class Vector3dKey;
58     class PolyCurve;
59    
60     class CAD4FE_MCT_ITEM RTChanges {
61     public:
62     RTChanges(){};
63     /// map of old to new faces
64     std::multimap < MG_FACE *, MG_FACE * > F;
65     /// map of old to new edges
66     std::multimap < MG_ARETE *, MG_ARETE * > E;
67     /// map of old to new vertices
68     std::multimap < MG_SOMMET *, MG_SOMMET * > V;
69     /// Merge changes
70     void Merge(RTChanges&);
71     };
72     typedef struct RTChanges RTChanges;
73    
74     class CAD4FE_MCT_ITEM MCTChanges {
75     public:
76     MCTChanges(){};
77     /// map of old to new faces
78     std::multimap < MCFace * , MCFace * > F;
79     /// map of old to new edges
80     std::multimap < MCEdge * , MCEdge * > E;
81     /// map of old to new vertices
82     std::multimap < MCVertex * , MCVertex * > V;
83     /// Merge changes
84     void Merge(MCTChanges&);
85     };
86     typedef struct MCTChanges MCTChanges;
87    
88     class CAD4FE_MCT_ITEM MCBody {
89     public:
90     typedef std::map<int, MCFace*> MapMCFaceById;
91     typedef std::map<int, MCEdge*> MapMCEdgeById;
92     typedef std::map<int, MCVertex*> MapMCVertexById;
93    
94     MCBody(MG_GEOMETRIE * __refGeom, MG_VOLUME * __refBody);
95     // Destruction routines
96     ~MCBody();
97    
98     // Construction routines
99     void ReInit();
100     void InitHyperGraphs();
101     double EvaluateBoundaryShape(Graph::Arc *__arcG2V, double __RMin);
102     void InitializeRealGeomData();
103     void InitializeCopyRealToVirtualHyperGraphs();
104     int G2ToNeatoFile (Graph::Graph * __G2, char * __filename, char *__graphname);
105     int G1ToNeatoFile (Graph::Graph * __G1, char * __filename, char *__graphname);
106    
107     Graph::Arc * GetG2ArcFromG1Node(const Graph::Node *) const;
108    
109     Graph::Graph * G10() const;
110     Graph::Graph * G21() const;
111     Graph::Graph * G20() const;
112    
113     MG_GEOMETRIE * GetGeometry(){return _refGeom;};
114    
115     // Link userdata in hypergraphs
116     void Graph_SetUserData(MG_ELEMENT_TOPOLOGIQUE * __topo);
117     void Graph_SetUserData(Graph::Graph * __G, MG_ELEMENT_TOPOLOGIQUE * __topo);
118    
119     // MC Face
120     MCFace * AddMCFace(MG_FACE * __refFace);
121     MCFace * AddMCFace(MCFace *__a, MCFace *__b);
122     MCFace* GetMCFace(const int) const;
123     static MCFace* GetMCFace(Graph::GraphObject * __graphObject);
124     bool Contains(MCFace *) const;
125     void DeleteMCFace(MCFace * __mcFace);
126     // MC Edge
127     MCEdge * AddMCEdge(MG_ARETE * __refEdge);
128     void AddMCEdgeCovertices(MCEdge * __mcEdge, std::vector<MCVertex *> __mcVertex);
129     void DeleteMCEdgeCovertices(MCEdge * __mcEdge);
130     void DeleteMCEdge(MCEdge *__mcEdge);
131     MCEdge * AddMCEdge(MCEdge *__A, MCEdge *__B);
132     MCEdge * AddMCEdge(PolyCurve * );
133     MCEdge* GetMCEdge(const int ) const;
134     static MCEdge* GetMCEdge(Graph::GraphObject * __graphObject);
135     bool Contains(MCEdge *) const;
136     // MC Vertex
137     MCVertex * AddMCVertex(MG_SOMMET * __refVertex);
138     MCVertex * GetMCVertex(const int)const ;
139     void DeleteMCVertex(MCVertex * __mcVertex);
140     static MCVertex * GetMCVertex(Graph::GraphObject * __graphObject);
141     bool Contains(MCVertex *) const;
142    
143     // Create a MCVertex with a defined label
144     MCVertex * CreateMCVertex (MG_SOMMET *);
145     // Split an MC edge at one specified position
146     void SplitEdge(MCEdge * __mcEdge, double __xyz[3], MCTChanges * __mctChanges = 0, RTChanges * __rtChanges = 0);
147     /// Edge suppression algorithm
148     /// Argument #1: MC Edge to delete
149     /// Argument #2: array of MC Face (F1, F2, Fn)
150     /// (F1=2nd face merged (null if no face were merged)
151     /// (F2=2nd face merged (null if no face were merged)
152     /// (Fn=MC Face replacing F1 and F2, or MC Face located on the mc edge)
153     void SuppressMCEdge(MCEdge*, MCFace * __replMCFace[3]);
154     // Vertex suppression algorithm
155     void SuppressMCVertex(MCVertex *, MCTChanges * __mctChanges = 0);
156     // Edge-Vertex Contraction operator
157     void ContractEdgeToVertex(MCEdge * __mcEdge, MCVertex * __targetVertex, std::set <MCEdge*> & , std::set <MCEdge*> &);
158     void MergeVertices(MCVertex * __deleteVertex, MCVertex * __targetVertex, std::set<MCEdge*> & edges);
159    
160     // Topological properties of MCEdges
161     std::set < MCFace * > Edge_GetAdjacentFaces(MCEdge * __mcEdge);
162     void Edge_GetVertices (MCEdge *, std::vector<MCVertex*> & __mcVertices);
163    
164     // Topological properties of MCFaces
165     void MCBody::Face_GetMCVertices (MCFace * __mcFace, std::vector<MCVertex*> & __mcVertices);
166     std::set < MCEdge * > Face_GetAdjacentEdges(MCFace * __mcFace);
167     Graph::Graph * Face_G10SubGraph(MCFace * __mcFace);
168     std::vector < std::vector < MCEdge * > > Face_GetUnsortedLoops(MCFace * __mcFace);
169     std::vector < std::vector < MCEdge * > > Face_GetCycles(MCFace * __mcFace);
170    
171     // Topological properties of MCVertices
172     void Vertex_GetAdjacentEdges(MCVertex * __mcVertex, std::vector<MCEdge *> & __list);
173     void Vertex_GetAdjacentEdges(MCVertex * __mcVertex, std::set<MCEdge *> & __list);
174     void Vertex_GetAdjacentFaces(MCVertex * __mcVertex, std::set<MCFace *> & __list);
175    
176     // Generate Loops of MC Faces
177     void MCFace_GetLoops(MCFace* __mcFace, const std::set < Graph::Node * > & scc, std::vector < std::vector < std::pair < int, MCEdge * > > > & __loops );
178     MG_COARETE * CreateCoEdge(MCFace * mcFace, MG_BOUCLE * mcLoop, MCEdge * mcEdge);
179     MG_COARETE * CreateCoEdge(MCFace * mcFace, MG_BOUCLE * mcLoop, MCEdge * mcEdge, int sense);
180     int ExportBRep_MCEdgeSense(MCFace * __mcFace, MCEdge * __mcEdge);
181     // Export MC Body hypergraphs to BRep volume
182     MG_VOLUME * ExportBRep();
183     // delete all B-Rep MC entites
184     int DeleteBRep(MG_GESTIONNAIRE * gest, MG_GEOMETRIE * mggeo);
185    
186     /** modification time : represent the last step number
187     * of the MCAA process which created or modified this entity */
188     int time;
189    
190     private:
191     MG_GEOMETRIE * _refGeom;
192     MG_VOLUME * _refBody;
193     MG_VOLUME * _brep;
194     Graph::Graph *_G10;
195     Graph::Graph *_G20;
196     Graph::Graph *_G21;
197     };
198    
199     }
200    
201     #endif // CAD4FE_VIRTUALTOPOLOGYMODEL_H