ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/CAD4FE/src/CAD4FE_MCBody.h
Revision: 1158
Committed: Thu Jun 13 22:18:49 2024 UTC (11 months ago) by francois
Content type: text/plain
File size: 9744 byte(s)
Log Message:
compatibilité Ubuntu 22.04
Suppression des refeences à Windows
Ajout d'une banière

File Contents

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