+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new tetrahedron and add it to the mesh.
+///@return The created tetrahedron
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4)
+{
+ return SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, myCellFactory->GetFreeID() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new tetrahedron and add it to the mesh.
+///@param ID The ID of the new volume
+///@return The created tetrahedron or NULL if an element with this ID already exists
+///or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+ int idnode2,
+ int idnode3,
+ int idnode4,
+ int ID)
+{
+ const SMDS_MeshNode *node1, *node2, *node3, *node4;
+ node1 = myNodeFactory->FindNode(idnode1);
+ node2 = myNodeFactory->FindNode(idnode2);
+ node3 = myNodeFactory->FindNode(idnode3);
+ node4 = myNodeFactory->FindNode(idnode4);
+ if(!node1 || !node2 || !node3 || !node4) return NULL;
+ return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new tetrahedron and add it to the mesh.
+///@param ID The ID of the new volume
+///@return The created tetrahedron
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n4 ) return 0;
+ if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
+ if ( SMDS_MeshCell* cell = myCellFactory->NewCell( ID ))
+ {
+ cell->init( SMDSEntity_Tetra, /*nbNodes=*/4, n1, n2, n3, n4 );
+ myInfo.myNbTetras++;
+ return static_cast<SMDS_MeshVolume*>( cell );
+ }
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new pyramid and add it to the mesh.
+///Nodes 1,2,3 and 4 define the base of the pyramid
+///@return The created pyramid
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5)
+{
+ return SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, myCellFactory->GetFreeID() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new pyramid and add it to the mesh.
+///Nodes 1,2,3 and 4 define the base of the pyramid
+///@param ID The ID of the new volume
+///@return The created pyramid or NULL if an element with this ID already exists
+///or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+ int idnode2,
+ int idnode3,
+ int idnode4,
+ int idnode5,
+ int ID)
+{
+ const SMDS_MeshNode *node1, *node2, *node3, *node4, *node5;
+ node1 = myNodeFactory->FindNode(idnode1);
+ node2 = myNodeFactory->FindNode(idnode2);
+ node3 = myNodeFactory->FindNode(idnode3);
+ node4 = myNodeFactory->FindNode(idnode4);
+ node5 = myNodeFactory->FindNode(idnode5);
+ if(!node1 || !node2 || !node3 || !node4 || !node5) return NULL;
+ return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new pyramid and add it to the mesh.
+///Nodes 1,2,3 and 4 define the base of the pyramid
+///@param ID The ID of the new volume
+///@return The created pyramid
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n4 || !n5 ) return 0;
+ if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
+ if ( SMDS_MeshCell* cell = myCellFactory->NewCell( ID ))
+ {
+ cell->init( SMDSEntity_Pyramid, /*nbNodes=*/5, n1, n2, n3, n4, n5 );
+ myInfo.myNbPyramids++;
+ return static_cast<SMDS_MeshVolume*>( cell );
+ }
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new prism and add it to the mesh.
+///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
+///@return The created prism
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6)
+{
+ int ID = myCellFactory->GetFreeID();
+ return SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new prism and add it to the mesh.
+///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
+///@param ID The ID of the new volume
+///@return The created prism or NULL if an element with this ID already exists
+///or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+ int idnode2,
+ int idnode3,
+ int idnode4,
+ int idnode5,
+ int idnode6,
+ int ID)
+{
+ const SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6;
+ node1 = myNodeFactory->FindNode(idnode1);
+ node2 = myNodeFactory->FindNode(idnode2);
+ node3 = myNodeFactory->FindNode(idnode3);
+ node4 = myNodeFactory->FindNode(idnode4);
+ node5 = myNodeFactory->FindNode(idnode5);
+ node6 = myNodeFactory->FindNode(idnode6);
+ return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new prism and add it to the mesh.
+///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
+///@param ID The ID of the new volume
+///@return The created prism
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6 ) return 0;
+ if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
+ if ( SMDS_MeshCell* cell = myCellFactory->NewCell( ID ))
+ {
+ cell->init( SMDSEntity_Penta, /*nbNodes=*/6, n1, n2, n3, n4, n5, n6 );
+ myInfo.myNbPrisms++;
+ return static_cast<SMDS_MeshVolume*>( cell );
+ }
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new hexagonal prism and add it to the mesh.
+///@return The created prism
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n9,
+ const SMDS_MeshNode * n10,
+ const SMDS_MeshNode * n11,
+ const SMDS_MeshNode * n12)
+{
+ return SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6,
+ n7, n8, n9, n10, n11, n12,
+ myCellFactory->GetFreeID() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new hexagonal prism and add it to the mesh.
+///@param ID The ID of the new volume
+///@return The created prism or NULL if an element with this ID already exists
+///or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+ int idnode2,
+ int idnode3,
+ int idnode4,
+ int idnode5,
+ int idnode6,
+ int idnode7,
+ int idnode8,
+ int idnode9,
+ int idnode10,
+ int idnode11,
+ int idnode12,
+ int ID)
+{
+ const SMDS_MeshNode *node1 = myNodeFactory->FindNode(idnode1);
+ const SMDS_MeshNode *node2 = myNodeFactory->FindNode(idnode2);
+ const SMDS_MeshNode *node3 = myNodeFactory->FindNode(idnode3);
+ const SMDS_MeshNode *node4 = myNodeFactory->FindNode(idnode4);
+ const SMDS_MeshNode *node5 = myNodeFactory->FindNode(idnode5);
+ const SMDS_MeshNode *node6 = myNodeFactory->FindNode(idnode6);
+ const SMDS_MeshNode *node7 = myNodeFactory->FindNode(idnode7);
+ const SMDS_MeshNode *node8 = myNodeFactory->FindNode(idnode8);
+ const SMDS_MeshNode *node9 = myNodeFactory->FindNode(idnode9);
+ const SMDS_MeshNode *node10 = myNodeFactory->FindNode(idnode10);
+ const SMDS_MeshNode *node11 = myNodeFactory->FindNode(idnode11);
+ const SMDS_MeshNode *node12 = myNodeFactory->FindNode(idnode12);
+ return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6,
+ node7, node8, node9, node10, node11, node12,
+ ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new hexagonal prism and add it to the mesh.
+///@param ID The ID of the new volume
+///@return The created prism
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n9,
+ const SMDS_MeshNode * n10,
+ const SMDS_MeshNode * n11,
+ const SMDS_MeshNode * n12,
+ int ID)
+{
+ SMDS_MeshVolume* volume = 0;
+ if(!n1 || !n2 || !n3 || !n4 || !n5 || !n6 ||
+ !n7 || !n8 || !n9 || !n10 || !n11 || !n12 )
+ return volume;
+ if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
+ if ( SMDS_MeshCell* cell = myCellFactory->NewCell( ID ))
+ {
+ cell->init( SMDSEntity_Hexagonal_Prism,
+ /*nbNodes=*/12, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12 );
+ myInfo.myNbHexPrism++;
+ return static_cast<SMDS_MeshVolume*>( cell );
+ }
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new hexahedron and add it to the mesh.
+///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
+///@return The created hexahedron
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8)
+{
+ int ID = myCellFactory->GetFreeID();
+ return SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new hexahedron and add it to the mesh.
+///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
+///@param ID The ID of the new volume
+///@return The created hexahedron or NULL if an element with this ID already
+///exists or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+ int idnode2,
+ int idnode3,
+ int idnode4,
+ int idnode5,
+ int idnode6,
+ int idnode7,
+ int idnode8,
+ int ID)
+{
+ const SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6, *node7, *node8;
+ node1 = myNodeFactory->FindNode(idnode1);
+ node2 = myNodeFactory->FindNode(idnode2);
+ node3 = myNodeFactory->FindNode(idnode3);
+ node4 = myNodeFactory->FindNode(idnode4);
+ node5 = myNodeFactory->FindNode(idnode5);
+ node6 = myNodeFactory->FindNode(idnode6);
+ node7 = myNodeFactory->FindNode(idnode7);
+ node8 = myNodeFactory->FindNode(idnode8);
+ return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6,
+ node7, node8, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///Create a new hexahedron and add it to the mesh.
+///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
+///@param ID The ID of the new volume
+///@return The created prism or NULL if an element with this ID already exists
+///or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n7,
+ const SMDS_MeshNode * n8,
+ int ID)
+{
+ SMDS_MeshVolume* volume = 0;
+ if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6 || !n7 || !n8) return volume;
+ if ( NbVolumes() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
+ if ( SMDS_MeshCell* cell = myCellFactory->NewCell( ID ))
+ {
+ cell->init( SMDSEntity_Hexa,
+ /*nbNodes=*/8, n1, n2, n3, n4, n5, n6, n7, n8 );
+ myInfo.myNbHexas++;
+ return static_cast<SMDS_MeshVolume*>( cell );
+ }
+ return 0;