Version: 8.3.0
SMESHDS_Mesh.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SMESH SMESHDS : management of mesh data and SMESH document
24 // File : SMESHDS_Mesh.hxx
25 // Module : SMESH
26 //
27 #ifndef _SMESHDS_Mesh_HeaderFile
28 #define _SMESHDS_Mesh_HeaderFile
29 
30 #include "SMESH_SMESHDS.hxx"
31 
32 #include "SMDS_Mesh.hxx"
33 #include "SMESHDS_SubMesh.hxx"
34 
35 #include <TopTools_IndexedMapOfShape.hxx>
36 #include <TopoDS_Shape.hxx>
37 
38 #include <map>
39 
40 class TopoDS_Solid ;
41 class TopoDS_Shell ;
42 class TopoDS_Face ;
43 class TopoDS_Vertex;
44 class TopoDS_Edge ;
45 
46 class SMESHDS_Script;
47 class SMESHDS_Hypothesis;
48 class SMDS_MeshNode ;
49 class SMDS_MeshEdge ;
50 class SMDS_MeshFace ;
51 class SMDS_MeshVolume ;
52 class SMDS_Mesh0DElement;
54 
55 /*
56  * Using of native hash_map isn't portable and don't work on WIN32 platform.
57  * So this functionality implement on new NCollection_DataMap technology
58  */
59 #include <NCollection_DataMap.hxx>
61 typedef std::list<const SMESHDS_Hypothesis*> THypList;
62 typedef NCollection_DataMap< TopoDS_Shape, THypList, SMESHDS_Hasher > ShapeToHypothesis;
63 
64 class SMESHDS_GroupBase;
65 class DownIdType;
66 
68 {
69 public:
70  SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode);
71  bool IsEmbeddedMode();
72  void SetPersistentId(int id);
73  int GetPersistentId() const;
74 
75  void ShapeToMesh(const TopoDS_Shape & S);
76  TopoDS_Shape ShapeToMesh() const;
77  bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H);
78  bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
79 
80  virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
81  virtual SMDS_MeshNode* AddNode(double x, double y, double z);
82 
83  virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID);
84  virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID);
85  virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * node);
86 
87  virtual SMDS_BallElement* AddBallWithID(int n, double diameter, int ID);
88  virtual SMDS_BallElement* AddBallWithID(const SMDS_MeshNode * n, double diameter, int ID);
89  virtual SMDS_BallElement* AddBall (const SMDS_MeshNode * n, double diameter);
90 
91  virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
92  virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
93  const SMDS_MeshNode * n2,
94  int ID);
95  virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
96  const SMDS_MeshNode * n2);
97 
98  // 2d order edge with 3 nodes: n12 - node between n1 and n2
99  virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
100  virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
101  const SMDS_MeshNode * n2,
102  const SMDS_MeshNode * n12,
103  int ID);
104  virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
105  const SMDS_MeshNode * n2,
106  const SMDS_MeshNode * n12);
107  // tria 3
108  virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
109  virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
110  const SMDS_MeshNode * n2,
111  const SMDS_MeshNode * n3,
112  int ID);
113  virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
114  const SMDS_MeshNode * n2,
115  const SMDS_MeshNode * n3);
116  // quad 4
117  virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
118  virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
119  const SMDS_MeshNode * n2,
120  const SMDS_MeshNode * n3,
121  const SMDS_MeshNode * n4,
122  int ID);
123  virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
124  const SMDS_MeshNode * n2,
125  const SMDS_MeshNode * n3,
126  const SMDS_MeshNode * n4);
127 
128  // 2d order triangle of 6 nodes
129  virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
130  int n12,int n23,int n31, int ID);
131  virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
132  const SMDS_MeshNode * n2,
133  const SMDS_MeshNode * n3,
134  const SMDS_MeshNode * n12,
135  const SMDS_MeshNode * n23,
136  const SMDS_MeshNode * n31,
137  int ID);
138  virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
139  const SMDS_MeshNode * n2,
140  const SMDS_MeshNode * n3,
141  const SMDS_MeshNode * n12,
142  const SMDS_MeshNode * n23,
143  const SMDS_MeshNode * n31);
144 
145  // biquadratic triangle of 7 nodes
146  virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
147  int n12,int n23,int n31, int nCenter, int ID);
148  virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
149  const SMDS_MeshNode * n2,
150  const SMDS_MeshNode * n3,
151  const SMDS_MeshNode * n12,
152  const SMDS_MeshNode * n23,
153  const SMDS_MeshNode * n31,
154  const SMDS_MeshNode * nCenter,
155  int ID);
156  virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
157  const SMDS_MeshNode * n2,
158  const SMDS_MeshNode * n3,
159  const SMDS_MeshNode * n12,
160  const SMDS_MeshNode * n23,
161  const SMDS_MeshNode * n31,
162  const SMDS_MeshNode * nCenter);
163 
164  // 2d order quadrangle
165  virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
166  int n12,int n23,int n34,int n41, int ID);
167  virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
168  const SMDS_MeshNode * n2,
169  const SMDS_MeshNode * n3,
170  const SMDS_MeshNode * n4,
171  const SMDS_MeshNode * n12,
172  const SMDS_MeshNode * n23,
173  const SMDS_MeshNode * n34,
174  const SMDS_MeshNode * n41,
175  int ID);
176  virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
177  const SMDS_MeshNode * n2,
178  const SMDS_MeshNode * n3,
179  const SMDS_MeshNode * n4,
180  const SMDS_MeshNode * n12,
181  const SMDS_MeshNode * n23,
182  const SMDS_MeshNode * n34,
183  const SMDS_MeshNode * n41);
184 
185  // biquadratic quadrangle of 9 nodes
186  virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
187  int n12,int n23,int n34,int n41, int nCenter, int ID);
188  virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
189  const SMDS_MeshNode * n2,
190  const SMDS_MeshNode * n3,
191  const SMDS_MeshNode * n4,
192  const SMDS_MeshNode * n12,
193  const SMDS_MeshNode * n23,
194  const SMDS_MeshNode * n34,
195  const SMDS_MeshNode * n41,
196  const SMDS_MeshNode * nCenter,
197  int ID);
198  virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
199  const SMDS_MeshNode * n2,
200  const SMDS_MeshNode * n3,
201  const SMDS_MeshNode * n4,
202  const SMDS_MeshNode * n12,
203  const SMDS_MeshNode * n23,
204  const SMDS_MeshNode * n34,
205  const SMDS_MeshNode * n41,
206  const SMDS_MeshNode * nCenter);
207  // tetra 4
208  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
209  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
210  const SMDS_MeshNode * n2,
211  const SMDS_MeshNode * n3,
212  const SMDS_MeshNode * n4,
213  int ID);
214  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
215  const SMDS_MeshNode * n2,
216  const SMDS_MeshNode * n3,
217  const SMDS_MeshNode * n4);
218  // pyra 5
219  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
220  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
221  const SMDS_MeshNode * n2,
222  const SMDS_MeshNode * n3,
223  const SMDS_MeshNode * n4,
224  const SMDS_MeshNode * n5,
225  int ID);
226  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
227  const SMDS_MeshNode * n2,
228  const SMDS_MeshNode * n3,
229  const SMDS_MeshNode * n4,
230  const SMDS_MeshNode * n5);
231  // penta 6
232  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
233  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
234  const SMDS_MeshNode * n2,
235  const SMDS_MeshNode * n3,
236  const SMDS_MeshNode * n4,
237  const SMDS_MeshNode * n5,
238  const SMDS_MeshNode * n6,
239  int ID);
240  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
241  const SMDS_MeshNode * n2,
242  const SMDS_MeshNode * n3,
243  const SMDS_MeshNode * n4,
244  const SMDS_MeshNode * n5,
245  const SMDS_MeshNode * n6);
246  // hexa 8
247  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
248  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
249  const SMDS_MeshNode * n2,
250  const SMDS_MeshNode * n3,
251  const SMDS_MeshNode * n4,
252  const SMDS_MeshNode * n5,
253  const SMDS_MeshNode * n6,
254  const SMDS_MeshNode * n7,
255  const SMDS_MeshNode * n8,
256  int ID);
257  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
258  const SMDS_MeshNode * n2,
259  const SMDS_MeshNode * n3,
260  const SMDS_MeshNode * n4,
261  const SMDS_MeshNode * n5,
262  const SMDS_MeshNode * n6,
263  const SMDS_MeshNode * n7,
264  const SMDS_MeshNode * n8);
265  // hexagonal prism of 12 nodes
266  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6,
267  int n7, int n8, int n9, int n10, int n11, int n12, int ID);
268  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
269  const SMDS_MeshNode * n2,
270  const SMDS_MeshNode * n3,
271  const SMDS_MeshNode * n4,
272  const SMDS_MeshNode * n5,
273  const SMDS_MeshNode * n6,
274  const SMDS_MeshNode * n7,
275  const SMDS_MeshNode * n8,
276  const SMDS_MeshNode * n9,
277  const SMDS_MeshNode * n10,
278  const SMDS_MeshNode * n11,
279  const SMDS_MeshNode * n12,
280  int ID);
281  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
282  const SMDS_MeshNode * n2,
283  const SMDS_MeshNode * n3,
284  const SMDS_MeshNode * n4,
285  const SMDS_MeshNode * n5,
286  const SMDS_MeshNode * n6,
287  const SMDS_MeshNode * n7,
288  const SMDS_MeshNode * n8,
289  const SMDS_MeshNode * n9,
290  const SMDS_MeshNode * n10,
291  const SMDS_MeshNode * n11,
292  const SMDS_MeshNode * n12);
293 
294  // 2d order tetrahedron of 10 nodes
295  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
296  int n12,int n23,int n31,
297  int n14,int n24,int n34, int ID);
298  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
299  const SMDS_MeshNode * n2,
300  const SMDS_MeshNode * n3,
301  const SMDS_MeshNode * n4,
302  const SMDS_MeshNode * n12,
303  const SMDS_MeshNode * n23,
304  const SMDS_MeshNode * n31,
305  const SMDS_MeshNode * n14,
306  const SMDS_MeshNode * n24,
307  const SMDS_MeshNode * n34,
308  int ID);
309  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
310  const SMDS_MeshNode * n2,
311  const SMDS_MeshNode * n3,
312  const SMDS_MeshNode * n4,
313  const SMDS_MeshNode * n12,
314  const SMDS_MeshNode * n23,
315  const SMDS_MeshNode * n31,
316  const SMDS_MeshNode * n14,
317  const SMDS_MeshNode * n24,
318  const SMDS_MeshNode * n34);
319 
320  // 2d order pyramid of 13 nodes
321  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
322  int n12,int n23,int n34,int n41,
323  int n15,int n25,int n35,int n45,
324  int ID);
325  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
326  const SMDS_MeshNode * n2,
327  const SMDS_MeshNode * n3,
328  const SMDS_MeshNode * n4,
329  const SMDS_MeshNode * n5,
330  const SMDS_MeshNode * n12,
331  const SMDS_MeshNode * n23,
332  const SMDS_MeshNode * n34,
333  const SMDS_MeshNode * n41,
334  const SMDS_MeshNode * n15,
335  const SMDS_MeshNode * n25,
336  const SMDS_MeshNode * n35,
337  const SMDS_MeshNode * n45,
338  int ID);
339  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
340  const SMDS_MeshNode * n2,
341  const SMDS_MeshNode * n3,
342  const SMDS_MeshNode * n4,
343  const SMDS_MeshNode * n5,
344  const SMDS_MeshNode * n12,
345  const SMDS_MeshNode * n23,
346  const SMDS_MeshNode * n34,
347  const SMDS_MeshNode * n41,
348  const SMDS_MeshNode * n15,
349  const SMDS_MeshNode * n25,
350  const SMDS_MeshNode * n35,
351  const SMDS_MeshNode * n45);
352 
353  // 2d order Pentahedron with 15 nodes
354  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
355  int n4, int n5, int n6,
356  int n12,int n23,int n31,
357  int n45,int n56,int n64,
358  int n14,int n25,int n36,
359  int ID);
360  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
361  const SMDS_MeshNode * n2,
362  const SMDS_MeshNode * n3,
363  const SMDS_MeshNode * n4,
364  const SMDS_MeshNode * n5,
365  const SMDS_MeshNode * n6,
366  const SMDS_MeshNode * n12,
367  const SMDS_MeshNode * n23,
368  const SMDS_MeshNode * n31,
369  const SMDS_MeshNode * n45,
370  const SMDS_MeshNode * n56,
371  const SMDS_MeshNode * n64,
372  const SMDS_MeshNode * n14,
373  const SMDS_MeshNode * n25,
374  const SMDS_MeshNode * n36,
375  int ID);
376  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
377  const SMDS_MeshNode * n2,
378  const SMDS_MeshNode * n3,
379  const SMDS_MeshNode * n4,
380  const SMDS_MeshNode * n5,
381  const SMDS_MeshNode * n6,
382  const SMDS_MeshNode * n12,
383  const SMDS_MeshNode * n23,
384  const SMDS_MeshNode * n31,
385  const SMDS_MeshNode * n45,
386  const SMDS_MeshNode * n56,
387  const SMDS_MeshNode * n64,
388  const SMDS_MeshNode * n14,
389  const SMDS_MeshNode * n25,
390  const SMDS_MeshNode * n36);
391 
392  // 2d order Hexahedrons with 20 nodes
393  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
394  int n5, int n6, int n7, int n8,
395  int n12,int n23,int n34,int n41,
396  int n56,int n67,int n78,int n85,
397  int n15,int n26,int n37,int n48,
398  int ID);
399  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
400  const SMDS_MeshNode * n2,
401  const SMDS_MeshNode * n3,
402  const SMDS_MeshNode * n4,
403  const SMDS_MeshNode * n5,
404  const SMDS_MeshNode * n6,
405  const SMDS_MeshNode * n7,
406  const SMDS_MeshNode * n8,
407  const SMDS_MeshNode * n12,
408  const SMDS_MeshNode * n23,
409  const SMDS_MeshNode * n34,
410  const SMDS_MeshNode * n41,
411  const SMDS_MeshNode * n56,
412  const SMDS_MeshNode * n67,
413  const SMDS_MeshNode * n78,
414  const SMDS_MeshNode * n85,
415  const SMDS_MeshNode * n15,
416  const SMDS_MeshNode * n26,
417  const SMDS_MeshNode * n37,
418  const SMDS_MeshNode * n48,
419  int ID);
420  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
421  const SMDS_MeshNode * n2,
422  const SMDS_MeshNode * n3,
423  const SMDS_MeshNode * n4,
424  const SMDS_MeshNode * n5,
425  const SMDS_MeshNode * n6,
426  const SMDS_MeshNode * n7,
427  const SMDS_MeshNode * n8,
428  const SMDS_MeshNode * n12,
429  const SMDS_MeshNode * n23,
430  const SMDS_MeshNode * n34,
431  const SMDS_MeshNode * n41,
432  const SMDS_MeshNode * n56,
433  const SMDS_MeshNode * n67,
434  const SMDS_MeshNode * n78,
435  const SMDS_MeshNode * n85,
436  const SMDS_MeshNode * n15,
437  const SMDS_MeshNode * n26,
438  const SMDS_MeshNode * n37,
439  const SMDS_MeshNode * n48);
440 
441  // 2d order Hexahedrons with 27 nodes
442  virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
443  int n5, int n6, int n7, int n8,
444  int n12,int n23,int n34,int n41,
445  int n56,int n67,int n78,int n85,
446  int n15,int n26,int n37,int n48,
447  int n1234,int n1256,int n2367,int n3478,
448  int n1458,int n5678,int nCenter,
449  int ID);
450  virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
451  const SMDS_MeshNode * n2,
452  const SMDS_MeshNode * n3,
453  const SMDS_MeshNode * n4,
454  const SMDS_MeshNode * n5,
455  const SMDS_MeshNode * n6,
456  const SMDS_MeshNode * n7,
457  const SMDS_MeshNode * n8,
458  const SMDS_MeshNode * n12,
459  const SMDS_MeshNode * n23,
460  const SMDS_MeshNode * n34,
461  const SMDS_MeshNode * n41,
462  const SMDS_MeshNode * n56,
463  const SMDS_MeshNode * n67,
464  const SMDS_MeshNode * n78,
465  const SMDS_MeshNode * n85,
466  const SMDS_MeshNode * n15,
467  const SMDS_MeshNode * n26,
468  const SMDS_MeshNode * n37,
469  const SMDS_MeshNode * n48,
470  const SMDS_MeshNode * n1234,
471  const SMDS_MeshNode * n1256,
472  const SMDS_MeshNode * n2367,
473  const SMDS_MeshNode * n3478,
474  const SMDS_MeshNode * n1458,
475  const SMDS_MeshNode * n5678,
476  const SMDS_MeshNode * nCenter,
477  int ID);
478  virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
479  const SMDS_MeshNode * n2,
480  const SMDS_MeshNode * n3,
481  const SMDS_MeshNode * n4,
482  const SMDS_MeshNode * n5,
483  const SMDS_MeshNode * n6,
484  const SMDS_MeshNode * n7,
485  const SMDS_MeshNode * n8,
486  const SMDS_MeshNode * n12,
487  const SMDS_MeshNode * n23,
488  const SMDS_MeshNode * n34,
489  const SMDS_MeshNode * n41,
490  const SMDS_MeshNode * n56,
491  const SMDS_MeshNode * n67,
492  const SMDS_MeshNode * n78,
493  const SMDS_MeshNode * n85,
494  const SMDS_MeshNode * n15,
495  const SMDS_MeshNode * n26,
496  const SMDS_MeshNode * n37,
497  const SMDS_MeshNode * n48,
498  const SMDS_MeshNode * n1234,
499  const SMDS_MeshNode * n1256,
500  const SMDS_MeshNode * n2367,
501  const SMDS_MeshNode * n3478,
502  const SMDS_MeshNode * n1458,
503  const SMDS_MeshNode * n5678,
504  const SMDS_MeshNode * nCenter);
505 
506  virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<int>& nodes_ids,
507  const int ID);
508 
509  virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<const SMDS_MeshNode*>& nodes,
510  const int ID);
511 
512  virtual SMDS_MeshFace* AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes);
513 
514  virtual SMDS_MeshFace* AddQuadPolygonalFaceWithID(const std::vector<int> & nodes_ids,
515  const int ID);
516 
517  virtual SMDS_MeshFace* AddQuadPolygonalFaceWithID(const std::vector<const SMDS_MeshNode*> & nodes,
518  const int ID);
519 
520  virtual SMDS_MeshFace* AddQuadPolygonalFace(const std::vector<const SMDS_MeshNode*> & nodes);
521 
523  (const std::vector<int>& nodes_ids,
524  const std::vector<int>& quantities,
525  const int ID);
526 
528  (const std::vector<const SMDS_MeshNode*>& nodes,
529  const std::vector<int>& quantities,
530  const int ID);
531 
533  (const std::vector<const SMDS_MeshNode*>& nodes,
534  const std::vector<int>& quantities);
535 
536  virtual void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
537  virtual void RemoveNode(const SMDS_MeshNode *);
538  void RemoveElement(const SMDS_MeshElement *);
539 
544  void RemoveFreeNode (const SMDS_MeshNode *, SMESHDS_SubMesh *, bool fromGroups=true);
545  void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *, bool fromGroups=true);
546 
547  void ClearMesh();
548 
549  bool ChangeElementNodes(const SMDS_MeshElement * elem,
550  const SMDS_MeshNode * nodes[],
551  const int nbnodes);
552  bool ChangePolygonNodes(const SMDS_MeshElement * elem,
553  std::vector<const SMDS_MeshNode*> nodes);
554  bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
555  std::vector<const SMDS_MeshNode*> nodes,
556  std::vector<int> quantities);
557  bool ModifyCellNodes(int smdsVolId, std::map<int,int> localClonedNodeIds);
558  void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
559 
560  void SetNodeInVolume(const SMDS_MeshNode * aNode, const TopoDS_Shell & S);
561  void SetNodeInVolume(const SMDS_MeshNode * aNode, const TopoDS_Solid & S);
562  void SetNodeOnFace (const SMDS_MeshNode * aNode, const TopoDS_Face& S, double u=0.,double v=0.);
563  void SetNodeOnEdge (const SMDS_MeshNode * aNode, const TopoDS_Edge& S, double u=0.);
564  void SetNodeOnVertex(const SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
565  void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
566  void SetMeshElementOnShape (const SMDS_MeshElement * anElt, const TopoDS_Shape & S);
567  void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt, const TopoDS_Shape & S);
568  void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
569  void SetNodeOnFace (const SMDS_MeshNode * aNode, int Index, double u=0., double v=0.);
570  void SetNodeOnEdge (const SMDS_MeshNode * aNode, int Index, double u=0.);
571  void SetNodeOnVertex(const SMDS_MeshNode * aNode, int Index);
572  void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
573  bool HasMeshElements(const TopoDS_Shape & S) const;
574  SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
575  SMESHDS_SubMesh * MeshElements(const int Index) const;
576  std::list<int> SubMeshIndices() const;
577  SMESHDS_SubMeshIteratorPtr SubMeshes() const;
578 
579  bool HasHypothesis(const TopoDS_Shape & S);
580  const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
581  bool IsUsedHypothesis(const SMESHDS_Hypothesis * H) const;
582  const ShapeToHypothesis & GetHypotheses() const { return myShapeToHypothesis; }
583 
584  SMESHDS_Script * GetScript();
585  void ClearScript();
586 
587  int ShapeToIndex(const TopoDS_Shape & aShape) const;
588  const TopoDS_Shape& IndexToShape(int ShapeIndex) const;
589  int MaxShapeIndex() const { return myIndexToShape.Extent(); }
590  int MaxSubMeshIndex() const;
591 
592  SMESHDS_SubMesh * NewSubMesh(int Index);
593  int AddCompoundSubmesh(const TopoDS_Shape& S, TopAbs_ShapeEnum type = TopAbs_SHAPE);
594 
595  // Groups. SMESHDS_Mesh is not an owner of groups
596  void AddGroup (SMESHDS_GroupBase* theGroup) { myGroups.insert(theGroup); }
597  void RemoveGroup (SMESHDS_GroupBase* theGroup) { myGroups.erase(theGroup); }
598  int GetNbGroups() const { return myGroups.size(); }
599  const std::set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
600 
601  bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
602 
603  virtual void compactMesh();
604  void CleanDownWardConnectivity();
605  void BuildDownWardConnectivity(bool withEdges);
606 
607  ~SMESHDS_Mesh();
608 
609 private:
610 
612 
613  int myMeshID, myPersistentID;
614  TopoDS_Shape myShape;
615 
618 
619  TopTools_IndexedMapOfShape myIndexToShape;
620 
621  typedef std::set<SMESHDS_GroupBase*> TGroups;
623 
626 
627  bool add( const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh );
628  SMESHDS_SubMesh* getSubmesh( const TopoDS_Shape & shape);
629 };
630 
631 
632 #endif