1 // Copyright (C) 2007-2020 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, or (at your option) any later version.
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 : SMESH_Mesh.cxx
25 // Author : Yves FRICAUD, OCC
28 #include "SMESHDS_Mesh.hxx"
30 #include "SMDS_Downward.hxx"
31 #include "SMDS_EdgePosition.hxx"
32 #include "SMDS_FacePosition.hxx"
33 #include "SMDS_SpacePosition.hxx"
34 #include "SMDS_VertexPosition.hxx"
35 #include "SMESHDS_Group.hxx"
36 #include "SMESHDS_GroupOnGeom.hxx"
37 #include "SMESHDS_Script.hxx"
38 #include "SMESHDS_TSubMeshHolder.hxx"
40 #include <Standard_ErrorHandler.hxx>
41 #include <Standard_OutOfRange.hxx>
43 #include <TopExp_Explorer.hxx>
44 #include <TopoDS_Edge.hxx>
45 #include <TopoDS_Face.hxx>
46 #include <TopoDS_Iterator.hxx>
47 #include <TopoDS_Shell.hxx>
48 #include <TopoDS_Solid.hxx>
49 #include <TopoDS_Vertex.hxx>
51 #include "utilities.h"
53 class SMESHDS_Mesh::SubMeshHolder : public SMESHDS_TSubMeshHolder< const SMESHDS_SubMesh >
57 //=======================================================================
60 //=======================================================================
61 SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode):
63 mySubMeshHolder( new SubMeshHolder ),
64 myIsEmbeddedMode(theIsEmbeddedMode)
66 myScript = new SMESHDS_Script(theIsEmbeddedMode);
67 SetPersistentId(theMeshID);
70 //=======================================================================
71 bool SMESHDS_Mesh::IsEmbeddedMode()
73 return myIsEmbeddedMode;
76 //================================================================================
78 * \brief Store ID persistent during lifecycle
80 * Initially it was used to have a persistent reference to the mesh from the hypothesis
82 //================================================================================
84 void SMESHDS_Mesh::SetPersistentId(int id)
89 //================================================================================
91 * \brief Return ID persistent during lifecycle
93 //================================================================================
95 int SMESHDS_Mesh::GetPersistentId() const
97 return myPersistentID;
100 //=======================================================================
101 //function : ShapeToMesh
103 //=======================================================================
104 void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
106 if ( !myShape.IsNull() && S.IsNull() ) // case: "save study" after geometry removal
108 // removal of a shape to mesh, delete ...
110 myShapeToHypothesis.Clear();
111 // - shape indices in SMDS_Position of nodes
112 SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
113 while ( SMESHDS_SubMesh* sm = const_cast< SMESHDS_SubMesh* >( smIt->next() )) {
114 if ( !sm->IsComplexSubmesh() ) {
115 SMDS_NodeIteratorPtr nIt = sm->GetNodes();
116 while ( nIt->more() )
117 sm->RemoveNode(nIt->next());
121 mySubMeshHolder->DeleteAll();
123 myIndexToShape.Clear();
124 // - groups on geometry
125 std::set<SMESHDS_GroupBase*>::iterator gr = myGroups.begin();
126 while ( gr != myGroups.end() ) {
127 if ( dynamic_cast<SMESHDS_GroupOnGeom*>( *gr ))
128 myGroups.erase( gr++ );
136 TopExp::MapShapes(myShape, myIndexToShape);
139 SMDS_Mesh::setNbShapes( MaxShapeIndex() );
142 //=======================================================================
143 //function : AddHypothesis
145 //=======================================================================
147 bool SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape & SS,
148 const SMESHDS_Hypothesis * H)
150 if (!myShapeToHypothesis.IsBound(SS/*.Oriented(TopAbs_FORWARD)*/)) {
151 std::list<const SMESHDS_Hypothesis *> aList;
152 myShapeToHypothesis.Bind(SS/*.Oriented(TopAbs_FORWARD)*/, aList);
154 std::list<const SMESHDS_Hypothesis *>& alist =
155 myShapeToHypothesis(SS/*.Oriented(TopAbs_FORWARD)*/); // ignore orientation of SS
157 //Check if the Hypothesis is still present
158 std::list<const SMESHDS_Hypothesis*>::iterator ith = find(alist.begin(),alist.end(), H );
160 if (alist.end() != ith) return false;
166 //=======================================================================
167 //function : RemoveHypothesis
169 //=======================================================================
171 bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
172 const SMESHDS_Hypothesis * H)
174 if( myShapeToHypothesis.IsBound( S/*.Oriented(TopAbs_FORWARD)*/ ) )
176 std::list<const SMESHDS_Hypothesis *>& alist=myShapeToHypothesis.ChangeFind( S/*.Oriented(TopAbs_FORWARD)*/ );
177 std::list<const SMESHDS_Hypothesis*>::iterator ith=find(alist.begin(),alist.end(), H );
178 if (ith != alist.end())
187 //=======================================================================
190 //=======================================================================
191 SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z){
192 SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z);
193 if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
197 SMDS_MeshNode* SMESHDS_Mesh::AddNodeWithID(double x, double y, double z, int ID){
198 SMDS_MeshNode* node = SMDS_Mesh::AddNodeWithID(x,y,z,ID);
199 if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
203 //=======================================================================
204 //function : MoveNode
206 //=======================================================================
208 void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z)
210 SMDS_Mesh::MoveNode( n, x, y, z );
211 myScript->MoveNode(n->GetID(), x, y, z);
214 //=======================================================================
215 //function : ChangeElementNodes
216 //purpose : Changed nodes of an element provided that nb of nodes does not change
217 //=======================================================================
219 bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
220 const SMDS_MeshNode * nodes[],
223 if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
226 std::vector<int> IDs( nbnodes );
227 for ( int i = 0; i < nbnodes; i++ )
228 IDs [ i ] = nodes[ i ]->GetID();
229 myScript->ChangeElementNodes( elem->GetID(), &IDs[0], nbnodes);
234 //=======================================================================
235 //function : ChangePolygonNodes
237 //=======================================================================
238 bool SMESHDS_Mesh::ChangePolygonNodes
239 (const SMDS_MeshElement * elem,
240 std::vector<const SMDS_MeshNode*> nodes)
242 ASSERT(nodes.size() > 3);
244 return ChangeElementNodes(elem, &nodes[0], nodes.size());
247 //=======================================================================
248 //function : ChangePolyhedronNodes
250 //=======================================================================
252 ::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
253 const std::vector<const SMDS_MeshNode*>& nodes,
254 const std::vector<int> & quantities)
256 ASSERT(nodes.size() > 3);
258 if ( !SMDS_Mesh::ChangePolyhedronNodes( elem, nodes, quantities ))
261 int i, len = nodes.size();
262 std::vector<int> nodes_ids (len);
263 for (i = 0; i < len; i++) {
264 nodes_ids[i] = nodes[i]->GetID();
266 myScript->ChangePolyhedronNodes(elem->GetID(), nodes_ids, quantities);
271 //=======================================================================
272 //function : Renumber
274 //=======================================================================
276 void SMESHDS_Mesh::Renumber (const bool /*isNodes*/, const int /*startID*/, const int /*deltaID*/)
278 // TODO not possible yet to have node numbers not starting to O and continuous.
279 if ( !this->IsCompacted() )
281 // SMDS_Mesh::Renumber( isNodes, startID, deltaID );
282 // myScript->Renumber( isNodes, startID, deltaID );
285 //=======================================================================
286 //function : Add0DElement
288 //=======================================================================
289 SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID(int nodeID, int ID)
291 SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElementWithID(nodeID, ID);
292 if (anElem) myScript->Add0DElement(ID, nodeID);
296 SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID
297 (const SMDS_MeshNode * node, int ID)
299 return Add0DElementWithID(node->GetID(), ID);
302 SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
304 SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElement(node);
305 if (anElem) myScript->Add0DElement(anElem->GetID(), node->GetID());
309 //=======================================================================
310 //function :AddBallWithID
312 //=======================================================================
314 SMDS_BallElement* SMESHDS_Mesh::AddBallWithID(int node, double diameter, int ID)
316 SMDS_BallElement* anElem = SMDS_Mesh::AddBallWithID(node,diameter,ID);
317 if (anElem) myScript->AddBall(anElem->GetID(), node, diameter);
321 SMDS_BallElement* SMESHDS_Mesh::AddBallWithID(const SMDS_MeshNode * node,
325 SMDS_BallElement* anElem = SMDS_Mesh::AddBallWithID(node,diameter,ID);
326 if (anElem) myScript->AddBall(anElem->GetID(), node->GetID(), diameter);
330 SMDS_BallElement* SMESHDS_Mesh::AddBall (const SMDS_MeshNode * node,
333 SMDS_BallElement* anElem = SMDS_Mesh::AddBall(node,diameter);
334 if (anElem) myScript->AddBall(anElem->GetID(), node->GetID(), diameter);
338 //=======================================================================
339 //function :AddEdgeWithID
341 //=======================================================================
343 SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int ID)
345 SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdgeWithID(n1,n2,ID);
346 if(anElem) myScript->AddEdge(ID,n1,n2);
350 SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
351 const SMDS_MeshNode * n2,
354 return AddEdgeWithID(n1->GetID(),
359 SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1,
360 const SMDS_MeshNode * n2)
362 SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2);
363 if(anElem) myScript->AddEdge(anElem->GetID(),
369 //=======================================================================
372 //=======================================================================
373 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int ID)
375 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1, n2, n3, ID);
376 if(anElem) myScript->AddFace(ID,n1,n2,n3);
380 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
381 const SMDS_MeshNode * n2,
382 const SMDS_MeshNode * n3,
385 return AddFaceWithID(n1->GetID(),
391 SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1,
392 const SMDS_MeshNode * n2,
393 const SMDS_MeshNode * n3)
395 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3);
396 if(anElem) myScript->AddFace(anElem->GetID(),
403 //=======================================================================
406 //=======================================================================
407 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, int ID)
409 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1, n2, n3, n4, ID);
410 if(anElem) myScript->AddFace(ID, n1, n2, n3, n4);
414 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
415 const SMDS_MeshNode * n2,
416 const SMDS_MeshNode * n3,
417 const SMDS_MeshNode * n4,
420 return AddFaceWithID(n1->GetID(),
427 SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
428 const SMDS_MeshNode * n2,
429 const SMDS_MeshNode * n3,
430 const SMDS_MeshNode * n4)
432 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4);
433 if(anElem) myScript->AddFace(anElem->GetID(),
441 //=======================================================================
442 //function :AddVolume
444 //=======================================================================
445 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int ID)
447 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID);
448 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4);
452 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
453 const SMDS_MeshNode * n2,
454 const SMDS_MeshNode * n3,
455 const SMDS_MeshNode * n4,
458 return AddVolumeWithID(n1->GetID(),
465 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
466 const SMDS_MeshNode * n2,
467 const SMDS_MeshNode * n3,
468 const SMDS_MeshNode * n4)
470 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4);
471 if(anElem) myScript->AddVolume(anElem->GetID(),
479 //=======================================================================
480 //function :AddVolume
482 //=======================================================================
483 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID)
485 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID);
486 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5);
490 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
491 const SMDS_MeshNode * n2,
492 const SMDS_MeshNode * n3,
493 const SMDS_MeshNode * n4,
494 const SMDS_MeshNode * n5,
497 return AddVolumeWithID(n1->GetID(),
505 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
506 const SMDS_MeshNode * n2,
507 const SMDS_MeshNode * n3,
508 const SMDS_MeshNode * n4,
509 const SMDS_MeshNode * n5)
511 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5);
512 if(anElem) myScript->AddVolume(anElem->GetID(),
521 //=======================================================================
522 //function :AddVolume
524 //=======================================================================
525 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID)
527 SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
528 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6);
532 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
533 const SMDS_MeshNode * n2,
534 const SMDS_MeshNode * n3,
535 const SMDS_MeshNode * n4,
536 const SMDS_MeshNode * n5,
537 const SMDS_MeshNode * n6,
540 return AddVolumeWithID(n1->GetID(),
549 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
550 const SMDS_MeshNode * n2,
551 const SMDS_MeshNode * n3,
552 const SMDS_MeshNode * n4,
553 const SMDS_MeshNode * n5,
554 const SMDS_MeshNode * n6)
556 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6);
557 if(anElem) myScript->AddVolume(anElem->GetID(),
567 //=======================================================================
568 //function :AddVolume
570 //=======================================================================
571 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID)
573 SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
574 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6, n7, n8);
578 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
579 const SMDS_MeshNode * n2,
580 const SMDS_MeshNode * n3,
581 const SMDS_MeshNode * n4,
582 const SMDS_MeshNode * n5,
583 const SMDS_MeshNode * n6,
584 const SMDS_MeshNode * n7,
585 const SMDS_MeshNode * n8,
588 return AddVolumeWithID(n1->GetID(),
599 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
600 const SMDS_MeshNode * n2,
601 const SMDS_MeshNode * n3,
602 const SMDS_MeshNode * n4,
603 const SMDS_MeshNode * n5,
604 const SMDS_MeshNode * n6,
605 const SMDS_MeshNode * n7,
606 const SMDS_MeshNode * n8)
608 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
609 if(anElem) myScript->AddVolume(anElem->GetID(),
622 //=======================================================================
623 //function :AddVolume
624 //purpose : add hexagonal prism
625 //=======================================================================
626 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
627 int n5, int n6, int n7, int n8,
628 int n9, int n10, int n11, int n12,
631 SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, ID);
632 if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
636 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
637 const SMDS_MeshNode * n2,
638 const SMDS_MeshNode * n3,
639 const SMDS_MeshNode * n4,
640 const SMDS_MeshNode * n5,
641 const SMDS_MeshNode * n6,
642 const SMDS_MeshNode * n7,
643 const SMDS_MeshNode * n8,
644 const SMDS_MeshNode * n9,
645 const SMDS_MeshNode * n10,
646 const SMDS_MeshNode * n11,
647 const SMDS_MeshNode * n12,
650 return AddVolumeWithID(n1->GetID(),
665 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
666 const SMDS_MeshNode * n2,
667 const SMDS_MeshNode * n3,
668 const SMDS_MeshNode * n4,
669 const SMDS_MeshNode * n5,
670 const SMDS_MeshNode * n6,
671 const SMDS_MeshNode * n7,
672 const SMDS_MeshNode * n8,
673 const SMDS_MeshNode * n9,
674 const SMDS_MeshNode * n10,
675 const SMDS_MeshNode * n11,
676 const SMDS_MeshNode * n12)
678 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12);
679 if(anElem) myScript->AddVolume(anElem->GetID(),
696 //=======================================================================
697 //function : AddPolygonalFace
699 //=======================================================================
700 SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (const std::vector<int>& nodes_ids,
703 SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes_ids, ID);
705 myScript->AddPolygonalFace(ID, nodes_ids);
711 SMESHDS_Mesh::AddPolygonalFaceWithID (const std::vector<const SMDS_MeshNode*>& nodes,
714 SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
716 int i, len = nodes.size();
717 std::vector<int> nodes_ids (len);
718 for (i = 0; i < len; i++) {
719 nodes_ids[i] = nodes[i]->GetID();
721 myScript->AddPolygonalFace(ID, nodes_ids);
727 SMESHDS_Mesh::AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes)
729 SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes);
731 int i, len = nodes.size();
732 std::vector<int> nodes_ids (len);
733 for (i = 0; i < len; i++) {
734 nodes_ids[i] = nodes[i]->GetID();
736 myScript->AddPolygonalFace(anElem->GetID(), nodes_ids);
742 //=======================================================================
743 //function : AddQuadPolygonalFace
745 //=======================================================================
746 SMDS_MeshFace* SMESHDS_Mesh::AddQuadPolygonalFaceWithID (const std::vector<int>& nodes_ids,
749 SMDS_MeshFace *anElem = SMDS_Mesh::AddQuadPolygonalFaceWithID(nodes_ids, ID);
751 myScript->AddQuadPolygonalFace(ID, nodes_ids);
757 SMESHDS_Mesh::AddQuadPolygonalFaceWithID (const std::vector<const SMDS_MeshNode*>& nodes,
760 SMDS_MeshFace *anElem = SMDS_Mesh::AddQuadPolygonalFaceWithID(nodes, ID);
762 int i, len = nodes.size();
763 std::vector<int> nodes_ids (len);
764 for (i = 0; i < len; i++) {
765 nodes_ids[i] = nodes[i]->GetID();
767 myScript->AddQuadPolygonalFace(ID, nodes_ids);
773 SMESHDS_Mesh::AddQuadPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes)
775 SMDS_MeshFace *anElem = SMDS_Mesh::AddQuadPolygonalFace(nodes);
777 int i, len = nodes.size();
778 std::vector<int> nodes_ids (len);
779 for (i = 0; i < len; i++) {
780 nodes_ids[i] = nodes[i]->GetID();
782 myScript->AddQuadPolygonalFace(anElem->GetID(), nodes_ids);
788 //=======================================================================
789 //function : AddPolyhedralVolume
791 //=======================================================================
792 SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (const std::vector<int>& nodes_ids,
793 const std::vector<int>& quantities,
796 SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes_ids, quantities, ID);
798 myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
803 SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID
804 (const std::vector<const SMDS_MeshNode*>& nodes,
805 const std::vector<int>& quantities,
808 SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
810 int i, len = nodes.size();
811 std::vector<int> nodes_ids (len);
812 for (i = 0; i < len; i++) {
813 nodes_ids[i] = nodes[i]->GetID();
815 myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
820 SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume
821 (const std::vector<const SMDS_MeshNode*>& nodes,
822 const std::vector<int>& quantities)
824 SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolume(nodes, quantities);
826 int i, len = nodes.size();
827 std::vector<int> nodes_ids (len);
828 for (i = 0; i < len; i++) {
829 nodes_ids[i] = nodes[i]->GetID();
831 myScript->AddPolyhedralVolume(anElem->GetID(), nodes_ids, quantities);
836 //=======================================================================
837 //function : removeFromContainers
839 //=======================================================================
841 static void removeFromContainers (SMESHDS_Mesh* /*theMesh*/,
842 std::set<SMESHDS_GroupBase*>& theGroups,
843 std::vector<const SMDS_MeshElement*>& theElems)
845 if ( theElems.empty() )
849 // Element can belong to several groups
850 if ( !theGroups.empty() )
852 std::set<SMESHDS_GroupBase*>::iterator GrIt = theGroups.begin();
853 for ( ; GrIt != theGroups.end(); GrIt++ )
855 SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *GrIt );
856 if ( !group || group->IsEmpty() ) continue;
858 std::vector<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
859 for ( ; elIt != theElems.end(); elIt++ )
861 group->SMDSGroup().Remove( *elIt );
862 if ( group->IsEmpty() ) break;
867 //const bool deleted=true;
869 // Rm from sub-meshes
870 // Element should belong to only one sub-mesh
871 // if ( theMesh->SubMeshes()->more() )
873 // std::list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
875 // for ( ; elIt != theElems.end(); ++elIt )
876 // if ( SMESHDS_SubMesh* sm = theMesh->MeshElements( (*elIt)->getshapeId() ))
877 // sm->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
880 // for ( ; elIt != theElems.end(); ++elIt )
881 // if ( SMESHDS_SubMesh* sm = theMesh->MeshElements( (*elIt)->getshapeId() ))
882 // sm->RemoveElement( *elIt, deleted );
887 //=======================================================================
888 //function : RemoveNode
890 //=======================================================================
891 void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
893 if ( RemoveFreeNode( n, 0, true ))
896 myScript->RemoveNode(n->GetID());
898 // remove inverse elements from the sub-meshes
899 for ( SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator(); eIt->more() ; )
901 const SMDS_MeshElement* e = eIt->next();
902 if ( SMESHDS_SubMesh * sm = MeshElements( e->getshapeId() ))
903 sm->RemoveElement( e );
905 if ( SMESHDS_SubMesh * sm = MeshElements( n->getshapeId() ))
909 std::vector<const SMDS_MeshElement *> removedElems;
910 std::vector<const SMDS_MeshElement *> removedNodes;
912 SMDS_Mesh::RemoveElement( n, removedElems, removedNodes, true );
914 removeFromContainers( this, myGroups, removedElems );
915 removeFromContainers( this, myGroups, removedNodes );
918 //=======================================================================
919 //function : RemoveFreeNode
921 //=======================================================================
922 bool SMESHDS_Mesh::RemoveFreeNode(const SMDS_MeshNode * n,
923 SMESHDS_SubMesh * subMesh,
926 if ( n->NbInverseElements() > 0 )
929 myScript->RemoveNode(n->GetID());
932 // Node can belong to several groups
933 if ( fromGroups && !myGroups.empty() ) {
934 std::set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin();
935 for (; GrIt != myGroups.end(); GrIt++) {
936 SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt);
937 if (group && group->GetType() == SMDSAbs_Node )
938 group->SMDSGroup().Remove(n);
943 // Node should belong to only one sub-mesh
944 if ( !subMesh || !subMesh->RemoveNode( n ))
945 if (( subMesh = MeshElements( n->getshapeId() )))
946 subMesh->RemoveNode(n);
948 SMDS_Mesh::RemoveFreeElement(n);
953 //=======================================================================
954 //function : RemoveElement
956 //========================================================================
957 void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
959 if (elt->GetType() == SMDSAbs_Node)
961 RemoveNode( static_cast<const SMDS_MeshNode*>( elt ));
964 //if (!hasConstructionEdges() && !hasConstructionFaces())
966 SMESHDS_SubMesh* subMesh=0;
967 if ( elt->getshapeId() > 0 )
968 subMesh = MeshElements( elt->getshapeId() );
970 RemoveFreeElement( elt, subMesh, true );
974 myScript->RemoveElement(elt->GetID());
976 std::vector<const SMDS_MeshElement *> removedElems;
977 std::vector<const SMDS_MeshElement *> removedNodes;
979 SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes );
981 removeFromContainers( this, myGroups, removedElems );
984 //=======================================================================
985 //function : RemoveFreeElement
987 //========================================================================
988 void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt,
989 SMESHDS_SubMesh * subMesh,
992 if (elt->GetType() == SMDSAbs_Node) {
993 RemoveFreeNode( static_cast<const SMDS_MeshNode*>(elt), subMesh, fromGroups);
997 // if (hasConstructionEdges() || hasConstructionFaces())
998 // // this methods is only for meshes without descendants
1001 myScript->RemoveElement(elt->GetID());
1004 // Element can belong to several groups
1005 if ( fromGroups && !myGroups.empty() ) {
1006 std::set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin();
1007 for (; GrIt != myGroups.end(); GrIt++) {
1008 SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt);
1009 if (group && !group->IsEmpty())
1010 group->SMDSGroup().Remove(elt);
1015 // Element should belong to only one sub-mesh
1016 if ( !subMesh && elt->getshapeId() > 0 )
1017 subMesh = MeshElements( elt->getshapeId() );
1019 subMesh->RemoveElement( elt );
1021 SMDS_Mesh::RemoveFreeElement( elt );
1024 //================================================================================
1026 * \brief Remove all data from the mesh
1028 //================================================================================
1030 void SMESHDS_Mesh::ClearMesh()
1032 myScript->ClearMesh();
1036 SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
1037 while ( SMESHDS_SubMesh* sm = const_cast< SMESHDS_SubMesh* >( smIt->next() ))
1041 TGroups::iterator group, groupEnd = myGroups.end();
1042 for ( group = myGroups.begin(); group != groupEnd; ++group ) {
1043 if ( SMESHDS_Group* g = dynamic_cast<SMESHDS_Group*>(*group)) {
1044 SMDSAbs_ElementType groupType = g->GetType();
1046 g->SetType( groupType );
1050 (*group)->Extent(); // to free cached elements in GroupOnFilter's
1055 //================================================================================
1057 * \brief return submesh by shape
1058 * \param shape - the sub-shape
1059 * \retval SMESHDS_SubMesh* - the found submesh
1061 //================================================================================
1063 SMESHDS_SubMesh* SMESHDS_Mesh::getSubmesh( const TopoDS_Shape & shape )
1065 if ( shape.IsNull() )
1068 return NewSubMesh( ShapeToIndex( shape ));
1071 //================================================================================
1073 * \brief Add element or node to submesh
1074 * \param elem - element to add
1075 * \param subMesh - submesh to be filled in
1077 //================================================================================
1079 int SMESHDS_Mesh::add(const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh )
1081 if ( elem && subMesh ) {
1082 subMesh->AddElement( elem );
1083 return subMesh->GetID();
1088 //=======================================================================
1089 //function : SetNodeOnVolume
1091 //=======================================================================
1092 void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode,
1093 const TopoDS_Shell & S)
1095 if ( int shapeID = add( aNode, getSubmesh( S )))
1096 const_cast< SMDS_MeshNode* >
1097 ( aNode )->SetPosition( SMDS_SpacePosition::originSpacePosition(), shapeID );
1100 //=======================================================================
1101 //function : SetNodeOnVolume
1103 //=======================================================================
1104 void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode * aNode,
1105 const TopoDS_Solid & S)
1107 if ( int shapeID = add( aNode, getSubmesh( S )))
1108 const_cast< SMDS_MeshNode* >
1109 ( aNode )->SetPosition( SMDS_SpacePosition::originSpacePosition(), shapeID );
1112 //=======================================================================
1113 //function : SetNodeOnFace
1115 //=======================================================================
1116 void SMESHDS_Mesh::SetNodeOnFace(const SMDS_MeshNode * aNode,
1117 const TopoDS_Face & S,
1121 if ( int shapeID = add( aNode, getSubmesh( S )))
1122 const_cast< SMDS_MeshNode* >
1123 ( aNode )->SetPosition(SMDS_PositionPtr( new SMDS_FacePosition( u, v )), shapeID );
1126 //=======================================================================
1127 //function : SetNodeOnEdge
1129 //=======================================================================
1130 void SMESHDS_Mesh::SetNodeOnEdge(const SMDS_MeshNode * aNode,
1131 const TopoDS_Edge & S,
1134 if ( int shapeID = add( aNode, getSubmesh( S )))
1135 const_cast< SMDS_MeshNode* >
1136 ( aNode )->SetPosition(SMDS_PositionPtr( new SMDS_EdgePosition( u )), shapeID );
1139 //=======================================================================
1140 //function : SetNodeOnVertex
1142 //=======================================================================
1143 void SMESHDS_Mesh::SetNodeOnVertex(const SMDS_MeshNode * aNode,
1144 const TopoDS_Vertex & S)
1146 if ( int shapeID = add( aNode, getSubmesh( S )))
1147 const_cast< SMDS_MeshNode* >
1148 ( aNode )->SetPosition(SMDS_PositionPtr( new SMDS_VertexPosition()), shapeID );
1151 //=======================================================================
1152 //function : UnSetNodeOnShape
1154 //=======================================================================
1155 void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
1157 int shapeId = aNode->getshapeId();
1159 if ( SMESHDS_SubMesh* sm = MeshElements( shapeId ))
1160 sm->RemoveNode(aNode);
1163 //=======================================================================
1164 //function : SetMeshElementOnShape
1166 //=======================================================================
1167 void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement * anElement,
1168 const TopoDS_Shape & S)
1170 add( anElement, getSubmesh(S) );
1173 //=======================================================================
1174 //function : UnSetMeshElementOnShape
1176 //=======================================================================
1177 void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem,
1178 const TopoDS_Shape & S)
1180 if ( SMESHDS_SubMesh* sm = MeshElements( S ))
1181 sm->RemoveElement(elem);
1184 //=======================================================================
1185 //function : ShapeToMesh
1187 //=======================================================================
1188 TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
1193 //=======================================================================
1194 //function : IsGroupOfSubShapes
1195 //purpose : return true if at least one sub-shape of theShape is a sub-shape
1196 // of myShape or theShape == myShape
1197 //=======================================================================
1199 bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
1201 if ( myIndexToShape.Contains(theShape) )
1204 for ( TopoDS_Iterator it( theShape ); it.More(); it.Next() )
1205 if ( IsGroupOfSubShapes( it.Value() ))
1211 ///////////////////////////////////////////////////////////////////////////////
1212 /// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
1213 /// TopoDS_Shape is unknown
1214 ///////////////////////////////////////////////////////////////////////////////
1215 SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
1217 int Index = ShapeToIndex(S);
1218 return (SMESHDS_SubMesh *) ( Index ? mySubMeshHolder->Get( Index ) : 0 );
1221 ///////////////////////////////////////////////////////////////////////////////
1222 /// Return the sub mesh by Id of shape it is linked to
1223 ///////////////////////////////////////////////////////////////////////////////
1224 SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) const
1226 return const_cast< SMESHDS_SubMesh* >( mySubMeshHolder->Get( Index ));
1229 //=======================================================================
1230 //function : SubMeshIndices
1232 //=======================================================================
1233 std::list<int> SMESHDS_Mesh::SubMeshIndices() const
1235 std::list<int> anIndices;
1236 SMESHDS_SubMeshIteratorPtr smIt = SubMeshes();
1237 while ( const SMESHDS_SubMesh* sm = smIt->next() )
1238 anIndices.push_back( sm->GetID() );
1243 //=======================================================================
1244 //function : SubMeshes
1246 //=======================================================================
1248 SMESHDS_SubMeshIteratorPtr SMESHDS_Mesh::SubMeshes() const
1250 return SMESHDS_SubMeshIteratorPtr( mySubMeshHolder->GetIterator() );
1253 //=======================================================================
1254 //function : GetHypothesis
1256 //=======================================================================
1258 const std::list<const SMESHDS_Hypothesis*>&
1259 SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape & S) const
1261 if ( myShapeToHypothesis.IsBound( S/*.Oriented(TopAbs_FORWARD)*/ ) ) // ignore orientation of S
1262 return myShapeToHypothesis.Find( S/*.Oriented(TopAbs_FORWARD)*/ );
1264 static std::list<const SMESHDS_Hypothesis*> empty;
1268 //================================================================================
1270 * \brief returns true if the hypothesis is assigned to any sub-shape
1272 //================================================================================
1274 bool SMESHDS_Mesh::IsUsedHypothesis(const SMESHDS_Hypothesis * H) const
1276 ShapeToHypothesis::Iterator s2h( myShapeToHypothesis );
1277 for ( ; s2h.More(); s2h.Next() )
1278 if ( std::find( s2h.Value().begin(), s2h.Value().end(), H ) != s2h.Value().end() )
1283 //=======================================================================
1284 //function : GetScript
1286 //=======================================================================
1287 SMESHDS_Script* SMESHDS_Mesh::GetScript()
1292 //=======================================================================
1293 //function : ClearScript
1295 //=======================================================================
1296 void SMESHDS_Mesh::ClearScript()
1301 //=======================================================================
1302 //function : HasMeshElements
1304 //=======================================================================
1305 bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) const
1307 int Index = myIndexToShape.FindIndex(S);
1308 return mySubMeshHolder->Get( Index );
1311 //=======================================================================
1312 //function : HasHypothesis
1314 //=======================================================================
1315 bool SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape & S)
1317 return myShapeToHypothesis.IsBound(S/*.Oriented(TopAbs_FORWARD)*/);
1320 //=======================================================================
1321 //function : NewSubMesh
1323 //=======================================================================
1324 SMESHDS_SubMesh * SMESHDS_Mesh::NewSubMesh(int Index)
1326 SMESHDS_SubMesh* SM = MeshElements( Index );
1329 SM = new SMESHDS_SubMesh(this, Index);
1330 mySubMeshHolder->Add( Index, SM );
1335 //=======================================================================
1336 //function : AddCompoundSubmesh
1338 //=======================================================================
1340 int SMESHDS_Mesh::AddCompoundSubmesh(const TopoDS_Shape& S,
1341 TopAbs_ShapeEnum type)
1344 if ( IsGroupOfSubShapes( S ))
1346 aMainIndex = myIndexToShape.Add( S );
1347 bool all = ( type == TopAbs_SHAPE );
1348 if ( all ) // corresponding simple submesh may exist
1349 aMainIndex = -aMainIndex;
1350 SMESHDS_SubMesh * aNewSub = NewSubMesh( aMainIndex );
1351 if ( !aNewSub->IsComplexSubmesh() ) // is empty
1353 int shapeType = Max( TopAbs_SOLID, all ? myShape.ShapeType() : type );
1354 int typeLimit = all ? TopAbs_VERTEX : type;
1355 for ( ; shapeType <= typeLimit; shapeType++ )
1357 TopExp_Explorer exp( S, TopAbs_ShapeEnum( shapeType ));
1358 for ( ; exp.More(); exp.Next() )
1360 int index = myIndexToShape.FindIndex( exp.Current() );
1362 aNewSub->AddSubMesh( NewSubMesh( index ));
1370 //=======================================================================
1371 //function : IndexToShape
1373 //=======================================================================
1374 const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const
1378 if ( ShapeIndex > 0 )
1379 return myIndexToShape.FindKey(ShapeIndex);
1384 static TopoDS_Shape nullShape;
1388 //================================================================================
1390 * \brief Return max index of sub-mesh
1392 //================================================================================
1394 int SMESHDS_Mesh::MaxSubMeshIndex() const
1396 return mySubMeshHolder->GetMaxID();
1399 //=======================================================================
1400 //function : ShapeToIndex
1402 //=======================================================================
1403 int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
1405 int index = myIndexToShape.FindIndex(S);
1409 //=======================================================================
1410 //function : SetNodeOnVolume
1412 //=======================================================================
1413 void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
1415 if ( int shapeID = add( aNode, NewSubMesh( Index )))
1416 ((SMDS_MeshNode*) aNode)->SetPosition( SMDS_SpacePosition::originSpacePosition(), shapeID );
1419 //=======================================================================
1420 //function : SetNodeOnFace
1422 //=======================================================================
1423 void SMESHDS_Mesh::SetNodeOnFace(const SMDS_MeshNode* aNode, int Index, double u, double v)
1425 //Set Position on Node
1426 if ( int shapeID = add( aNode, NewSubMesh( Index )))
1427 const_cast< SMDS_MeshNode* >
1428 ( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition( u, v )), shapeID );
1431 //=======================================================================
1432 //function : SetNodeOnEdge
1434 //=======================================================================
1435 void SMESHDS_Mesh::SetNodeOnEdge(const SMDS_MeshNode* aNode,
1439 //Set Position on Node
1440 if ( int shapeID = add( aNode, NewSubMesh( Index )))
1441 const_cast< SMDS_MeshNode* >
1442 ( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition( u )), shapeID );
1445 //=======================================================================
1446 //function : SetNodeOnVertex
1448 //=======================================================================
1449 void SMESHDS_Mesh::SetNodeOnVertex(const SMDS_MeshNode* aNode, int Index)
1451 //Set Position on Node
1452 if ( int shapeID = add( aNode, NewSubMesh( Index )))
1453 const_cast< SMDS_MeshNode* >
1454 ( aNode )->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition()), shapeID );
1457 //=======================================================================
1458 //function : SetMeshElementOnShape
1460 //=======================================================================
1461 void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
1464 add( anElement, NewSubMesh( Index ));
1467 //=======================================================================
1468 //function : ~SMESHDS_Mesh
1470 //=======================================================================
1471 SMESHDS_Mesh::~SMESHDS_Mesh()
1476 delete mySubMeshHolder;
1480 //********************************************************************
1481 //********************************************************************
1482 //******** *********
1483 //***** Methods for addition of quadratic elements ******
1484 //******** *********
1485 //********************************************************************
1486 //********************************************************************
1488 //=======================================================================
1489 //function : AddEdgeWithID
1491 //=======================================================================
1492 SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID)
1494 SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdgeWithID(n1,n2,n12,ID);
1495 if(anElem) myScript->AddEdge(ID,n1,n2,n12);
1499 //=======================================================================
1500 //function : AddEdge
1502 //=======================================================================
1503 SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
1504 const SMDS_MeshNode* n2,
1505 const SMDS_MeshNode* n12)
1507 SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2,n12);
1508 if(anElem) myScript->AddEdge(anElem->GetID(),
1515 //=======================================================================
1516 //function : AddEdgeWithID
1518 //=======================================================================
1519 SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
1520 const SMDS_MeshNode * n2,
1521 const SMDS_MeshNode * n12,
1524 return AddEdgeWithID(n1->GetID(),
1531 //=======================================================================
1532 //function : AddFace
1534 //=======================================================================
1535 SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
1536 const SMDS_MeshNode * n2,
1537 const SMDS_MeshNode * n3,
1538 const SMDS_MeshNode * n12,
1539 const SMDS_MeshNode * n23,
1540 const SMDS_MeshNode * n31)
1542 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31);
1543 if(anElem) myScript->AddFace(anElem->GetID(),
1544 n1->GetID(), n2->GetID(), n3->GetID(),
1545 n12->GetID(), n23->GetID(), n31->GetID());
1549 //=======================================================================
1550 //function : AddFaceWithID
1552 //=======================================================================
1553 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3,
1554 int n12,int n23,int n31, int ID)
1556 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1,n2,n3,n12,n23,n31,ID);
1557 if(anElem) myScript->AddFace(ID,n1,n2,n3,n12,n23,n31);
1561 //=======================================================================
1562 //function : AddFaceWithID
1564 //=======================================================================
1565 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
1566 const SMDS_MeshNode * n2,
1567 const SMDS_MeshNode * n3,
1568 const SMDS_MeshNode * n12,
1569 const SMDS_MeshNode * n23,
1570 const SMDS_MeshNode * n31,
1573 return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(),
1574 n12->GetID(), n23->GetID(), n31->GetID(),
1578 //=======================================================================
1579 //function : AddFace
1581 //=======================================================================
1582 SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
1583 const SMDS_MeshNode * n2,
1584 const SMDS_MeshNode * n3,
1585 const SMDS_MeshNode * n12,
1586 const SMDS_MeshNode * n23,
1587 const SMDS_MeshNode * n31,
1588 const SMDS_MeshNode * nCenter)
1590 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31,nCenter);
1591 if(anElem) myScript->AddFace(anElem->GetID(),
1592 n1->GetID(), n2->GetID(), n3->GetID(),
1593 n12->GetID(), n23->GetID(), n31->GetID(),
1598 //=======================================================================
1599 //function : AddFaceWithID
1601 //=======================================================================
1602 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3,
1603 int n12,int n23,int n31, int nCenter, int ID)
1605 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1,n2,n3,n12,n23,n31,nCenter,ID);
1606 if(anElem) myScript->AddFace(ID,n1,n2,n3,n12,n23,n31,nCenter);
1610 //=======================================================================
1611 //function : AddFaceWithID
1613 //=======================================================================
1614 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
1615 const SMDS_MeshNode * n2,
1616 const SMDS_MeshNode * n3,
1617 const SMDS_MeshNode * n12,
1618 const SMDS_MeshNode * n23,
1619 const SMDS_MeshNode * n31,
1620 const SMDS_MeshNode * nCenter,
1623 return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(),
1624 n12->GetID(), n23->GetID(), n31->GetID(),
1625 nCenter->GetID(), ID);
1629 //=======================================================================
1630 //function : AddFace
1632 //=======================================================================
1633 SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
1634 const SMDS_MeshNode * n2,
1635 const SMDS_MeshNode * n3,
1636 const SMDS_MeshNode * n4,
1637 const SMDS_MeshNode * n12,
1638 const SMDS_MeshNode * n23,
1639 const SMDS_MeshNode * n34,
1640 const SMDS_MeshNode * n41)
1642 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41);
1643 if(anElem) myScript->AddFace(anElem->GetID(),
1644 n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
1645 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID());
1649 //=======================================================================
1650 //function : AddFaceWithID
1652 //=======================================================================
1653 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4,
1654 int n12,int n23,int n34,int n41, int ID)
1656 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1,n2,n3,n4,n12,n23,n34,n41,ID);
1657 if(anElem) myScript->AddFace(ID,n1,n2,n3,n4,n12,n23,n34,n41);
1661 //=======================================================================
1662 //function : AddFaceWithID
1664 //=======================================================================
1665 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
1666 const SMDS_MeshNode * n2,
1667 const SMDS_MeshNode * n3,
1668 const SMDS_MeshNode * n4,
1669 const SMDS_MeshNode * n12,
1670 const SMDS_MeshNode * n23,
1671 const SMDS_MeshNode * n34,
1672 const SMDS_MeshNode * n41,
1675 return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
1676 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
1681 //=======================================================================
1682 //function : AddFace
1684 //=======================================================================
1685 SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
1686 const SMDS_MeshNode * n2,
1687 const SMDS_MeshNode * n3,
1688 const SMDS_MeshNode * n4,
1689 const SMDS_MeshNode * n12,
1690 const SMDS_MeshNode * n23,
1691 const SMDS_MeshNode * n34,
1692 const SMDS_MeshNode * n41,
1693 const SMDS_MeshNode * nCenter)
1695 SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41,nCenter);
1696 if(anElem) myScript->AddFace(anElem->GetID(),
1697 n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
1698 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
1703 //=======================================================================
1704 //function : AddFaceWithID
1706 //=======================================================================
1707 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4,
1708 int n12,int n23,int n34,int n41,
1709 int nCenter, int ID)
1711 SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1,n2,n3,n4,n12,n23,n34,n41,nCenter,ID);
1712 if(anElem) myScript->AddFace(ID,n1,n2,n3,n4,n12,n23,n34,n41,nCenter);
1716 //=======================================================================
1717 //function : AddFaceWithID
1719 //=======================================================================
1720 SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
1721 const SMDS_MeshNode * n2,
1722 const SMDS_MeshNode * n3,
1723 const SMDS_MeshNode * n4,
1724 const SMDS_MeshNode * n12,
1725 const SMDS_MeshNode * n23,
1726 const SMDS_MeshNode * n34,
1727 const SMDS_MeshNode * n41,
1728 const SMDS_MeshNode * nCenter,
1731 return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
1732 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
1733 nCenter->GetID(), ID);
1737 //=======================================================================
1738 //function : AddVolume
1740 //=======================================================================
1741 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
1742 const SMDS_MeshNode * n2,
1743 const SMDS_MeshNode * n3,
1744 const SMDS_MeshNode * n4,
1745 const SMDS_MeshNode * n12,
1746 const SMDS_MeshNode * n23,
1747 const SMDS_MeshNode * n31,
1748 const SMDS_MeshNode * n14,
1749 const SMDS_MeshNode * n24,
1750 const SMDS_MeshNode * n34)
1752 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
1753 if(anElem) myScript->AddVolume(anElem->GetID(),
1754 n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
1755 n12->GetID(), n23->GetID(), n31->GetID(),
1756 n14->GetID(), n24->GetID(), n34->GetID());
1760 //=======================================================================
1761 //function : AddVolumeWithID
1763 //=======================================================================
1764 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
1765 int n12,int n23,int n31,
1766 int n14,int n24,int n34, int ID)
1768 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n12,n23,
1769 n31,n14,n24,n34,ID);
1770 if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
1774 //=======================================================================
1775 //function : AddVolumeWithID
1776 //purpose : 2d order tetrahedron of 10 nodes
1777 //=======================================================================
1778 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
1779 const SMDS_MeshNode * n2,
1780 const SMDS_MeshNode * n3,
1781 const SMDS_MeshNode * n4,
1782 const SMDS_MeshNode * n12,
1783 const SMDS_MeshNode * n23,
1784 const SMDS_MeshNode * n31,
1785 const SMDS_MeshNode * n14,
1786 const SMDS_MeshNode * n24,
1787 const SMDS_MeshNode * n34,
1790 return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
1791 n12->GetID(), n23->GetID(), n31->GetID(),
1792 n14->GetID(), n24->GetID(), n34->GetID(), ID);
1796 //=======================================================================
1797 //function : AddVolume
1799 //=======================================================================
1800 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
1801 const SMDS_MeshNode * n2,
1802 const SMDS_MeshNode * n3,
1803 const SMDS_MeshNode * n4,
1804 const SMDS_MeshNode * n5,
1805 const SMDS_MeshNode * n12,
1806 const SMDS_MeshNode * n23,
1807 const SMDS_MeshNode * n34,
1808 const SMDS_MeshNode * n41,
1809 const SMDS_MeshNode * n15,
1810 const SMDS_MeshNode * n25,
1811 const SMDS_MeshNode * n35,
1812 const SMDS_MeshNode * n45)
1814 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n12,n23,n34,n41,
1817 myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
1818 n3->GetID(), n4->GetID(), n5->GetID(),
1819 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
1820 n15->GetID(), n25->GetID(), n35->GetID(), n45->GetID());
1824 //=======================================================================
1825 //function : AddVolumeWithID
1827 //=======================================================================
1828 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
1829 int n12,int n23,int n34,int n41,
1830 int n15,int n25,int n35,int n45, int ID)
1832 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,
1834 n15,n25,n35,n45,ID);
1835 if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n12,n23,n34,n41,
1840 //=======================================================================
1841 //function : AddVolumeWithID
1842 //purpose : 2d order pyramid of 13 nodes
1843 //=======================================================================
1844 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
1845 const SMDS_MeshNode * n2,
1846 const SMDS_MeshNode * n3,
1847 const SMDS_MeshNode * n4,
1848 const SMDS_MeshNode * n5,
1849 const SMDS_MeshNode * n12,
1850 const SMDS_MeshNode * n23,
1851 const SMDS_MeshNode * n34,
1852 const SMDS_MeshNode * n41,
1853 const SMDS_MeshNode * n15,
1854 const SMDS_MeshNode * n25,
1855 const SMDS_MeshNode * n35,
1856 const SMDS_MeshNode * n45,
1859 return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(),
1860 n4->GetID(), n5->GetID(),
1861 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
1862 n15->GetID(), n25->GetID(), n35->GetID(), n45->GetID(),
1867 //=======================================================================
1868 //function : AddVolume
1869 //purpose : 2nd order pentahedron (prism) with 15 nodes
1870 //=======================================================================
1871 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
1872 const SMDS_MeshNode * n2,
1873 const SMDS_MeshNode * n3,
1874 const SMDS_MeshNode * n4,
1875 const SMDS_MeshNode * n5,
1876 const SMDS_MeshNode * n6,
1877 const SMDS_MeshNode * n12,
1878 const SMDS_MeshNode * n23,
1879 const SMDS_MeshNode * n31,
1880 const SMDS_MeshNode * n45,
1881 const SMDS_MeshNode * n56,
1882 const SMDS_MeshNode * n64,
1883 const SMDS_MeshNode * n14,
1884 const SMDS_MeshNode * n25,
1885 const SMDS_MeshNode * n36)
1887 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n6,n12,n23,n31,
1888 n45,n56,n64,n14,n25,n36);
1890 myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
1891 n3->GetID(), n4->GetID(), n5->GetID(), n6->GetID(),
1892 n12->GetID(), n23->GetID(), n31->GetID(),
1893 n45->GetID(), n56->GetID(), n64->GetID(),
1894 n14->GetID(), n25->GetID(), n36->GetID());
1898 //=======================================================================
1899 //function : AddVolumeWithID
1900 //purpose : 2nd order pentahedron (prism) with 15 nodes
1901 //=======================================================================
1902 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3,
1903 int n4, int n5, int n6,
1904 int n12,int n23,int n31,
1905 int n45,int n56,int n64,
1906 int n14,int n25,int n36, int ID)
1908 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,n6,
1912 if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n6,n12,n23,n31,
1913 n45,n56,n64,n14,n25,n36);
1917 //=======================================================================
1918 //function : AddVolumeWithID
1919 //purpose : 2d order Pentahedron (prism) with 15 nodes
1920 //=======================================================================
1921 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
1922 const SMDS_MeshNode * n2,
1923 const SMDS_MeshNode * n3,
1924 const SMDS_MeshNode * n4,
1925 const SMDS_MeshNode * n5,
1926 const SMDS_MeshNode * n6,
1927 const SMDS_MeshNode * n12,
1928 const SMDS_MeshNode * n23,
1929 const SMDS_MeshNode * n31,
1930 const SMDS_MeshNode * n45,
1931 const SMDS_MeshNode * n56,
1932 const SMDS_MeshNode * n64,
1933 const SMDS_MeshNode * n14,
1934 const SMDS_MeshNode * n25,
1935 const SMDS_MeshNode * n36,
1938 return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(),
1939 n4->GetID(), n5->GetID(), n6->GetID(),
1940 n12->GetID(), n23->GetID(), n31->GetID(),
1941 n45->GetID(), n56->GetID(), n64->GetID(),
1942 n14->GetID(), n25->GetID(), n36->GetID(),
1945 //=======================================================================
1946 //function : AddVolume
1947 //purpose : 2nd order pentahedron (prism) with 18 nodes
1948 //=======================================================================
1949 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
1950 const SMDS_MeshNode * n2,
1951 const SMDS_MeshNode * n3,
1952 const SMDS_MeshNode * n4,
1953 const SMDS_MeshNode * n5,
1954 const SMDS_MeshNode * n6,
1955 const SMDS_MeshNode * n12,
1956 const SMDS_MeshNode * n23,
1957 const SMDS_MeshNode * n31,
1958 const SMDS_MeshNode * n45,
1959 const SMDS_MeshNode * n56,
1960 const SMDS_MeshNode * n64,
1961 const SMDS_MeshNode * n14,
1962 const SMDS_MeshNode * n25,
1963 const SMDS_MeshNode * n36,
1964 const SMDS_MeshNode * n1245,
1965 const SMDS_MeshNode * n2356,
1966 const SMDS_MeshNode * n1346)
1968 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n6,n12,n23,n31,
1969 n45,n56,n64,n14,n25,n36,
1970 n1245, n2356, n1346);
1972 myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
1973 n3->GetID(), n4->GetID(), n5->GetID(), n6->GetID(),
1974 n12->GetID(), n23->GetID(), n31->GetID(),
1975 n45->GetID(), n56->GetID(), n64->GetID(),
1976 n14->GetID(), n25->GetID(), n36->GetID(),
1977 n1245->GetID(), n2356->GetID(), n1346->GetID());
1981 //=======================================================================
1982 //function : AddVolumeWithID
1983 //purpose : 2nd order pentahedron (prism) with 18 nodes
1984 //=======================================================================
1985 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3,
1986 int n4, int n5, int n6,
1987 int n12,int n23,int n31,
1988 int n45,int n56,int n64,
1989 int n14,int n25,int n36,
1990 int n1245, int n2356, int n1346,
1993 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,n6,
1997 n1245, n2356, n1346, ID);
1998 if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n6,n12,n23,n31,
1999 n45,n56,n64,n14,n25,n36, n1245, n2356, n1346);
2003 //=======================================================================
2004 //function : AddVolumeWithID
2005 //purpose : 2d order Pentahedron with 18 nodes
2006 //=======================================================================
2007 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
2008 const SMDS_MeshNode * n2,
2009 const SMDS_MeshNode * n3,
2010 const SMDS_MeshNode * n4,
2011 const SMDS_MeshNode * n5,
2012 const SMDS_MeshNode * n6,
2013 const SMDS_MeshNode * n12,
2014 const SMDS_MeshNode * n23,
2015 const SMDS_MeshNode * n31,
2016 const SMDS_MeshNode * n45,
2017 const SMDS_MeshNode * n56,
2018 const SMDS_MeshNode * n64,
2019 const SMDS_MeshNode * n14,
2020 const SMDS_MeshNode * n25,
2021 const SMDS_MeshNode * n36,
2022 const SMDS_MeshNode * n1245,
2023 const SMDS_MeshNode * n2356,
2024 const SMDS_MeshNode * n1346,
2027 return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(),
2028 n4->GetID(), n5->GetID(), n6->GetID(),
2029 n12->GetID(), n23->GetID(), n31->GetID(),
2030 n45->GetID(), n56->GetID(), n64->GetID(),
2031 n14->GetID(), n25->GetID(), n36->GetID(),
2032 n1245->GetID(), n2356->GetID(), n1346->GetID(), ID);
2036 //=======================================================================
2037 //function : AddVolume
2038 //purpose : add quadratic hexahedron
2039 //=======================================================================
2040 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
2041 const SMDS_MeshNode * n2,
2042 const SMDS_MeshNode * n3,
2043 const SMDS_MeshNode * n4,
2044 const SMDS_MeshNode * n5,
2045 const SMDS_MeshNode * n6,
2046 const SMDS_MeshNode * n7,
2047 const SMDS_MeshNode * n8,
2048 const SMDS_MeshNode * n12,
2049 const SMDS_MeshNode * n23,
2050 const SMDS_MeshNode * n34,
2051 const SMDS_MeshNode * n41,
2052 const SMDS_MeshNode * n56,
2053 const SMDS_MeshNode * n67,
2054 const SMDS_MeshNode * n78,
2055 const SMDS_MeshNode * n85,
2056 const SMDS_MeshNode * n15,
2057 const SMDS_MeshNode * n26,
2058 const SMDS_MeshNode * n37,
2059 const SMDS_MeshNode * n48)
2061 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n6,n7,n8,
2066 myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
2067 n3->GetID(), n4->GetID(), n5->GetID(),
2068 n6->GetID(), n7->GetID(), n8->GetID(),
2069 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
2070 n56->GetID(), n67->GetID(), n78->GetID(), n85->GetID(),
2071 n15->GetID(), n26->GetID(), n37->GetID(), n48->GetID());
2075 //=======================================================================
2076 //function : AddVolumeWithID
2078 //=======================================================================
2079 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
2080 int n5, int n6, int n7, int n8,
2081 int n12,int n23,int n34,int n41,
2082 int n56,int n67,int n78,int n85,
2083 int n15,int n26,int n37,int n48, int ID)
2085 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,n6,n7,n8,
2088 n15,n26,n37,n48,ID);
2089 if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n6,n7,n8,n12,n23,n34,n41,
2090 n56,n67,n78,n85,n15,n26,n37,n48);
2094 //=======================================================================
2095 //function : AddVolumeWithID
2096 //purpose : 2d order Hexahedrons with 20 nodes
2097 //=======================================================================
2098 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
2099 const SMDS_MeshNode * n2,
2100 const SMDS_MeshNode * n3,
2101 const SMDS_MeshNode * n4,
2102 const SMDS_MeshNode * n5,
2103 const SMDS_MeshNode * n6,
2104 const SMDS_MeshNode * n7,
2105 const SMDS_MeshNode * n8,
2106 const SMDS_MeshNode * n12,
2107 const SMDS_MeshNode * n23,
2108 const SMDS_MeshNode * n34,
2109 const SMDS_MeshNode * n41,
2110 const SMDS_MeshNode * n56,
2111 const SMDS_MeshNode * n67,
2112 const SMDS_MeshNode * n78,
2113 const SMDS_MeshNode * n85,
2114 const SMDS_MeshNode * n15,
2115 const SMDS_MeshNode * n26,
2116 const SMDS_MeshNode * n37,
2117 const SMDS_MeshNode * n48,
2120 return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
2121 n5->GetID(), n6->GetID(), n7->GetID(), n8->GetID(),
2122 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
2123 n56->GetID(), n67->GetID(), n78->GetID(), n85->GetID(),
2124 n15->GetID(), n26->GetID(), n37->GetID(), n48->GetID(),
2128 //=======================================================================
2129 //function : AddVolume
2130 //purpose : add tri-quadratic hexahedron of 27 nodes
2131 //=======================================================================
2133 SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
2134 const SMDS_MeshNode * n2,
2135 const SMDS_MeshNode * n3,
2136 const SMDS_MeshNode * n4,
2137 const SMDS_MeshNode * n5,
2138 const SMDS_MeshNode * n6,
2139 const SMDS_MeshNode * n7,
2140 const SMDS_MeshNode * n8,
2141 const SMDS_MeshNode * n12,
2142 const SMDS_MeshNode * n23,
2143 const SMDS_MeshNode * n34,
2144 const SMDS_MeshNode * n41,
2145 const SMDS_MeshNode * n56,
2146 const SMDS_MeshNode * n67,
2147 const SMDS_MeshNode * n78,
2148 const SMDS_MeshNode * n85,
2149 const SMDS_MeshNode * n15,
2150 const SMDS_MeshNode * n26,
2151 const SMDS_MeshNode * n37,
2152 const SMDS_MeshNode * n48,
2153 const SMDS_MeshNode * n1234,
2154 const SMDS_MeshNode * n1256,
2155 const SMDS_MeshNode * n2367,
2156 const SMDS_MeshNode * n3478,
2157 const SMDS_MeshNode * n1458,
2158 const SMDS_MeshNode * n5678,
2159 const SMDS_MeshNode * nCenter)
2161 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n6,n7,n8,
2165 n1234,n1256,n2367,n3478,n1458,n5678,nCenter);
2167 myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
2168 n3->GetID(), n4->GetID(), n5->GetID(),
2169 n6->GetID(), n7->GetID(), n8->GetID(),
2170 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
2171 n56->GetID(), n67->GetID(), n78->GetID(), n85->GetID(),
2172 n15->GetID(), n26->GetID(), n37->GetID(), n48->GetID(),
2173 n1234->GetID(),n1256->GetID(),n2367->GetID(),n3478->GetID(),
2174 n1458->GetID(),n5678->GetID(),nCenter->GetID());
2178 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
2179 int n5, int n6, int n7, int n8,
2180 int n12,int n23,int n34,int n41,
2181 int n56,int n67,int n78,int n85,
2182 int n15,int n26,int n37,int n48,
2183 int n1234,int n1256,int n2367,int n3478,
2184 int n1458,int n5678,int nCenter,
2187 SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,n6,n7,n8,
2191 n1234, n1256, n2367, n3478,
2192 n1458, n5678, nCenter,
2194 if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n6,n7,n8,n12,n23,n34,n41,
2195 n56,n67,n78,n85,n15,n26,n37,n48,
2196 n1234, n1256, n2367, n3478,
2197 n1458, n5678, nCenter);
2201 SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
2202 const SMDS_MeshNode * n2,
2203 const SMDS_MeshNode * n3,
2204 const SMDS_MeshNode * n4,
2205 const SMDS_MeshNode * n5,
2206 const SMDS_MeshNode * n6,
2207 const SMDS_MeshNode * n7,
2208 const SMDS_MeshNode * n8,
2209 const SMDS_MeshNode * n12,
2210 const SMDS_MeshNode * n23,
2211 const SMDS_MeshNode * n34,
2212 const SMDS_MeshNode * n41,
2213 const SMDS_MeshNode * n56,
2214 const SMDS_MeshNode * n67,
2215 const SMDS_MeshNode * n78,
2216 const SMDS_MeshNode * n85,
2217 const SMDS_MeshNode * n15,
2218 const SMDS_MeshNode * n26,
2219 const SMDS_MeshNode * n37,
2220 const SMDS_MeshNode * n48,
2221 const SMDS_MeshNode * n1234,
2222 const SMDS_MeshNode * n1256,
2223 const SMDS_MeshNode * n2367,
2224 const SMDS_MeshNode * n3478,
2225 const SMDS_MeshNode * n1458,
2226 const SMDS_MeshNode * n5678,
2227 const SMDS_MeshNode * nCenter,
2230 return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
2231 n5->GetID(), n6->GetID(), n7->GetID(), n8->GetID(),
2232 n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
2233 n56->GetID(), n67->GetID(), n78->GetID(), n85->GetID(),
2234 n15->GetID(), n26->GetID(), n37->GetID(), n48->GetID(),
2235 n1234->GetID(),n1256->GetID(),n2367->GetID(),n3478->GetID(),
2236 n1458->GetID(),n5678->GetID(),nCenter->GetID(), ID);
2239 void SMESHDS_Mesh::CompactMesh()
2241 if ( IsCompacted() )
2244 SMDS_Mesh::CompactMesh();
2246 this->myScript->SetModified(true); // notify GUI client for buildPrs when update
2249 void SMESHDS_Mesh::CleanDownWardConnectivity()
2251 myGrid->CleanDownwardConnectivity();
2254 void SMESHDS_Mesh::BuildDownWardConnectivity(bool withEdges)
2256 myGrid->BuildDownwardConnectivity(withEdges);
2259 /*! change some nodes in cell without modifying type or internal connectivity.
2260 * Nodes inverse connectivity is maintained up to date.
2261 * @param vtkVolId vtk id of the cell.
2262 * @param localClonedNodeIds map old node id to new node id.
2263 * @return ok if success.
2265 bool SMESHDS_Mesh::ModifyCellNodes(int vtkVolId, std::map<int,int> localClonedNodeIds)
2267 myGrid->ModifyCellNodes(vtkVolId, localClonedNodeIds);