+///////////////////////////////////////////////////////////////////////////////
+///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 = myElementIDFactory->GetFreeID();
+ SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
+ if(v==NULL) myElementIDFactory->ReleaseID(ID);
+ return v;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///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)
+{
+ SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6, *node7, *node8;
+ node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+ node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
+ node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
+ node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
+ node5 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode5);
+ node6 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode6);
+ node7 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode7);
+ node8 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode8);
+ if(!node1 || !node2 || !node3 || !node4 || !node5 || !node6 || !node7 || !node8)
+ return NULL;
+ 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;
+ if(hasConstructionFaces()) {
+ SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4);
+ SMDS_MeshFace * f2=FindFaceOrCreate(n5,n6,n7,n8);
+ SMDS_MeshFace * f3=FindFaceOrCreate(n1,n4,n8,n5);
+ SMDS_MeshFace * f4=FindFaceOrCreate(n1,n2,n6,n5);
+ SMDS_MeshFace * f5=FindFaceOrCreate(n2,n3,n7,n6);
+ SMDS_MeshFace * f6=FindFaceOrCreate(n3,n4,n8,n7);
+ volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
+ myVolumes.Add(volume);
+ }
+ else if(hasConstructionEdges()) {
+ MESSAGE("Error : Not implemented");
+ return NULL;
+ }
+ else {
+// volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
+ volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
+ myVolumes.Add(volume);
+ }