1 // Copyright (C) 2007-2012 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 // 2d order quadrangle
142 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
143 int n12,int n23,int n34,int n41, 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 * n4,
148 const SMDS_MeshNode * n12,
149 const SMDS_MeshNode * n23,
150 const SMDS_MeshNode * n34,
151 const SMDS_MeshNode * n41,
153 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
154 const SMDS_MeshNode * n2,
155 const SMDS_MeshNode * n3,
156 const SMDS_MeshNode * n4,
157 const SMDS_MeshNode * n12,
158 const SMDS_MeshNode * n23,
159 const SMDS_MeshNode * n34,
160 const SMDS_MeshNode * n41);
162 // bi-quadratic quadrangle of 9 nodes
163 virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
164 int n12,int n23,int n34,int n41, int nCenter, int ID);
165 virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
166 const SMDS_MeshNode * n2,
167 const SMDS_MeshNode * n3,
168 const SMDS_MeshNode * n4,
169 const SMDS_MeshNode * n12,
170 const SMDS_MeshNode * n23,
171 const SMDS_MeshNode * n34,
172 const SMDS_MeshNode * n41,
173 const SMDS_MeshNode * nCenter,
175 virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
176 const SMDS_MeshNode * n2,
177 const SMDS_MeshNode * n3,
178 const SMDS_MeshNode * n4,
179 const SMDS_MeshNode * n12,
180 const SMDS_MeshNode * n23,
181 const SMDS_MeshNode * n34,
182 const SMDS_MeshNode * n41,
183 const SMDS_MeshNode * nCenter);
185 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
186 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
187 const SMDS_MeshNode * n2,
188 const SMDS_MeshNode * n3,
189 const SMDS_MeshNode * n4,
191 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
192 const SMDS_MeshNode * n2,
193 const SMDS_MeshNode * n3,
194 const SMDS_MeshNode * n4);
196 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
197 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
198 const SMDS_MeshNode * n2,
199 const SMDS_MeshNode * n3,
200 const SMDS_MeshNode * n4,
201 const SMDS_MeshNode * n5,
203 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
204 const SMDS_MeshNode * n2,
205 const SMDS_MeshNode * n3,
206 const SMDS_MeshNode * n4,
207 const SMDS_MeshNode * n5);
209 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
210 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
211 const SMDS_MeshNode * n2,
212 const SMDS_MeshNode * n3,
213 const SMDS_MeshNode * n4,
214 const SMDS_MeshNode * n5,
215 const SMDS_MeshNode * n6,
217 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
218 const SMDS_MeshNode * n2,
219 const SMDS_MeshNode * n3,
220 const SMDS_MeshNode * n4,
221 const SMDS_MeshNode * n5,
222 const SMDS_MeshNode * n6);
224 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
225 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
226 const SMDS_MeshNode * n2,
227 const SMDS_MeshNode * n3,
228 const SMDS_MeshNode * n4,
229 const SMDS_MeshNode * n5,
230 const SMDS_MeshNode * n6,
231 const SMDS_MeshNode * n7,
232 const SMDS_MeshNode * n8,
234 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
235 const SMDS_MeshNode * n2,
236 const SMDS_MeshNode * n3,
237 const SMDS_MeshNode * n4,
238 const SMDS_MeshNode * n5,
239 const SMDS_MeshNode * n6,
240 const SMDS_MeshNode * n7,
241 const SMDS_MeshNode * n8);
242 // hexagonal prism of 12 nodes
243 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6,
244 int n7, int n8, int n9, int n10, int n11, int n12, int ID);
245 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
246 const SMDS_MeshNode * n2,
247 const SMDS_MeshNode * n3,
248 const SMDS_MeshNode * n4,
249 const SMDS_MeshNode * n5,
250 const SMDS_MeshNode * n6,
251 const SMDS_MeshNode * n7,
252 const SMDS_MeshNode * n8,
253 const SMDS_MeshNode * n9,
254 const SMDS_MeshNode * n10,
255 const SMDS_MeshNode * n11,
256 const SMDS_MeshNode * n12,
258 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
259 const SMDS_MeshNode * n2,
260 const SMDS_MeshNode * n3,
261 const SMDS_MeshNode * n4,
262 const SMDS_MeshNode * n5,
263 const SMDS_MeshNode * n6,
264 const SMDS_MeshNode * n7,
265 const SMDS_MeshNode * n8,
266 const SMDS_MeshNode * n9,
267 const SMDS_MeshNode * n10,
268 const SMDS_MeshNode * n11,
269 const SMDS_MeshNode * n12);
271 // 2d order tetrahedron of 10 nodes
272 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
273 int n12,int n23,int n31,
274 int n14,int n24,int n34, int ID);
275 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
276 const SMDS_MeshNode * n2,
277 const SMDS_MeshNode * n3,
278 const SMDS_MeshNode * n4,
279 const SMDS_MeshNode * n12,
280 const SMDS_MeshNode * n23,
281 const SMDS_MeshNode * n31,
282 const SMDS_MeshNode * n14,
283 const SMDS_MeshNode * n24,
284 const SMDS_MeshNode * n34,
286 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
287 const SMDS_MeshNode * n2,
288 const SMDS_MeshNode * n3,
289 const SMDS_MeshNode * n4,
290 const SMDS_MeshNode * n12,
291 const SMDS_MeshNode * n23,
292 const SMDS_MeshNode * n31,
293 const SMDS_MeshNode * n14,
294 const SMDS_MeshNode * n24,
295 const SMDS_MeshNode * n34);
297 // 2d order pyramid of 13 nodes
298 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
299 int n12,int n23,int n34,int n41,
300 int n15,int n25,int n35,int n45,
302 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
303 const SMDS_MeshNode * n2,
304 const SMDS_MeshNode * n3,
305 const SMDS_MeshNode * n4,
306 const SMDS_MeshNode * n5,
307 const SMDS_MeshNode * n12,
308 const SMDS_MeshNode * n23,
309 const SMDS_MeshNode * n34,
310 const SMDS_MeshNode * n41,
311 const SMDS_MeshNode * n15,
312 const SMDS_MeshNode * n25,
313 const SMDS_MeshNode * n35,
314 const SMDS_MeshNode * n45,
316 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
317 const SMDS_MeshNode * n2,
318 const SMDS_MeshNode * n3,
319 const SMDS_MeshNode * n4,
320 const SMDS_MeshNode * n5,
321 const SMDS_MeshNode * n12,
322 const SMDS_MeshNode * n23,
323 const SMDS_MeshNode * n34,
324 const SMDS_MeshNode * n41,
325 const SMDS_MeshNode * n15,
326 const SMDS_MeshNode * n25,
327 const SMDS_MeshNode * n35,
328 const SMDS_MeshNode * n45);
330 // 2d order Pentahedron with 15 nodes
331 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
332 int n4, int n5, int n6,
333 int n12,int n23,int n31,
334 int n45,int n56,int n64,
335 int n14,int n25,int n36,
337 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
338 const SMDS_MeshNode * n2,
339 const SMDS_MeshNode * n3,
340 const SMDS_MeshNode * n4,
341 const SMDS_MeshNode * n5,
342 const SMDS_MeshNode * n6,
343 const SMDS_MeshNode * n12,
344 const SMDS_MeshNode * n23,
345 const SMDS_MeshNode * n31,
346 const SMDS_MeshNode * n45,
347 const SMDS_MeshNode * n56,
348 const SMDS_MeshNode * n64,
349 const SMDS_MeshNode * n14,
350 const SMDS_MeshNode * n25,
351 const SMDS_MeshNode * n36,
353 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
354 const SMDS_MeshNode * n2,
355 const SMDS_MeshNode * n3,
356 const SMDS_MeshNode * n4,
357 const SMDS_MeshNode * n5,
358 const SMDS_MeshNode * n6,
359 const SMDS_MeshNode * n12,
360 const SMDS_MeshNode * n23,
361 const SMDS_MeshNode * n31,
362 const SMDS_MeshNode * n45,
363 const SMDS_MeshNode * n56,
364 const SMDS_MeshNode * n64,
365 const SMDS_MeshNode * n14,
366 const SMDS_MeshNode * n25,
367 const SMDS_MeshNode * n36);
369 // 2d order Hexahedrons with 20 nodes
370 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
371 int n5, int n6, int n7, int n8,
372 int n12,int n23,int n34,int n41,
373 int n56,int n67,int n78,int n85,
374 int n15,int n26,int n37,int n48,
376 virtual SMDS_MeshVolume* AddVolumeWithID(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 * n7,
383 const SMDS_MeshNode * n8,
384 const SMDS_MeshNode * n12,
385 const SMDS_MeshNode * n23,
386 const SMDS_MeshNode * n34,
387 const SMDS_MeshNode * n41,
388 const SMDS_MeshNode * n56,
389 const SMDS_MeshNode * n67,
390 const SMDS_MeshNode * n78,
391 const SMDS_MeshNode * n85,
392 const SMDS_MeshNode * n15,
393 const SMDS_MeshNode * n26,
394 const SMDS_MeshNode * n37,
395 const SMDS_MeshNode * n48,
397 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
398 const SMDS_MeshNode * n2,
399 const SMDS_MeshNode * n3,
400 const SMDS_MeshNode * n4,
401 const SMDS_MeshNode * n5,
402 const SMDS_MeshNode * n6,
403 const SMDS_MeshNode * n7,
404 const SMDS_MeshNode * n8,
405 const SMDS_MeshNode * n12,
406 const SMDS_MeshNode * n23,
407 const SMDS_MeshNode * n34,
408 const SMDS_MeshNode * n41,
409 const SMDS_MeshNode * n56,
410 const SMDS_MeshNode * n67,
411 const SMDS_MeshNode * n78,
412 const SMDS_MeshNode * n85,
413 const SMDS_MeshNode * n15,
414 const SMDS_MeshNode * n26,
415 const SMDS_MeshNode * n37,
416 const SMDS_MeshNode * n48);
418 // 2d order Hexahedrons with 27 nodes
419 virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
420 int n5, int n6, int n7, int n8,
421 int n12,int n23,int n34,int n41,
422 int n56,int n67,int n78,int n85,
423 int n15,int n26,int n37,int n48,
424 int n1234,int n1256,int n2367,int n3478,
425 int n1458,int n5678,int nCenter,
427 virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
428 const SMDS_MeshNode * n2,
429 const SMDS_MeshNode * n3,
430 const SMDS_MeshNode * n4,
431 const SMDS_MeshNode * n5,
432 const SMDS_MeshNode * n6,
433 const SMDS_MeshNode * n7,
434 const SMDS_MeshNode * n8,
435 const SMDS_MeshNode * n12,
436 const SMDS_MeshNode * n23,
437 const SMDS_MeshNode * n34,
438 const SMDS_MeshNode * n41,
439 const SMDS_MeshNode * n56,
440 const SMDS_MeshNode * n67,
441 const SMDS_MeshNode * n78,
442 const SMDS_MeshNode * n85,
443 const SMDS_MeshNode * n15,
444 const SMDS_MeshNode * n26,
445 const SMDS_MeshNode * n37,
446 const SMDS_MeshNode * n48,
447 const SMDS_MeshNode * n1234,
448 const SMDS_MeshNode * n1256,
449 const SMDS_MeshNode * n2367,
450 const SMDS_MeshNode * n3478,
451 const SMDS_MeshNode * n1458,
452 const SMDS_MeshNode * n5678,
453 const SMDS_MeshNode * nCenter,
455 virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
456 const SMDS_MeshNode * n2,
457 const SMDS_MeshNode * n3,
458 const SMDS_MeshNode * n4,
459 const SMDS_MeshNode * n5,
460 const SMDS_MeshNode * n6,
461 const SMDS_MeshNode * n7,
462 const SMDS_MeshNode * n8,
463 const SMDS_MeshNode * n12,
464 const SMDS_MeshNode * n23,
465 const SMDS_MeshNode * n34,
466 const SMDS_MeshNode * n41,
467 const SMDS_MeshNode * n56,
468 const SMDS_MeshNode * n67,
469 const SMDS_MeshNode * n78,
470 const SMDS_MeshNode * n85,
471 const SMDS_MeshNode * n15,
472 const SMDS_MeshNode * n26,
473 const SMDS_MeshNode * n37,
474 const SMDS_MeshNode * n48,
475 const SMDS_MeshNode * n1234,
476 const SMDS_MeshNode * n1256,
477 const SMDS_MeshNode * n2367,
478 const SMDS_MeshNode * n3478,
479 const SMDS_MeshNode * n1458,
480 const SMDS_MeshNode * n5678,
481 const SMDS_MeshNode * nCenter);
483 virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<int>& nodes_ids,
486 virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<const SMDS_MeshNode*>& nodes,
489 virtual SMDS_MeshFace* AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes);
491 virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
492 (const std::vector<int>& nodes_ids,
493 const std::vector<int>& quantities,
496 virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
497 (const std::vector<const SMDS_MeshNode*>& nodes,
498 const std::vector<int>& quantities,
501 virtual SMDS_MeshVolume* AddPolyhedralVolume
502 (const std::vector<const SMDS_MeshNode*>& nodes,
503 const std::vector<int>& quantities);
505 void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
506 virtual void RemoveNode(const SMDS_MeshNode *);
507 void RemoveElement(const SMDS_MeshElement *);
509 /*! Remove only the given element/node and only if it is free.
510 * Methods do not work for meshes with descendants.
511 * Implemented for fast cleaning of meshes.
513 void RemoveFreeNode (const SMDS_MeshNode *, SMESHDS_SubMesh *, bool fromGroups=true);
514 void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *, bool fromGroups=true);
518 bool ChangeElementNodes(const SMDS_MeshElement * elem,
519 const SMDS_MeshNode * nodes[],
521 bool ChangePolygonNodes(const SMDS_MeshElement * elem,
522 std::vector<const SMDS_MeshNode*> nodes);
523 bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
524 std::vector<const SMDS_MeshNode*> nodes,
525 std::vector<int> quantities);
526 bool ModifyCellNodes(int smdsVolId, std::map<int,int> localClonedNodeIds);
527 void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
529 void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
530 void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Solid & S);
531 void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S, double u=0., double v=0.);
532 void SetNodeOnEdge(SMDS_MeshNode * aNode, const TopoDS_Edge & S, double u=0.);
533 void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
534 void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
535 void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
536 const TopoDS_Shape & S);
537 void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
538 const TopoDS_Shape & S);
539 bool HasMeshElements(const TopoDS_Shape & S) const;
540 SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
541 SMESHDS_SubMesh * MeshElements(const int Index) const;
542 std::list<int> SubMeshIndices() const;
543 const std::map<int,SMESHDS_SubMesh*>& SubMeshes() const
544 { return myShapeIndexToSubMesh; }
546 bool HasHypothesis(const TopoDS_Shape & S);
547 const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
548 bool IsUsedHypothesis(const SMESHDS_Hypothesis * H) const;
549 SMESHDS_Script * GetScript();
551 int ShapeToIndex(const TopoDS_Shape & aShape) const;
552 const TopoDS_Shape& IndexToShape(int ShapeIndex) const;
553 int MaxShapeIndex() const { return myIndexToShape.Extent(); }
554 int MaxSubMeshIndex() const;
556 SMESHDS_SubMesh * NewSubMesh(int Index);
557 int AddCompoundSubmesh(const TopoDS_Shape& S, TopAbs_ShapeEnum type = TopAbs_SHAPE);
558 void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
559 void SetNodeOnFace(SMDS_MeshNode * aNode, int Index , double u=0., double v=0.);
560 void SetNodeOnEdge(SMDS_MeshNode * aNode, int Index , double u=0.);
561 void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index);
562 void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
564 // Groups. SMESHDS_Mesh is not an owner of groups
565 void AddGroup (SMESHDS_GroupBase* theGroup) { myGroups.insert(theGroup); }
566 void RemoveGroup (SMESHDS_GroupBase* theGroup) { myGroups.erase(theGroup); }
567 int GetNbGroups() const { return myGroups.size(); }
568 const std::set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
570 bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
572 virtual void compactMesh();
573 void CleanDownWardConnectivity();
574 void BuildDownWardConnectivity(bool withEdges);
579 void addNodeToSubmesh( const SMDS_MeshNode* aNode, int Index )
581 //Update or build submesh
582 std::map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
583 if ( it == myShapeIndexToSubMesh.end() )
584 it = myShapeIndexToSubMesh.insert( std::make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
585 it->second->AddNode( aNode ); // add aNode to submesh
588 /*int HashCode( const TopoDS_Shape& S, const Standard_Integer theUpper ) const
590 return S.HashCode(2147483647);
593 typedef std::list<const SMESHDS_Hypothesis*> THypList;
595 typedef NCollection_DataMap< TopoDS_Shape, THypList > ShapeToHypothesis;
597 ShapeToHypothesis myShapeToHypothesis;
599 int myMeshID, myPersistentID;
600 TopoDS_Shape myShape;
602 typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
603 TShapeIndexToSubMesh myShapeIndexToSubMesh;
605 TopTools_IndexedMapOfShape myIndexToShape;
607 typedef std::set<SMESHDS_GroupBase*> TGroups;
610 SMESHDS_Script* myScript;
611 bool myIsEmbeddedMode;
613 // optimize addition of nodes/elements to submeshes by, SetNodeInVolume() etc:
614 // avoid search of submeshes in maps
615 bool add( const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh );
616 SMESHDS_SubMesh* getSubmesh( const TopoDS_Shape & shape);
617 SMESHDS_SubMesh* getSubmesh( const int Index );
619 TopoDS_Shape myCurSubShape;
620 SMESHDS_SubMesh* myCurSubMesh;