Salome HOME
task "Polyhedral elements". Add static methods about face nodes.
authoreap <eap@opencascade.com>
Wed, 23 Mar 2005 09:33:59 +0000 (09:33 +0000)
committereap <eap@opencascade.com>
Wed, 23 Mar 2005 09:33:59 +0000 (09:33 +0000)
src/SMDS/SMDS_VolumeTool.cxx
src/SMDS/SMDS_VolumeTool.hxx

index 62d24bb760d499015b57194f8d87e8de99c31f85..dd98851eb8f84f9239f18fd5a1e6bded4ec87b69 100644 (file)
@@ -960,3 +960,76 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
 
   return true;
 }
+
+//=======================================================================
+//function : GetType
+//purpose  : return VolumeType by nb of nodes in a volume
+//=======================================================================
+
+SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
+{
+  switch ( nbNodes ) {
+  case 4: return TETRA;
+  case 5: return PYRAM;
+  case 6: return PENTA;
+  case 8: return HEXA;
+  default:return UNKNOWN;
+  }
+}
+
+//=======================================================================
+//function : NbFaces
+//purpose  : return nb of faces by volume type
+//=======================================================================
+
+int SMDS_VolumeTool::NbFaces( VolumeType type )
+{
+  switch ( type ) {
+  case TETRA: return 4;
+  case PYRAM: return 5;
+  case PENTA: return 5;
+  case HEXA : return 6;
+  default:    return 0;
+  }
+}
+
+//=======================================================================
+//function : GetFaceNodesIndices
+//purpose  : Return the array of face nodes indices
+//           To comfort link iteration, the array
+//           length == NbFaceNodes( faceIndex ) + 1 and
+//           the last node index == the first one.
+//=======================================================================
+
+const int* SMDS_VolumeTool::GetFaceNodesIndices(VolumeType type,
+                                                int        faceIndex,
+                                                bool       external)
+{
+  switch ( type ) {
+  case TETRA: return Tetra_F[ faceIndex ];
+  case PYRAM: return Pyramid_F[ faceIndex ];
+  case PENTA: return external ? Penta_FE[ faceIndex ] : Penta_F[ faceIndex ];
+  case HEXA:  return external ? Hexa_FE[ faceIndex ] : Hexa_F[ faceIndex ];
+  default:;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : NbFaceNodes
+//purpose  : Return number of nodes in the array of face nodes
+//=======================================================================
+
+int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
+                                 int        faceIndex )
+{
+  switch ( type ) {
+  case TETRA: return Tetra_nbN[ faceIndex ];
+  case PYRAM: return Pyramid_nbN[ faceIndex ];
+  case PENTA: return Penta_nbN[ faceIndex ];
+  case HEXA:  return Hexa_nbN[ faceIndex ];
+  default:;
+  }
+  return 0;
+}
+
index ca64d9c11280565f9e83d89ef399db2423cd492f..89732b1da2c265a8f4c40ec8f1eb3de77b7a4622 100644 (file)
@@ -154,6 +154,29 @@ class SMDS_VolumeTool
   // Return index of a face formed by theFaceNodesIndices
   // Return -1 if a face not found
 
+  // ------------------------
+  // static methods for faces
+  // ------------------------
+
+  enum VolumeType { UNKNOWN, TETRA, PYRAM, PENTA, HEXA };
+
+  static VolumeType GetType(int nbNodes);
+  // return VolumeType by nb of nodes in a volume
+
+  static int NbFaces( VolumeType type );
+  // return nb of faces by volume type
+
+  static const int* GetFaceNodesIndices(VolumeType type,
+                                        int        faceIndex,
+                                        bool       external);
+  // Return the array of face nodes indices
+  // To comfort link iteration, the array
+  // length == NbFaceNodes( faceIndex ) + 1 and
+  // the last node index == the first one.
+
+  static int NbFaceNodes(VolumeType type,
+                         int        faceIndex );
+  // Return number of nodes in the array of face nodes
 
  private: