X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_VolumeTool.hxx;h=8d82a609169fba6fba94d62a954a276688170679;hb=73edef8516dde65e4d0743c56965fac019166c4e;hp=0c840a512c09371fcc83173b5d18dacee704559f;hpb=e4737e85f0da6d3f90fd08f6be1c2825195fe16f;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index 0c840a512..8d82a6091 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -1,37 +1,40 @@ -// SMESH SMDS : implementaion of Salome mesh data structure +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// SMESH SMDS : implementaion of Salome mesh data structure // File : SMDS_VolumeTool.hxx // Module : SMESH // Created : Tue Jul 13 11:27:17 2004 // Author : Edward AGAPOV (eap) - - +// #ifndef SMDS_VolumeTool_HeaderFile #define SMDS_VolumeTool_HeaderFile +#include "SMESH_SMDS.hxx" + class SMDS_MeshElement; class SMDS_MeshNode; +class SMDS_PolyhedralVolumeOfNodes; +class SMDS_MeshVolume; #include #include @@ -44,10 +47,13 @@ class SMDS_MeshNode; // // ========================================================================= -class SMDS_VolumeTool +class SMDS_EXPORT SMDS_VolumeTool { public: + enum VolumeType { UNKNOWN = -1, TETRA = 0, PYRAM, PENTA, HEXA, QUAD_TETRA, + QUAD_PYRAM, QUAD_PENTA, QUAD_HEXA, POLYHEDA }; + SMDS_VolumeTool (); ~SMDS_VolumeTool (); SMDS_VolumeTool (const SMDS_MeshElement* theVolume); @@ -56,13 +62,21 @@ class SMDS_VolumeTool // Set volume. // Return false if theVolume is not of type SMDSAbs_Volume + const SMDS_MeshVolume* Element() const; + // return element + + int ID() const; + // return element ID + // ----------------------- // general info // ----------------------- + VolumeType GetVolumeType() const; + bool IsForward() const { return myVolForward; } // Check volume orientation. can be changed by Inverse(). - // See node order of forward volumes at file bottom + // See node order of forward volumes at the file bottom void Inverse(); // Change nodes order as if the volume changes its orientation: @@ -80,33 +94,38 @@ class SMDS_VolumeTool bool GetBaryCenter (double & X, double & Y, double & Z) const; + bool IsOut(double X, double Y, double Z, double tol); + // Classify a point // ----------------------- // info on node connection // ----------------------- bool IsLinked (const SMDS_MeshNode* theNode1, - const SMDS_MeshNode* theNode2) const; + const SMDS_MeshNode* theNode2, + const bool theIgnoreMediumNodes=false) const; // Return true if theNode1 is linked with theNode2. + // If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well bool IsLinked (const int theNode1Index, - const int theNode2Index) const; + const int theNode2Index, + bool theIgnoreMediumNodes=false) const; // Return true if the node with theNode1Index is linked // with the node with theNode2Index + // If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well int GetNodeIndex(const SMDS_MeshNode* theNode) const; // Return an index of theNode + int GetAllExistingEdges(std::vector & edges) const; + // Fill vector with boundary edges existing in the mesh + // ------------- // info on faces // ------------- - void SetForwardOrientation (); - // Node order in faces will be as for forward orientation - void SetExternalNormal (); // Node order in faces will be so that faces normals are external. - // It overrides SetForwardOrientation() int NbFaces() const { return myNbFaces; } // Return number of faces of the volume. In the following @@ -135,8 +154,7 @@ class SMDS_VolumeTool bool IsFaceExternal( int faceIndex ); // Check normal orientation of a face. - // SetForwardOrientation() and SetForwardOrientation() are taken - // into account. + // SetExternalNormal() is taken into account. bool IsFreeFace( int faceIndex ); // Check that all volumes built on the face nodes lays on one side @@ -144,6 +162,9 @@ class SMDS_VolumeTool bool GetFaceNormal (int faceIndex, double & X, double & Y, double & Z); // Return a normal to a face + bool GetFaceBaryCenter (int faceIndex, double & X, double & Y, double & Z); + // Return barycenter of a face + double GetFaceArea( int faceIndex ); // Return face area @@ -154,27 +175,57 @@ class SMDS_VolumeTool // Return index of a face formed by theFaceNodes. // Return -1 if a face not found - int GetFaceIndex( const std::set& theFaceNodesIndices ); + //int GetFaceIndex( const std::set& theFaceNodesIndices ); // Return index of a face formed by theFaceNodesIndices // Return -1 if a face not found + int GetAllExistingFaces(std::vector & faces); + // Fill vector with boundary faces existing in the mesh - private: + // ------------------------ + // static methods for faces + // ------------------------ + + 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 + + static int NbCornerNodes(VolumeType type); + // Useful to know nb of corner nodes of a quadratic volume + +private: bool setFace( int faceIndex ); const SMDS_MeshElement* myVolume; + const SMDS_PolyhedralVolumeOfNodes* myPolyedre; + bool myVolForward; int myNbFaces; int myVolumeNbNodes; - const SMDS_MeshNode* myVolumeNodes[ 8 ]; + const SMDS_MeshNode** myVolumeNodes; + std::vector< int > myPolyIndices; - bool myForwardFaces; bool myExternalFaces; - int* myFaceNodeIndices; - int* myFaceNbNodes; - const SMDS_MeshNode* myFaceNodes[ 5 ]; + int myCurFace; + int myFaceNbNodes; + int* myFaceNodeIndices; + const SMDS_MeshNode** myFaceNodes; }; #endif @@ -191,13 +242,13 @@ class SMDS_VolumeTool // /|\ // / | \ // / | \ -// N0 +---|---+ N2 TETRAHEDRON +// N0 +---|---+ N1 TETRAHEDRON // \ | / // \ | / // \ | / // \|/ // + -// N1 +// N2 // + N4 // /|\ @@ -213,18 +264,18 @@ class SMDS_VolumeTool // |/ \| // N0 +---------+ N2 -// N7+----------+N6 +// N5+----------+N6 // /| /| // / | / | // / | / | -// N4+----------+N5 | +// N4+----------+N7 | // | | | | HEXAHEDRON // | | | | // | | | | -// | N3+------|---+N2 +// | N1+------|---+N2 // | / | / // | / | / // |/ |/ -// N0+----------+N1 +// N0+----------+N3 // */