1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHDS : management of mesh data and SMESH document
24 // File : SMESHDS_Mesh.hxx
27 #ifndef _SMESHDS_Mesh_HeaderFile
28 #define _SMESHDS_Mesh_HeaderFile
30 #include "SMESH_SMESHDS.hxx"
32 #include "SMDS_Mesh.hxx"
33 #include "SMESHDS_SubMesh.hxx"
35 #include <TopTools_IndexedMapOfShape.hxx>
36 #include <TopoDS_Shape.hxx>
45 class SMESHDS_Hypothesis;
49 class SMDS_MeshVolume ;
50 class SMDS_Mesh0DElement;
51 class SMDS_BallElement;
53 #include <NCollection_DataMap.hxx>
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
59 #include "SMESHDS_DataMapOfShape.hxx"
61 class SMESHDS_GroupBase;
64 class SMESHDS_EXPORT SMESHDS_Mesh:public SMDS_Mesh{
66 SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode);
67 bool IsEmbeddedMode();
68 void SetPersistentId(int id);
69 int GetPersistentId() const;
71 void ShapeToMesh(const TopoDS_Shape & S);
72 TopoDS_Shape ShapeToMesh() const;
73 bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H);
74 bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
76 virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
77 virtual SMDS_MeshNode* AddNode(double x, double y, double z);
79 virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID);
80 virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID);
81 virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * node);
83 virtual SMDS_BallElement* AddBallWithID(int n, double diameter, int ID);
84 virtual SMDS_BallElement* AddBallWithID(const SMDS_MeshNode * n, double diameter, int ID);
85 virtual SMDS_BallElement* AddBall (const SMDS_MeshNode * n, double diameter);
87 virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
88 virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
89 const SMDS_MeshNode * n2,
91 virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
92 const SMDS_MeshNode * n2);
94 // 2d order edge with 3 nodes: n12 - node between n1 and n2
95 virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
96 virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
97 const SMDS_MeshNode * n2,
98 const SMDS_MeshNode * n12,
100 virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
101 const SMDS_MeshNode * n2,
102 const SMDS_MeshNode * n12);
104 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
105 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
106 const SMDS_MeshNode * n2,
107 const SMDS_MeshNode * n3,
109 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
110 const SMDS_MeshNode * n2,
111 const SMDS_MeshNode * n3);
113 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
114 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
115 const SMDS_MeshNode * n2,
116 const SMDS_MeshNode * n3,
117 const SMDS_MeshNode * n4,
119 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
120 const SMDS_MeshNode * n2,
121 const SMDS_MeshNode * n3,
122 const SMDS_MeshNode * n4);
124 // 2d order triangle of 6 nodes
125 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
126 int n12,int n23,int n31, int ID);
127 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
128 const SMDS_MeshNode * n2,
129 const SMDS_MeshNode * n3,
130 const SMDS_MeshNode * n12,
131 const SMDS_MeshNode * n23,
132 const SMDS_MeshNode * n31,
134 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
135 const SMDS_MeshNode * n2,
136 const SMDS_MeshNode * n3,
137 const SMDS_MeshNode * n12,
138 const SMDS_MeshNode * n23,
139 const SMDS_MeshNode * n31);
141 // biquadratic triangle of 7 nodes
142 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
143 int n12,int n23,int n31, int nCenter, int ID);
144 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
145 const SMDS_MeshNode * n2,
146 const SMDS_MeshNode * n3,
147 const SMDS_MeshNode * n12,
148 const SMDS_MeshNode * n23,
149 const SMDS_MeshNode * n31,
150 const SMDS_MeshNode * nCenter,
152 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
153 const SMDS_MeshNode * n2,
154 const SMDS_MeshNode * n3,
155 const SMDS_MeshNode * n12,
156 const SMDS_MeshNode * n23,
157 const SMDS_MeshNode * n31,
158 const SMDS_MeshNode * nCenter);
160 // 2d order quadrangle
161 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
162 int n12,int n23,int n34,int n41, int ID);
163 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
164 const SMDS_MeshNode * n2,
165 const SMDS_MeshNode * n3,
166 const SMDS_MeshNode * n4,
167 const SMDS_MeshNode * n12,
168 const SMDS_MeshNode * n23,
169 const SMDS_MeshNode * n34,
170 const SMDS_MeshNode * n41,
172 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
173 const SMDS_MeshNode * n2,
174 const SMDS_MeshNode * n3,
175 const SMDS_MeshNode * n4,
176 const SMDS_MeshNode * n12,
177 const SMDS_MeshNode * n23,
178 const SMDS_MeshNode * n34,
179 const SMDS_MeshNode * n41);
181 // biquadratic quadrangle of 9 nodes
182 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
183 int n12,int n23,int n34,int n41, int nCenter, int ID);
184 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
185 const SMDS_MeshNode * n2,
186 const SMDS_MeshNode * n3,
187 const SMDS_MeshNode * n4,
188 const SMDS_MeshNode * n12,
189 const SMDS_MeshNode * n23,
190 const SMDS_MeshNode * n34,
191 const SMDS_MeshNode * n41,
192 const SMDS_MeshNode * nCenter,
194 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
195 const SMDS_MeshNode * n2,
196 const SMDS_MeshNode * n3,
197 const SMDS_MeshNode * n4,
198 const SMDS_MeshNode * n12,
199 const SMDS_MeshNode * n23,
200 const SMDS_MeshNode * n34,
201 const SMDS_MeshNode * n41,
202 const SMDS_MeshNode * nCenter);
204 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
205 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
206 const SMDS_MeshNode * n2,
207 const SMDS_MeshNode * n3,
208 const SMDS_MeshNode * n4,
210 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
211 const SMDS_MeshNode * n2,
212 const SMDS_MeshNode * n3,
213 const SMDS_MeshNode * n4);
215 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
216 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
217 const SMDS_MeshNode * n2,
218 const SMDS_MeshNode * n3,
219 const SMDS_MeshNode * n4,
220 const SMDS_MeshNode * n5,
222 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
223 const SMDS_MeshNode * n2,
224 const SMDS_MeshNode * n3,
225 const SMDS_MeshNode * n4,
226 const SMDS_MeshNode * n5);
228 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
229 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
230 const SMDS_MeshNode * n2,
231 const SMDS_MeshNode * n3,
232 const SMDS_MeshNode * n4,
233 const SMDS_MeshNode * n5,
234 const SMDS_MeshNode * n6,
236 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
237 const SMDS_MeshNode * n2,
238 const SMDS_MeshNode * n3,
239 const SMDS_MeshNode * n4,
240 const SMDS_MeshNode * n5,
241 const SMDS_MeshNode * n6);
243 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
244 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
245 const SMDS_MeshNode * n2,
246 const SMDS_MeshNode * n3,
247 const SMDS_MeshNode * n4,
248 const SMDS_MeshNode * n5,
249 const SMDS_MeshNode * n6,
250 const SMDS_MeshNode * n7,
251 const SMDS_MeshNode * n8,
253 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
254 const SMDS_MeshNode * n2,
255 const SMDS_MeshNode * n3,
256 const SMDS_MeshNode * n4,
257 const SMDS_MeshNode * n5,
258 const SMDS_MeshNode * n6,
259 const SMDS_MeshNode * n7,
260 const SMDS_MeshNode * n8);
261 // hexagonal prism of 12 nodes
262 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6,
263 int n7, int n8, int n9, int n10, int n11, int n12, int ID);
264 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
265 const SMDS_MeshNode * n2,
266 const SMDS_MeshNode * n3,
267 const SMDS_MeshNode * n4,
268 const SMDS_MeshNode * n5,
269 const SMDS_MeshNode * n6,
270 const SMDS_MeshNode * n7,
271 const SMDS_MeshNode * n8,
272 const SMDS_MeshNode * n9,
273 const SMDS_MeshNode * n10,
274 const SMDS_MeshNode * n11,
275 const SMDS_MeshNode * n12,
277 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
278 const SMDS_MeshNode * n2,
279 const SMDS_MeshNode * n3,
280 const SMDS_MeshNode * n4,
281 const SMDS_MeshNode * n5,
282 const SMDS_MeshNode * n6,
283 const SMDS_MeshNode * n7,
284 const SMDS_MeshNode * n8,
285 const SMDS_MeshNode * n9,
286 const SMDS_MeshNode * n10,
287 const SMDS_MeshNode * n11,
288 const SMDS_MeshNode * n12);
290 // 2d order tetrahedron of 10 nodes
291 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
292 int n12,int n23,int n31,
293 int n14,int n24,int n34, int ID);
294 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
295 const SMDS_MeshNode * n2,
296 const SMDS_MeshNode * n3,
297 const SMDS_MeshNode * n4,
298 const SMDS_MeshNode * n12,
299 const SMDS_MeshNode * n23,
300 const SMDS_MeshNode * n31,
301 const SMDS_MeshNode * n14,
302 const SMDS_MeshNode * n24,
303 const SMDS_MeshNode * n34,
305 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
306 const SMDS_MeshNode * n2,
307 const SMDS_MeshNode * n3,
308 const SMDS_MeshNode * n4,
309 const SMDS_MeshNode * n12,
310 const SMDS_MeshNode * n23,
311 const SMDS_MeshNode * n31,
312 const SMDS_MeshNode * n14,
313 const SMDS_MeshNode * n24,
314 const SMDS_MeshNode * n34);
316 // 2d order pyramid of 13 nodes
317 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
318 int n12,int n23,int n34,int n41,
319 int n15,int n25,int n35,int n45,
321 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
322 const SMDS_MeshNode * n2,
323 const SMDS_MeshNode * n3,
324 const SMDS_MeshNode * n4,
325 const SMDS_MeshNode * n5,
326 const SMDS_MeshNode * n12,
327 const SMDS_MeshNode * n23,
328 const SMDS_MeshNode * n34,
329 const SMDS_MeshNode * n41,
330 const SMDS_MeshNode * n15,
331 const SMDS_MeshNode * n25,
332 const SMDS_MeshNode * n35,
333 const SMDS_MeshNode * n45,
335 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
336 const SMDS_MeshNode * n2,
337 const SMDS_MeshNode * n3,
338 const SMDS_MeshNode * n4,
339 const SMDS_MeshNode * n5,
340 const SMDS_MeshNode * n12,
341 const SMDS_MeshNode * n23,
342 const SMDS_MeshNode * n34,
343 const SMDS_MeshNode * n41,
344 const SMDS_MeshNode * n15,
345 const SMDS_MeshNode * n25,
346 const SMDS_MeshNode * n35,
347 const SMDS_MeshNode * n45);
349 // 2d order Pentahedron with 15 nodes
350 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
351 int n4, int n5, int n6,
352 int n12,int n23,int n31,
353 int n45,int n56,int n64,
354 int n14,int n25,int n36,
356 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
357 const SMDS_MeshNode * n2,
358 const SMDS_MeshNode * n3,
359 const SMDS_MeshNode * n4,
360 const SMDS_MeshNode * n5,
361 const SMDS_MeshNode * n6,
362 const SMDS_MeshNode * n12,
363 const SMDS_MeshNode * n23,
364 const SMDS_MeshNode * n31,
365 const SMDS_MeshNode * n45,
366 const SMDS_MeshNode * n56,
367 const SMDS_MeshNode * n64,
368 const SMDS_MeshNode * n14,
369 const SMDS_MeshNode * n25,
370 const SMDS_MeshNode * n36,
372 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
373 const SMDS_MeshNode * n2,
374 const SMDS_MeshNode * n3,
375 const SMDS_MeshNode * n4,
376 const SMDS_MeshNode * n5,
377 const SMDS_MeshNode * n6,
378 const SMDS_MeshNode * n12,
379 const SMDS_MeshNode * n23,
380 const SMDS_MeshNode * n31,
381 const SMDS_MeshNode * n45,
382 const SMDS_MeshNode * n56,
383 const SMDS_MeshNode * n64,
384 const SMDS_MeshNode * n14,
385 const SMDS_MeshNode * n25,
386 const SMDS_MeshNode * n36);
388 // 2d order Hexahedrons with 20 nodes
389 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
390 int n5, int n6, int n7, int n8,
391 int n12,int n23,int n34,int n41,
392 int n56,int n67,int n78,int n85,
393 int n15,int n26,int n37,int n48,
395 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
396 const SMDS_MeshNode * n2,
397 const SMDS_MeshNode * n3,
398 const SMDS_MeshNode * n4,
399 const SMDS_MeshNode * n5,
400 const SMDS_MeshNode * n6,
401 const SMDS_MeshNode * n7,
402 const SMDS_MeshNode * n8,
403 const SMDS_MeshNode * n12,
404 const SMDS_MeshNode * n23,
405 const SMDS_MeshNode * n34,
406 const SMDS_MeshNode * n41,
407 const SMDS_MeshNode * n56,
408 const SMDS_MeshNode * n67,
409 const SMDS_MeshNode * n78,
410 const SMDS_MeshNode * n85,
411 const SMDS_MeshNode * n15,
412 const SMDS_MeshNode * n26,
413 const SMDS_MeshNode * n37,
414 const SMDS_MeshNode * n48,
416 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
417 const SMDS_MeshNode * n2,
418 const SMDS_MeshNode * n3,
419 const SMDS_MeshNode * n4,
420 const SMDS_MeshNode * n5,
421 const SMDS_MeshNode * n6,
422 const SMDS_MeshNode * n7,
423 const SMDS_MeshNode * n8,
424 const SMDS_MeshNode * n12,
425 const SMDS_MeshNode * n23,
426 const SMDS_MeshNode * n34,
427 const SMDS_MeshNode * n41,
428 const SMDS_MeshNode * n56,
429 const SMDS_MeshNode * n67,
430 const SMDS_MeshNode * n78,
431 const SMDS_MeshNode * n85,
432 const SMDS_MeshNode * n15,
433 const SMDS_MeshNode * n26,
434 const SMDS_MeshNode * n37,
435 const SMDS_MeshNode * n48);
437 // 2d order Hexahedrons with 27 nodes
438 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
439 int n5, int n6, int n7, int n8,
440 int n12,int n23,int n34,int n41,
441 int n56,int n67,int n78,int n85,
442 int n15,int n26,int n37,int n48,
443 int n1234,int n1256,int n2367,int n3478,
444 int n1458,int n5678,int nCenter,
446 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
447 const SMDS_MeshNode * n2,
448 const SMDS_MeshNode * n3,
449 const SMDS_MeshNode * n4,
450 const SMDS_MeshNode * n5,
451 const SMDS_MeshNode * n6,
452 const SMDS_MeshNode * n7,
453 const SMDS_MeshNode * n8,
454 const SMDS_MeshNode * n12,
455 const SMDS_MeshNode * n23,
456 const SMDS_MeshNode * n34,
457 const SMDS_MeshNode * n41,
458 const SMDS_MeshNode * n56,
459 const SMDS_MeshNode * n67,
460 const SMDS_MeshNode * n78,
461 const SMDS_MeshNode * n85,
462 const SMDS_MeshNode * n15,
463 const SMDS_MeshNode * n26,
464 const SMDS_MeshNode * n37,
465 const SMDS_MeshNode * n48,
466 const SMDS_MeshNode * n1234,
467 const SMDS_MeshNode * n1256,
468 const SMDS_MeshNode * n2367,
469 const SMDS_MeshNode * n3478,
470 const SMDS_MeshNode * n1458,
471 const SMDS_MeshNode * n5678,
472 const SMDS_MeshNode * nCenter,
474 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
475 const SMDS_MeshNode * n2,
476 const SMDS_MeshNode * n3,
477 const SMDS_MeshNode * n4,
478 const SMDS_MeshNode * n5,
479 const SMDS_MeshNode * n6,
480 const SMDS_MeshNode * n7,
481 const SMDS_MeshNode * n8,
482 const SMDS_MeshNode * n12,
483 const SMDS_MeshNode * n23,
484 const SMDS_MeshNode * n34,
485 const SMDS_MeshNode * n41,
486 const SMDS_MeshNode * n56,
487 const SMDS_MeshNode * n67,
488 const SMDS_MeshNode * n78,
489 const SMDS_MeshNode * n85,
490 const SMDS_MeshNode * n15,
491 const SMDS_MeshNode * n26,
492 const SMDS_MeshNode * n37,
493 const SMDS_MeshNode * n48,
494 const SMDS_MeshNode * n1234,
495 const SMDS_MeshNode * n1256,
496 const SMDS_MeshNode * n2367,
497 const SMDS_MeshNode * n3478,
498 const SMDS_MeshNode * n1458,
499 const SMDS_MeshNode * n5678,
500 const SMDS_MeshNode * nCenter);
502 virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<int>& nodes_ids,
505 virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<const SMDS_MeshNode*>& nodes,
508 virtual SMDS_MeshFace* AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes);
510 virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
511 (const std::vector<int>& nodes_ids,
512 const std::vector<int>& quantities,
515 virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
516 (const std::vector<const SMDS_MeshNode*>& nodes,
517 const std::vector<int>& quantities,
520 virtual SMDS_MeshVolume* AddPolyhedralVolume
521 (const std::vector<const SMDS_MeshNode*>& nodes,
522 const std::vector<int>& quantities);
524 virtual void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
525 virtual void RemoveNode(const SMDS_MeshNode *);
526 void RemoveElement(const SMDS_MeshElement *);
528 /*! Remove only the given element/node and only if it is free.
529 * Methods do not work for meshes with descendants.
530 * Implemented for fast cleaning of meshes.
532 void RemoveFreeNode (const SMDS_MeshNode *, SMESHDS_SubMesh *, bool fromGroups=true);
533 void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *, bool fromGroups=true);
537 bool ChangeElementNodes(const SMDS_MeshElement * elem,
538 const SMDS_MeshNode * nodes[],
540 bool ChangePolygonNodes(const SMDS_MeshElement * elem,
541 std::vector<const SMDS_MeshNode*> nodes);
542 bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
543 std::vector<const SMDS_MeshNode*> nodes,
544 std::vector<int> quantities);
545 bool ModifyCellNodes(int smdsVolId, std::map<int,int> localClonedNodeIds);
546 void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
548 void SetNodeInVolume(const SMDS_MeshNode * aNode, const TopoDS_Shell & S);
549 void SetNodeInVolume(const SMDS_MeshNode * aNode, const TopoDS_Solid & S);
550 void SetNodeOnFace (const SMDS_MeshNode * aNode, const TopoDS_Face& S, double u=0.,double v=0.);
551 void SetNodeOnEdge (const SMDS_MeshNode * aNode, const TopoDS_Edge& S, double u=0.);
552 void SetNodeOnVertex(const SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
553 void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
554 void SetMeshElementOnShape (const SMDS_MeshElement * anElt, const TopoDS_Shape & S);
555 void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt, const TopoDS_Shape & S);
556 void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
557 void SetNodeOnFace (const SMDS_MeshNode * aNode, int Index, double u=0., double v=0.);
558 void SetNodeOnEdge (const SMDS_MeshNode * aNode, int Index, double u=0.);
559 void SetNodeOnVertex(const SMDS_MeshNode * aNode, int Index);
560 void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
561 bool HasMeshElements(const TopoDS_Shape & S) const;
562 SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
563 SMESHDS_SubMesh * MeshElements(const int Index) const;
564 std::list<int> SubMeshIndices() const;
565 const std::map<int,SMESHDS_SubMesh*>& SubMeshes() const
566 { return myShapeIndexToSubMesh; }
567 const TopoDS_Shape& GetCurrentSubShape() const { return myCurSubShape; }
569 bool HasHypothesis(const TopoDS_Shape & S);
570 const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
571 bool IsUsedHypothesis(const SMESHDS_Hypothesis * H) const;
572 SMESHDS_Script * GetScript();
574 int ShapeToIndex(const TopoDS_Shape & aShape) const;
575 const TopoDS_Shape& IndexToShape(int ShapeIndex) const;
576 int MaxShapeIndex() const { return myIndexToShape.Extent(); }
577 int MaxSubMeshIndex() const;
579 SMESHDS_SubMesh * NewSubMesh(int Index);
580 int AddCompoundSubmesh(const TopoDS_Shape& S, TopAbs_ShapeEnum type = TopAbs_SHAPE);
582 // Groups. SMESHDS_Mesh is not an owner of groups
583 void AddGroup (SMESHDS_GroupBase* theGroup) { myGroups.insert(theGroup); }
584 void RemoveGroup (SMESHDS_GroupBase* theGroup) { myGroups.erase(theGroup); }
585 int GetNbGroups() const { return myGroups.size(); }
586 const std::set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
588 bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
590 virtual void compactMesh();
591 void CleanDownWardConnectivity();
592 void BuildDownWardConnectivity(bool withEdges);
597 void addNodeToSubmesh( const SMDS_MeshNode* aNode, int Index )
599 //Update or build submesh
600 std::map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
601 if ( it == myShapeIndexToSubMesh.end() )
602 it = myShapeIndexToSubMesh.insert( std::make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
603 it->second->AddNode( aNode ); // add aNode to submesh
606 /*int HashCode( const TopoDS_Shape& S, const Standard_Integer theUpper ) const
608 return S.HashCode(2147483647);
611 typedef std::list<const SMESHDS_Hypothesis*> THypList;
613 typedef NCollection_DataMap< TopoDS_Shape, THypList > ShapeToHypothesis;
615 ShapeToHypothesis myShapeToHypothesis;
617 int myMeshID, myPersistentID;
618 TopoDS_Shape myShape;
620 typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
621 TShapeIndexToSubMesh myShapeIndexToSubMesh;
623 TopTools_IndexedMapOfShape myIndexToShape;
625 typedef std::set<SMESHDS_GroupBase*> TGroups;
628 SMESHDS_Script* myScript;
629 bool myIsEmbeddedMode;
631 // optimize addition of nodes/elements to submeshes by, SetNodeInVolume() etc:
632 // avoid search of submeshes in maps
633 bool add( const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh );
634 SMESHDS_SubMesh* getSubmesh( const TopoDS_Shape & shape);
635 SMESHDS_SubMesh* getSubmesh( const int Index );
637 TopoDS_Shape myCurSubShape;
638 SMESHDS_SubMesh* myCurSubMesh;