X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Prism_3D.hxx;h=42d56fe16ccfc70961435677c61aac61ff17454c;hb=f5016d85b7b4b88623723027a1585c6414c4dc66;hp=0eb4db1d0a4985704c0a83fafa7bf35b32392f29;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_Prism_3D.hxx b/src/StdMeshers/StdMeshers_Prism_3D.hxx index 0eb4db1d0..42d56fe16 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.hxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.hxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 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 +// Copyright (C) 2003-2007 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_Prism_3D.hxx // Module : SMESH @@ -28,23 +29,24 @@ #include "SMESH_StdMeshers.hxx" -#include "SMESH_3D_Algo.hxx" -#include "SMDS_TypeOfPosition.hxx" #include "SMDS_MeshNode.hxx" +#include "SMDS_TypeOfPosition.hxx" +#include "SMESHDS_Mesh.hxx" +#include "SMESH_Algo.hxx" #include "SMESH_Block.hxx" +#include "SMESH_Comment.hxx" #include "SMESH_Mesh.hxx" -#include "SMESHDS_Mesh.hxx" -#include "SMESH_subMesh.hxx" #include "SMESH_MesherHelper.hxx" -#include "SMESH_Comment.hxx" +#include "SMESH_subMesh.hxx" #include +#include #include #include -#include #include #include +#include #include @@ -53,12 +55,11 @@ class TopoDS_Edge; class TopoDS_Faces; struct TNode; -//typedef std::map TNodeNodeMap; typedef std::vector TNodeColumn; // map of bottom nodes to the column of nodes above them // (the column includes the bottom nodes) -typedef std::map< TNode, TNodeColumn > TNode2ColumnMap; +typedef std::map< TNode, TNodeColumn > TNode2ColumnMap; typedef std::map< double, TNodeColumn > TParam2ColumnMap; typedef std::map< double, TNodeColumn >::const_iterator TParam2ColumnIt; @@ -73,18 +74,18 @@ typedef TopTools_IndexedMapOfOrientedShape TBlockShapes; struct TNode { const SMDS_MeshNode* myNode; - gp_XYZ myParams; + mutable gp_XYZ myParams; gp_XYZ GetCoords() const { return gp_XYZ( myNode->X(), myNode->Y(), myNode->Z() ); } gp_XYZ GetParams() const { return myParams; } - gp_XYZ& ChangeParams() { return myParams; } + gp_XYZ& ChangeParams() const { return myParams; } bool HasParams() const { return myParams.X() >= 0.0; } SMDS_TypeOfPosition GetPositionType() const { return myNode ? myNode->GetPosition()->GetTypeOfPosition() : SMDS_TOP_UNSPEC; } bool IsNeighbor( const TNode& other ) const; TNode(const SMDS_MeshNode* node = 0): myNode(node), myParams(-1,-1,-1) {} - bool operator < (const TNode& other) const { return myNode < other.myNode; } + bool operator < (const TNode& other) const { return myNode->GetID() < other.myNode->GetID(); } }; // =============================================================== @@ -92,7 +93,7 @@ struct TNode * \brief Tool analyzing and giving access to a prism geometry * treating it like a block, i.e. the four side faces are * emulated by division/uniting of missing/excess faces. - * It also manage associations between block subshapes and a mesh. + * It also manage associations between block sub-shapes and a mesh. */ // =============================================================== @@ -122,6 +123,11 @@ public: */ SMESH_ComputeErrorPtr GetError() const { return myError; } + /*! + * \brief Free allocated memory + */ + void Clear(); + /*! * \brief Return number of nodes on every vertical edge * \retval int - number of nodes including end nodes @@ -141,16 +147,26 @@ public: * \brief Return TParam2ColumnMap for a base edge * \param baseEdgeID - base edge SMESHDS Index * \param isReverse - columns in-block orientation - * \retval const TParam2ColumnMap& - map + * \retval const TParam2ColumnMap* - map */ - const TParam2ColumnMap& GetParam2ColumnMap(const int baseEdgeID, - bool & isReverse) + const TParam2ColumnMap* GetParam2ColumnMap(const int baseEdgeID, + bool & isReverse) const { - std::pair< TParam2ColumnMap*, bool > & col_frw = - myShapeIndex2ColumnMap[ baseEdgeID ]; + std::map< int, std::pair< TParam2ColumnMap*, bool > >::const_iterator i_mo = + myShapeIndex2ColumnMap.find( baseEdgeID ); + if ( i_mo == myShapeIndex2ColumnMap.end() ) return 0; + + const std::pair< TParam2ColumnMap*, bool >& col_frw = i_mo->second; isReverse = !col_frw.second; - return * col_frw.first; + return col_frw.first; } + + /*! + * \brief Return transformations to get coordinates of nodes of each internal layer + * by nodes of the bottom. Layer is a set of nodes at a certain step + * from bottom to top. + */ + bool GetLayersTransformation(std::vector & trsf) const; /*! * \brief Return pointer to mesh @@ -190,7 +206,7 @@ public: /*! * \brief Return in-block ID of a shape - * \param shape - block subshape + * \param shape - block sub-shape * \retval int - ID or zero if the shape has no ID */ int ShapeID(const TopoDS_Shape& shape) const @@ -216,11 +232,12 @@ public: * \param bottomEdges - edges bounding the bottom face * \param wallFaces - faces list to fill in */ - static bool GetWallFaces( SMESH_Mesh* mesh, - const TopoDS_Shape & mainShape, - const TopoDS_Shape & bottomFace, - const std::list< TopoDS_Edge >& bottomEdges, - std::list< TopoDS_Face >& wallFaces); + bool GetWallFaces( SMESH_Mesh* mesh, + const TopoDS_Shape & mainShape, + const TopoDS_Shape & bottomFace, + std::list< TopoDS_Edge >& bottomEdges, + std::list< int > & nbEInW, + std::list< TopoDS_Face >& wallFaces); private: @@ -284,6 +301,8 @@ private: int InsertSubShapes( TBlockShapes& shapeMap ) const; // redefine Adaptor methods gp_Pnt Value(const Standard_Real U,const Standard_Real V) const; + // debug + void dumpNodes(int nbNodes) const; }; // -------------------------------------------------------------------- @@ -299,6 +318,8 @@ private: gp_Pnt Value(const Standard_Real U) const; Standard_Real FirstParameter() const { return 0; } Standard_Real LastParameter() const { return 1; } + // debug + void dumpNodes(int nbNodes) const; }; // -------------------------------------------------------------------- @@ -316,6 +337,8 @@ private: gp_Pnt Value(const Standard_Real U) const; Standard_Real FirstParameter() const { return 0; } Standard_Real LastParameter() const { return 1; } + // debug + void dumpNodes(int nbNodes) const; }; // -------------------------------------------------------------------- @@ -337,20 +360,19 @@ private: Standard_Real FirstParameter() const { return 0; } Standard_Real LastParameter() const { return 1; } }; - // -------------------------------------------------------------------- - bool myNotQuadOnTop; - SMESH_MesherHelper* myHelper; - TBlockShapes myShapeIDMap; + bool myNotQuadOnTop; + SMESH_MesherHelper* myHelper; + TBlockShapes myShapeIDMap; + SMESH_ComputeErrorPtr myError; // container of 4 side faces - TSideFace* mySide; + TSideFace* mySide; // node columns for each base edge - std::vector< TParam2ColumnMap > myParam2ColumnMaps; + std::vector< TParam2ColumnMap > myParam2ColumnMaps; // to find a column for a node by edge SMESHDS Index std::map< int, std::pair< TParam2ColumnMap*, bool > > myShapeIndex2ColumnMap; - SMESH_ComputeErrorPtr myError; /*! * \brief store error and comment and then return ( error == COMPERR_OK ) */ @@ -358,7 +380,6 @@ private: myError = SMESH_ComputeError::New(error,comment); return myError->IsOK(); } - //std::vector< SMESH_subMesh* > mySubMeshesVec; // submesh by in-block id }; // ============================================= @@ -379,6 +400,9 @@ public: virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap); + /*! * \brief Enable removal of quadrangles from the bottom face and * triangles creation there by projection from the top @@ -415,7 +439,7 @@ private: bool projectBottomToTop(); /*! - * \brief Set projection coordinates of a node to a face and it's subshapes + * \brief Set projection coordinates of a node to a face and it's sub-shapes * \param faceID - the face given by in-block ID * \param params - node normalized parameters * \retval bool - is a success @@ -429,12 +453,11 @@ private: StdMeshers_PrismAsBlock myBlock; SMESH_MesherHelper* myHelper; - std::vector myShapeXYZ; // point on each sub-shape + std::vector myShapeXYZ; // point on each sub-shape of the block // map of bottom nodes to the column of nodes above them // (the column includes the bottom node) - typedef std::map< TNode, TNodeColumn > TNode2ColumnMap; - TNode2ColumnMap myBotToColumnMap; + TNode2ColumnMap myBotToColumnMap; }; #endif