1 // SMESH SMESHDS : management of mesh data and SMESH document
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_Mesh.cxx
25 // Author : Yves FRICAUD, OCC
29 #include "SMESHDS_Mesh.hxx"
30 #include "SMDS_VertexPosition.hxx"
31 #include "SMDS_EdgePosition.hxx"
32 #include "SMDS_FacePosition.hxx"
33 #include <TopExp_Explorer.hxx>
36 #include "utilities.h"
37 //=======================================================================
40 //=======================================================================
41 SMESHDS_Mesh::SMESHDS_Mesh(int MeshID):myMeshID(MeshID)
43 myScript = new SMESHDS_Script();
46 //=======================================================================
47 //function : ShapeToMesh
49 //=======================================================================
50 void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
53 TopExp::MapShapes(myShape, myIndexToShape);
56 //=======================================================================
57 //function : AddHypothesis
59 //=======================================================================
61 bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
62 const SMESHDS_Hypothesis * H)
64 list<const SMESHDS_Hypothesis *>& alist=myShapeToHypothesis[SS];
66 //Check if the Hypothesis is still present
67 list<const SMESHDS_Hypothesis*>::iterator ith=alist.begin();
69 for (; ith!=alist.end(); ith++)
70 if (H == *ith) return false;
76 //=======================================================================
77 //function : RemoveHypothesis
79 //=======================================================================
81 bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
82 const SMESHDS_Hypothesis * H)
84 ShapeToHypothesis::iterator its=myShapeToHypothesis.find(S);
85 if(its!=myShapeToHypothesis.end())
87 list<const SMESHDS_Hypothesis*>::iterator ith=(*its).second.begin();
89 for (; ith!=(*its).second.end(); ith++)
92 (*its).second.erase(ith);
99 //=======================================================================
102 //=======================================================================
103 SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z){
104 SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z);
105 if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
109 SMDS_MeshNode* SMESHDS_Mesh::AddNodeWithID(double x, double y, double z, int ID){
110 SMDS_MeshNode* node = SMDS_Mesh::AddNodeWithID(x,y,z,ID);
111 if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
115 //=======================================================================
116 //function : MoveNode
118 //=======================================================================
119 void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z)
121 SMDS_MeshNode * node=const_cast<SMDS_MeshNode*>(n);
123 myScript->MoveNode(n->GetID(), x, y, z);
126 //=======================================================================
129 //=======================================================================
130 SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int ID)
132 SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdgeWithID(n1,n2,ID);
133 if(anElem) myScript->AddEdge(ID,n1,n2);
137 SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
138 const SMDS_MeshNode * n2,
141 return AddEdgeWithID(n1->GetID(),
146 SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1,
147 const SMDS_MeshNode * n2)
149 SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2);
150 if(anElem) myScript->AddEdge(anElem->GetID(),
156 //=======================================================================
159 //=======================================================================
160 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int ID)
162 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1, n2, n3, ID);
163 if(anElem) myScript->AddFace(ID,n1,n2,n3);
167 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
168 const SMDS_MeshNode * n2,
169 const SMDS_MeshNode * n3,
172 return AddFaceWithID(n1->GetID(),
178 SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1,
179 const SMDS_MeshNode * n2,
180 const SMDS_MeshNode * n3)
182 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3);
183 if(anElem) myScript->AddFace(anElem->GetID(),
190 //=======================================================================
193 //=======================================================================
194 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, int ID)
196 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1, n2, n3, n4, ID);
197 if(anElem) myScript->AddFace(ID, n1, n2, n3, n4);
201 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
202 const SMDS_MeshNode * n2,
203 const SMDS_MeshNode * n3,
204 const SMDS_MeshNode * n4,
207 return AddFaceWithID(n1->GetID(),
214 SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
215 const SMDS_MeshNode * n2,
216 const SMDS_MeshNode * n3,
217 const SMDS_MeshNode * n4)
219 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4);
220 if(anElem) myScript->AddFace(anElem->GetID(),
228 //=======================================================================
229 //function :AddVolume
231 //=======================================================================
232 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int ID)
234 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID);
235 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4);
239 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
240 const SMDS_MeshNode * n2,
241 const SMDS_MeshNode * n3,
242 const SMDS_MeshNode * n4,
245 return AddVolumeWithID(n1->GetID(),
252 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
253 const SMDS_MeshNode * n2,
254 const SMDS_MeshNode * n3,
255 const SMDS_MeshNode * n4)
257 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4);
258 if(anElem) myScript->AddVolume(anElem->GetID(),
266 //=======================================================================
267 //function :AddVolume
269 //=======================================================================
270 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID)
272 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID);
273 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5);
277 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
278 const SMDS_MeshNode * n2,
279 const SMDS_MeshNode * n3,
280 const SMDS_MeshNode * n4,
281 const SMDS_MeshNode * n5,
284 return AddVolumeWithID(n1->GetID(),
292 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
293 const SMDS_MeshNode * n2,
294 const SMDS_MeshNode * n3,
295 const SMDS_MeshNode * n4,
296 const SMDS_MeshNode * n5)
298 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5);
299 if(anElem) myScript->AddVolume(anElem->GetID(),
308 //=======================================================================
309 //function :AddVolume
311 //=======================================================================
312 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID)
314 SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
315 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6);
319 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
320 const SMDS_MeshNode * n2,
321 const SMDS_MeshNode * n3,
322 const SMDS_MeshNode * n4,
323 const SMDS_MeshNode * n5,
324 const SMDS_MeshNode * n6,
327 return AddVolumeWithID(n1->GetID(),
336 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
337 const SMDS_MeshNode * n2,
338 const SMDS_MeshNode * n3,
339 const SMDS_MeshNode * n4,
340 const SMDS_MeshNode * n5,
341 const SMDS_MeshNode * n6)
343 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6);
344 if(anElem) myScript->AddVolume(anElem->GetID(),
354 //=======================================================================
355 //function :AddVolume
357 //=======================================================================
358 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID)
360 SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
361 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6, n7, n8);
365 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
366 const SMDS_MeshNode * n2,
367 const SMDS_MeshNode * n3,
368 const SMDS_MeshNode * n4,
369 const SMDS_MeshNode * n5,
370 const SMDS_MeshNode * n6,
371 const SMDS_MeshNode * n7,
372 const SMDS_MeshNode * n8,
375 return AddVolumeWithID(n1->GetID(),
386 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
387 const SMDS_MeshNode * n2,
388 const SMDS_MeshNode * n3,
389 const SMDS_MeshNode * n4,
390 const SMDS_MeshNode * n5,
391 const SMDS_MeshNode * n6,
392 const SMDS_MeshNode * n7,
393 const SMDS_MeshNode * n8)
395 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
396 if(anElem) myScript->AddVolume(anElem->GetID(),
407 //=======================================================================
408 //function : removeFromSubMeshes
410 //=======================================================================
412 static void removeFromSubMeshes (map<int,SMESHDS_SubMesh*> & theSubMeshes,
413 list<const SMDS_MeshElement *> & theElems,
416 if ( theElems.empty() )
419 map<int,SMESHDS_SubMesh*>::iterator SubIt = theSubMeshes.begin();
420 for ( ; SubIt != theSubMeshes.end(); SubIt++ )
422 list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
423 while ( elIt != theElems.end() )
425 bool removed = false;
427 removed = (*SubIt).second->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt) );
429 removed = (*SubIt).second->RemoveElement( *elIt );
433 elIt = theElems.erase( elIt );
434 if ( theElems.empty() )
435 return; // all elements are found and removed
445 //=======================================================================
446 //function : RemoveNode
448 //=======================================================================
449 void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
451 myScript->RemoveNode(n->GetID());
453 list<const SMDS_MeshElement *> removedElems;
454 list<const SMDS_MeshElement *> removedNodes;
456 SMDS_Mesh::RemoveElement( n, removedElems, removedNodes, true );
458 removeFromSubMeshes( myShapeIndexToSubMesh, removedElems, false );
459 removeFromSubMeshes( myShapeIndexToSubMesh, removedNodes, true );
462 //=======================================================================
463 //function : RemoveElement
465 //========================================================================
466 void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
468 if (elt->GetType() == SMDSAbs_Node)
470 RemoveNode( static_cast<const SMDS_MeshNode*>( elt ));
474 myScript->RemoveElement(elt->GetID());
476 list<const SMDS_MeshElement *> removedElems;
477 list<const SMDS_MeshElement *> removedNodes;
479 SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false);
481 removeFromSubMeshes( myShapeIndexToSubMesh, removedElems, false );
484 //=======================================================================
485 //function : SetNodeOnVolume
487 //=======================================================================
488 void SMESHDS_Mesh::SetNodeInVolume(SMDS_MeshNode * aNode,
489 const TopoDS_Shell & S)
491 if (myShape.IsNull()) MESSAGE("myShape is NULL");
493 int Index = myIndexToShape.FindIndex(S);
495 //Set Position on Node
496 //Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);;
497 //aNode->SetPosition(aPos);
499 //Update or build submesh
500 map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
501 if (it==myShapeIndexToSubMesh.end())
502 myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh();
504 myShapeIndexToSubMesh[Index]->AddNode(aNode);
507 //=======================================================================
508 //function : SetNodeOnFace
510 //=======================================================================
511 void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode * aNode,
512 const TopoDS_Face & S)
514 if (myShape.IsNull()) MESSAGE("myShape is NULL");
516 int Index = myIndexToShape.FindIndex(S);
518 //Set Position on Node
519 aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition(Index, 0., 0.)));
521 //Update or build submesh
522 map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
523 if (it==myShapeIndexToSubMesh.end())
524 myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh();
526 myShapeIndexToSubMesh[Index]->AddNode(aNode);
529 //=======================================================================
530 //function : SetNodeOnEdge
532 //=======================================================================
533 void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode * aNode,
534 const TopoDS_Edge & S)
536 if (myShape.IsNull()) MESSAGE("myShape is NULL");
538 int Index = myIndexToShape.FindIndex(S);
540 //Set Position on Node
541 aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(Index, 0.)));
543 //Update or build submesh
544 map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
545 if (it==myShapeIndexToSubMesh.end())
546 myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh();
548 myShapeIndexToSubMesh[Index]->AddNode(aNode);
551 //=======================================================================
552 //function : SetNodeOnVertex
554 //=======================================================================
555 void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode * aNode,
556 const TopoDS_Vertex & S)
558 if (myShape.IsNull()) MESSAGE("myShape is NULL");
560 int Index = myIndexToShape.FindIndex(S);
562 //Set Position on Node
563 aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition(Index)));
565 //Update or build submesh
566 map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
567 if (it==myShapeIndexToSubMesh.end())
568 myShapeIndexToSubMesh[Index]= new SMESHDS_SubMesh();
570 myShapeIndexToSubMesh[Index]->AddNode(aNode);
573 //=======================================================================
574 //function : UnSetNodeOnShape
576 //=======================================================================
577 void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
579 MESSAGE("not implemented");
582 //=======================================================================
583 //function : SetMeshElementOnShape
585 //=======================================================================
586 void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement * anElement,
587 const TopoDS_Shape & S)
589 if (myShape.IsNull()) MESSAGE("myShape is NULL");
591 int Index = myIndexToShape.FindIndex(S);
593 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
594 myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh();
596 myShapeIndexToSubMesh[Index]->AddElement(anElement);
599 //=======================================================================
600 //function : UnSetMeshElementOnShape
602 //=======================================================================
604 UnSetMeshElementOnShape(const SMDS_MeshElement * anElement,
605 const TopoDS_Shape & S)
607 if (myShape.IsNull()) MESSAGE("myShape is NULL");
609 int Index = myIndexToShape.FindIndex(S);
611 if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
612 myShapeIndexToSubMesh[Index]->RemoveElement(anElement);
615 //=======================================================================
616 //function : ShapeToMesh
618 //=======================================================================
619 TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
624 ///////////////////////////////////////////////////////////////////////////////
625 /// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
626 /// TopoDS_Shape is unknown
627 ///////////////////////////////////////////////////////////////////////////////
628 SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S)
630 if (myShape.IsNull()) MESSAGE("myShape is NULL");
632 int Index = myIndexToShape.FindIndex(S);
633 if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
634 return myShapeIndexToSubMesh[Index];
639 ///////////////////////////////////////////////////////////////////////////////
640 /// Return the sub mesh by Id of shape it is linked to
641 ///////////////////////////////////////////////////////////////////////////////
642 SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index)
644 if (myShape.IsNull()) MESSAGE("myShape is NULL");
646 if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
647 return myShapeIndexToSubMesh[Index];
652 //=======================================================================
653 //function : SubMeshIndices
655 //=======================================================================
656 list<int> SMESHDS_Mesh::SubMeshIndices()
659 std::map<int,SMESHDS_SubMesh*>::iterator anIter = myShapeIndexToSubMesh.begin();
660 for (; anIter != myShapeIndexToSubMesh.end(); anIter++) {
661 anIndices.push_back((*anIter).first);
666 //=======================================================================
667 //function : GetHypothesis
669 //=======================================================================
671 const list<const SMESHDS_Hypothesis*>& SMESHDS_Mesh::GetHypothesis(
672 const TopoDS_Shape & S) const
674 if (myShapeToHypothesis.find(S)!=myShapeToHypothesis.end())
675 return myShapeToHypothesis.find(S)->second;
677 static list<const SMESHDS_Hypothesis*> empty;
681 //=======================================================================
682 //function : GetScript
684 //=======================================================================
685 SMESHDS_Script* SMESHDS_Mesh::GetScript()
690 //=======================================================================
691 //function : ClearScript
693 //=======================================================================
694 void SMESHDS_Mesh::ClearScript()
699 //=======================================================================
700 //function : HasMeshElements
702 //=======================================================================
703 bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S)
705 if (myShape.IsNull()) MESSAGE("myShape is NULL");
706 int Index = myIndexToShape.FindIndex(S);
707 return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
710 //=======================================================================
711 //function : HasHypothesis
713 //=======================================================================
714 bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
716 return myShapeToHypothesis.find(S)!=myShapeToHypothesis.end();
719 //=======================================================================
720 //function : NewSubMesh
722 //=======================================================================
723 void SMESHDS_Mesh::NewSubMesh(int Index)
725 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
727 SMESHDS_SubMesh* SM = new SMESHDS_SubMesh();
728 myShapeIndexToSubMesh[Index]=SM;
732 //=======================================================================
733 //function : IndexToShape
735 //=======================================================================
736 TopoDS_Shape SMESHDS_Mesh::IndexToShape(int ShapeIndex)
738 return myIndexToShape.FindKey(ShapeIndex);
741 //=======================================================================
742 //function : ShapeToIndex
744 //=======================================================================
745 int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S)
747 if (myShape.IsNull()) MESSAGE("myShape is NULL");
748 return myIndexToShape.FindIndex(S);
751 //=======================================================================
752 //function : SetNodeOnVolume
754 //=======================================================================
755 void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
757 //Set Position on Node
758 //Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);;
759 //aNode->SetPosition(aPos);
761 //Update or build submesh
762 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
763 myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh();
765 myShapeIndexToSubMesh[Index]->AddNode(aNode);
768 //=======================================================================
769 //function : SetNodeOnFace
771 //=======================================================================
772 void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode* aNode, int Index)
774 //Set Position on Node
775 aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition(Index, 0., 0.)));
777 //Update or build submesh
778 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
779 myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh();
781 myShapeIndexToSubMesh[Index]->AddNode(aNode);
784 //=======================================================================
785 //function : SetNodeOnEdge
787 //=======================================================================
788 void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode* aNode, int Index)
790 //Set Position on Node
791 aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(Index, 0.)));
793 //Update or build submesh
794 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
795 myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh();
797 myShapeIndexToSubMesh[Index]->AddNode(aNode);
800 //=======================================================================
801 //function : SetNodeOnVertex
803 //=======================================================================
804 void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode* aNode, int Index)
806 //Set Position on Node
807 aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition(Index)));
809 //Update or build submesh
810 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
811 myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh();
813 myShapeIndexToSubMesh[Index]->AddNode(aNode);
816 //=======================================================================
817 //function : SetMeshElementOnShape
819 //=======================================================================
820 void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
823 if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
824 myShapeIndexToSubMesh[Index]=new SMESHDS_SubMesh();
826 myShapeIndexToSubMesh[Index]->AddElement(anElement);
829 SMESHDS_Mesh::~SMESHDS_Mesh()