X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_VolumeTool.hxx;h=ff067eb3a94bed4913814c1444725d92d282c883;hb=9645435524d6601ce3d0da6d226d9c11991d864e;hp=f21a47209384978a7016b7ca28499dc4c9a58a88;hpb=91c92cb54310225231438b4d3bafeb0d1643a7c0;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index f21a47209..ff067eb3a 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 @@ -51,16 +51,21 @@ class SMDS_EXPORT SMDS_VolumeTool { public: - enum VolumeType { UNKNOWN = -1, TETRA = 0, PYRAM, PENTA, HEXA, QUAD_TETRA, - QUAD_PYRAM, QUAD_PENTA, QUAD_HEXA, POLYHEDA }; + enum VolumeType { UNKNOWN = -1, TETRA = 0, PYRAM, PENTA, HEXA, + HEX_PRISM, QUAD_TETRA, QUAD_PYRAM, QUAD_PENTA, QUAD_HEXA, + POLYHEDA, NB_VOLUME_TYPES }; // to keep synchronised with GetSize()! SMDS_VolumeTool (); ~SMDS_VolumeTool (); - SMDS_VolumeTool (const SMDS_MeshElement* theVolume); + SMDS_VolumeTool (const SMDS_MeshElement* theVolume, + const bool ignoreCentralNodes=true); - bool Set (const SMDS_MeshElement* theVolume); + bool Set (const SMDS_MeshElement* theVolume, + const bool ignoreCentralNodes=true); // Set volume. - // Return false if theVolume is not of type SMDSAbs_Volume + // Return false if theVolume is not of type SMDSAbs_Volume. + // ignoreCentralNodes makes skip nodes at face centers when returning + // nodes of faces of SMDSEntity_TriQuad_Hexa const SMDS_MeshVolume* Element() const; // return element @@ -94,7 +99,7 @@ class SMDS_EXPORT SMDS_VolumeTool bool GetBaryCenter (double & X, double & Y, double & Z) const; - bool IsOut(double X, double Y, double Z, double tol); + bool IsOut(double X, double Y, double Z, double tol) const; // Classify a point // ----------------------- @@ -120,9 +125,18 @@ class SMDS_EXPORT SMDS_VolumeTool int GetAllExistingEdges(std::vector & edges) const; // Fill vector with boundary edges existing in the mesh + double MinLinearSize2() const; + // Return minimal square distance between connected corner nodes + + double MaxLinearSize2() const; + // Return maximal square distance between connected corner nodes + // ------------- // info on faces // ------------- + // For all elements, 0-th face is bottom based on the first nodes. + // For prismatic elements (tetra,hexa,prisms), 1-th face is a top one. + // For all elements, side faces follow order of bottom nodes void SetExternalNormal (); // Node order in faces will be so that faces normals are external. @@ -131,52 +145,57 @@ class SMDS_EXPORT SMDS_VolumeTool // Return number of faces of the volume. In the following // methods 0 <= faceIndex < NbFaces() - int NbFaceNodes( int faceIndex ); + int NbFaceNodes( int faceIndex ) const; // Return number of nodes in the array of face nodes - const int* GetFaceNodesIndices( int faceIndex ); + const int* GetFaceNodesIndices( int faceIndex ) const; // 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. - // NOTE: for the quadratic volume, node indoces are in the order the nodes encounter + // the last node index == the first one, except for + // SMDSEntity_TriQuad_Hexa at ignoreCentralNodes==false. + // NOTE: for the quadratic volume, node indices are in the order the nodes encounter // in face boundary and not the order they are in the mesh face - const SMDS_MeshNode** GetFaceNodes( int faceIndex ); + const SMDS_MeshNode** GetFaceNodes( int faceIndex ) const; // Return the array of face nodes. // To comfort link iteration, the array // length == NbFaceNodes( faceIndex ) + 1 and - // the last node == the first one. + // the last node == the first one, except for + // SMDSEntity_TriQuad_Hexa at ignoreCentralNodes==false. // NOTE: for the quadratic volume, nodes are in the order they encounter in face boundary // and not the order they are in the mesh face // WARNING: do not modify the array, some methods // work basing on its contents bool GetFaceNodes (int faceIndex, - std::set& theFaceNodes ); + std::set& theFaceNodes ) const; // Return a set of face nodes. - bool IsFaceExternal( int faceIndex ); + bool IsFaceExternal( int faceIndex ) const; // Check normal orientation of a face. // SetExternalNormal() is taken into account. - bool IsFreeFace( int faceIndex, const SMDS_MeshElement** otherVol=0 ); + bool IsFreeFace( int faceIndex, const SMDS_MeshElement** otherVol=0 ) const; // Check that all volumes built on the face nodes lays on one side // otherVol returns another volume sharing the given facet - bool GetFaceNormal (int faceIndex, double & X, double & Y, double & Z); + bool GetFaceNormal (int faceIndex, double & X, double & Y, double & Z) const; // Return a normal to a face - bool GetFaceBaryCenter (int faceIndex, double & X, double & Y, double & Z); + bool GetFaceBaryCenter (int faceIndex, double & X, double & Y, double & Z) const; // Return barycenter of a face - double GetFaceArea( int faceIndex ); + double GetFaceArea( int faceIndex ) const; // Return face area int GetOppFaceIndex( int faceIndex ) const; // Return index of the opposite face if it exists, else -1. - int GetFaceIndex( const std::set& theFaceNodes ); + int GetCenterNodeIndex( int faceIndex ) const; + // Return index of the node located at face center of a quadratic element like HEX27 + + int GetFaceIndex( const std::set& theFaceNodes ) const; // Return index of a face formed by theFaceNodes. // Return -1 if a face not found @@ -184,7 +203,7 @@ class SMDS_EXPORT SMDS_VolumeTool // Return index of a face formed by theFaceNodesIndices // Return -1 if a face not found - int GetAllExistingFaces(std::vector & faces); + int GetAllExistingFaces(std::vector & faces) const; // Fill vector with boundary faces existing in the mesh // ------------------------ @@ -204,20 +223,22 @@ class SMDS_EXPORT SMDS_VolumeTool // To comfort link iteration, the array // length == NbFaceNodes( faceIndex ) + 1 and // the last node index == the first one. + // Nodes at face centers of SMDSEntity_TriQuad_Hexa are ignored - static int NbFaceNodes(VolumeType type, - int faceIndex ); + static int NbFaceNodes(VolumeType type, int faceIndex ); // Return number of nodes in the array of face nodes + // Nodes at face centers of SMDSEntity_TriQuad_Hexa are ignored static int NbCornerNodes(VolumeType type); // Useful to know nb of corner nodes of a quadratic volume private: - bool setFace( int faceIndex ); + bool setFace( int faceIndex ) const; const SMDS_MeshElement* myVolume; const SMDS_VtkVolume* myPolyedre; + bool myIgnoreCentralNodes; bool myVolForward; int myNbFaces; @@ -225,12 +246,17 @@ private: const SMDS_MeshNode** myVolumeNodes; std::vector< int > myPolyIndices; - bool myExternalFaces; + mutable bool myExternalFaces; + + mutable const int* myAllFacesNodeIndices_F; + mutable const int* myAllFacesNodeIndices_RE; + mutable const int* myAllFacesNbNodes; + mutable int myMaxFaceNbNodes; - int myCurFace; - int myFaceNbNodes; - int* myFaceNodeIndices; - const SMDS_MeshNode** myFaceNodes; + mutable int myCurFace; + mutable int myFaceNbNodes; + mutable int* myFaceNodeIndices; + mutable const SMDS_MeshNode** myFaceNodes; }; #endif