From 06d4c3480d96566b436e21691180f319bc86c2ac Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 23 Mar 2005 09:33:59 +0000 Subject: [PATCH] task "Polyhedral elements". Add static methods about face nodes. --- src/SMDS/SMDS_VolumeTool.cxx | 73 ++++++++++++++++++++++++++++++++++++ src/SMDS/SMDS_VolumeTool.hxx | 23 ++++++++++++ 2 files changed, 96 insertions(+) diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index 62d24bb76..dd98851eb 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -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; +} + diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index ca64d9c11..89732b1da 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -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: -- 2.39.2