]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMDS/SMDS_VtkVolume.cxx
Salome HOME
PR: SMDS refactoring in progress
[modules/smesh.git] / src / SMDS / SMDS_VtkVolume.cxx
index aa0b5d79bed29bc4a4ffee9952989d5bd2c37f50..ebcc20851af4fe585504a0b7a2ce9b557b5d66d5 100644 (file)
@@ -17,7 +17,10 @@ SMDS_VtkVolume::SMDS_VtkVolume(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
   init(nodeIds, mesh);
 }
-
+/*!
+ * typed used are vtk types (@see vtkCellType.h)
+ * see GetEntityType() for conversion in SMDS type (@see SMDSAbs_ElementType.hxx)
+ */
 void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
   vtkUnstructuredGrid* grid = mesh->getGrid();
@@ -26,11 +29,15 @@ void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
   vtkIdType aType = VTK_TETRA;
   switch(nodeIds.size())
     {
-    case 4: aType = VTK_TETRA;   break;
-    case 5: aType = VTK_PYRAMID; break;
-    case 6: aType = VTK_WEDGE;   break;
-    case 8:
-    default: aType = VTK_HEXAHEDRON;    break;
+    case  4: aType = VTK_TETRA;                break;
+    case  5: aType = VTK_PYRAMID;              break;
+    case  6: aType = VTK_WEDGE;                break;
+    case  8: aType = VTK_HEXAHEDRON;           break;
+    case 10: aType = VTK_QUADRATIC_TETRA;      break;
+    case 13: aType = VTK_QUADRATIC_PYRAMID;    break;
+    case 15: aType = VTK_QUADRATIC_WEDGE;      break;
+    case 20: aType = VTK_QUADRATIC_HEXAHEDRON; break;
+    default: aType = VTK_HEXAHEDRON; break;
     }
   myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
 }
@@ -55,10 +62,14 @@ int SMDS_VtkVolume::NbFaces() const
 {
   switch(NbNodes())
     {
-    case 4: return 4;
-    case 5: return 5;
-    case 6: return 5;
-    case 8: return 6;
+    case  4:
+    case 10: return 4;
+    case  5:
+    case 13: return 5;
+    case  6:
+    case 15: return 5;
+    case  8:
+    case 20: return 6;
     default: MESSAGE("invalid number of nodes");
     }
   return 0;
@@ -75,10 +86,14 @@ int SMDS_VtkVolume::NbEdges() const
 {
   switch(NbNodes())
     {
-    case 4: return 6;
-    case 5: return 8;
-    case 6: return 9;
-    case 8: return 12;
+    case  4:
+    case 10: return 6;
+    case  5:
+    case 13: return 8;
+    case  6:
+    case 15: return 9;
+    case  8:
+    case 20: return 12;
     default: MESSAGE("invalid number of nodes");
     }
   return 0;
@@ -108,7 +123,15 @@ SMDSAbs_ElementType SMDS_VtkVolume::GetType() const
  */
 const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
 {
-  return 0;
+  return SMDS_MeshElement::GetNode(ind); // --- a optimiser !
+}
+
+bool SMDS_VtkVolume::IsQuadratic() const
+{
+  if (this->NbNodes() > 9)
+       return true;
+  else
+       return false;
 }
 
 SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
@@ -116,11 +139,15 @@ SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
   SMDSAbs_EntityType aType = SMDSEntity_Tetra;
   switch(NbNodes())
     {
-    case 4: aType = SMDSEntity_Tetra;   break;
-    case 5: aType = SMDSEntity_Pyramid; break;
-    case 6: aType = SMDSEntity_Penta;   break;
-    case 8:
-    default: aType = SMDSEntity_Hexa;   break;
+    case  4: aType = SMDSEntity_Tetra;        break;
+    case  5: aType = SMDSEntity_Pyramid;      break;
+    case  6: aType = SMDSEntity_Penta;        break;
+    case  8: aType = SMDSEntity_Hexa;         break;
+    case 10: aType = SMDSEntity_Quad_Tetra;   break;
+    case 13: aType = SMDSEntity_Quad_Pyramid; break;
+    case 15: aType = SMDSEntity_Quad_Penta;   break;
+    case 20: aType = SMDSEntity_Quad_Hexa;    break;
+    default: aType = SMDSEntity_Hexa;         break;
     }
   return aType;
 }
@@ -130,11 +157,15 @@ vtkIdType SMDS_VtkVolume::GetVtkType() const
   vtkIdType aType = VTK_TETRA;
   switch(NbNodes())
     {
-    case 4: aType = VTK_TETRA;   break;
-    case 5: aType = VTK_PYRAMID; break;
-    case 6: aType = VTK_WEDGE;   break;
-    case 8:
-    default: aType = VTK_HEXAHEDRON;    break;
+    case  4: aType = VTK_TETRA;                break;
+    case  5: aType = VTK_PYRAMID;              break;
+    case  6: aType = VTK_WEDGE;                break;
+    case  8: aType = VTK_HEXAHEDRON;           break;
+    case 10: aType = VTK_QUADRATIC_TETRA;      break;
+    case 13: aType = VTK_QUADRATIC_PYRAMID;    break;
+    case 15: aType = VTK_QUADRATIC_WEDGE;      break;
+    case 20: aType = VTK_QUADRATIC_HEXAHEDRON; break;
+    default: aType = VTK_HEXAHEDRON;           break;
     }
  return aType;
 }