Back to index

salome-smesh  6.5.0
StdMeshers_Penta_3D.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH StdMeshers : implementaion of SMESH idl descriptions
00024 //  File   : StdMeshers_Penta_3D.hxx
00025 //  Module : SMESH
00026 //
00027 #ifndef StdMeshers_Penta_3D_HeaderFile
00028 #define StdMeshers_Penta_3D_HeaderFile
00029 
00030 #include "SMESH_StdMeshers.hxx"
00031 
00032 #include <map>
00033 
00035 //
00036 //  class StdMeshers_SMESHBlock
00037 //
00039 #include <gp_Pnt.hxx>
00040 #include <gp_XYZ.hxx>
00041 #include <TopoDS_Vertex.hxx>
00042 #include <TopoDS_Shell.hxx>
00043 #include <TopTools_IndexedMapOfOrientedShape.hxx>
00044 #include <TColStd_MapOfInteger.hxx>
00045 
00046 #include "SMESH_Block.hxx"
00047 #include "SMESH_ComputeError.hxx"
00048 #include "SMESH_MesherHelper.hxx"
00049 #include "SMESH_3D_Algo.hxx"
00050 
00051 typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
00052 
00053 class STDMESHERS_EXPORT StdMeshers_SMESHBlock {
00054  
00055 public:
00056   //
00057   StdMeshers_SMESHBlock();
00058   
00059   void Load (const TopoDS_Shell& theShell);
00060   
00061   void Load (const TopoDS_Shell& theShell,
00062              const TopoDS_Vertex& theV000,
00063              const TopoDS_Vertex& theV001);
00064   
00065   void ComputeParameters(const gp_Pnt& thePnt, 
00066                          gp_XYZ& theXYZ);
00067   
00068   void ComputeParameters(const gp_Pnt& thePnt,
00069                          const TopoDS_Shape& theShape,
00070                          gp_XYZ& theXYZ);
00071   
00072   void ComputeParameters(const double& theU,
00073                          const TopoDS_Shape& theShape,
00074                          gp_XYZ& theXYZ);
00075   
00076   void Point(const gp_XYZ& theParams, 
00077              gp_Pnt& thePnt);
00078   
00079   void Point(const gp_XYZ& theParams,
00080              const TopoDS_Shape& theShape, 
00081              gp_Pnt& thePnt);
00082   
00083   int ShapeID(const TopoDS_Shape& theShape); 
00084   
00085   const TopoDS_Shape& Shape(const int theID);
00086 
00087   SMESH_Block & Block() { return myTBlock; }
00088 
00089   bool IsForwadEdge(const int theEdgeID);
00090 
00091   int  ErrorStatus() const;
00092 
00093   SMESH_ComputeErrorPtr GetError() const;
00094 
00095 
00096 protected:
00097   TopoDS_Shell                       myShell;
00098   TopTools_IndexedMapOfOrientedShape myShapeIDMap;
00099   SMESH_Block                        myTBlock;
00100   TopoDS_Shape                       myEmptyShape;
00101   std::vector<int>                   myIsEdgeForward;
00102   //
00103   int myErrorStatus;
00104 };
00105 
00107 //
00108 //  class StdMeshers_TNode
00109 //
00111 #include "SMDS_MeshNode.hxx"
00112 
00113 class STDMESHERS_EXPORT StdMeshers_TNode {
00114 
00115 public:
00116   
00117   StdMeshers_TNode(){
00118     myNode=NULL;
00119     myXYZ.SetCoord(99., 99., 99.);
00120     myShapeSupportID=-1;
00121     myBaseNodeID=-1;
00122   }
00123   
00124   void SetNode(const SMDS_MeshNode* theNode) {
00125     myNode=(SMDS_MeshNode*) theNode;
00126   }
00127   
00128   const SMDS_MeshNode* Node()const {
00129     return myNode;
00130   }
00131 
00132   void SetShapeSupportID (const int theID) {
00133     myShapeSupportID=theID;
00134   }
00135   
00136   int ShapeSupportID()const {
00137     return myShapeSupportID;
00138   }
00139   
00140   void SetNormCoord (const gp_XYZ& theXYZ) {
00141     myXYZ=theXYZ;
00142   }
00143 
00144   const gp_XYZ& NormCoord ()const{
00145     return myXYZ;
00146   }
00147   
00148   void SetBaseNodeID (const int theID) {
00149     myBaseNodeID=theID;
00150   }
00151   
00152   int BaseNodeID ()const{
00153     return myBaseNodeID;
00154   }
00155 
00156 private:
00157   SMDS_MeshNode* myNode;
00158   int  myShapeSupportID;
00159   gp_XYZ         myXYZ;
00160   int            myBaseNodeID;
00161 };
00162 
00164 //
00165 //  class StdMeshers_Penta_3D
00166 //
00168 #include "SMESH_Mesh.hxx"
00169 #include <TopoDS_Shape.hxx>
00170 //
00171 class STDMESHERS_EXPORT StdMeshers_Penta_3D {
00172 //
00173   public: // methods
00174     StdMeshers_Penta_3D();
00175     
00176     ~StdMeshers_Penta_3D();
00177     
00178     bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
00179     
00180     int ErrorStatus() const {
00181       if (myErrorStatus->IsOK())
00182         return 0;
00183       return myErrorStatus->myName;
00184     }
00185 
00186     SMESH_ComputeErrorPtr GetComputeError() const {
00187       return myErrorStatus;
00188     }
00189    
00190     void SetTolerance(const double theTol3D) {
00191       myTol3D=theTol3D;
00192     }
00193     
00194     double Tolerance() const {
00195       return myTol3D;
00196     }
00197 
00198     bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
00199                      const TopoDS_Face&     theFace,
00200                      const TopoDS_Edge&     theBaseEdge,
00201                      SMESHDS_Mesh*          theMesh);
00202     // Load nodes bound to theFace into column (vectors) and rows
00203     // of theIJNodes.
00204     // The value of theIJNodes map is a vector of ordered nodes so
00205     // that the 0-the one lies on theBaseEdge.
00206     // The key of theIJNodes map is a normalized parameter of each
00207     // 0-the node on theBaseEdge.
00208 
00209     bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
00210                   MapShapeNbElems& aResMap);
00211 
00212 
00213   protected: // methods
00214     
00215     void CheckData();
00216     
00217     void MakeBlock();
00218 
00219     void MakeNodes();
00220 
00221     double SetHorizEdgeXYZ(const gp_XYZ&                  aBNXYZ,
00222                            const int                      aFaceID,
00223                            std::vector<const SMDS_MeshNode*>*& aCol1,
00224                            std::vector<const SMDS_MeshNode*>*& aCol2);
00225 
00226     void ShapeSupportID(const bool theIsUpperLayer,
00227                         const SMESH_Block::TShapeID theBNSSID,
00228                         SMESH_Block::TShapeID& theSSID);
00229 
00230     void FindNodeOnShape(const TopoDS_Shape& aS,
00231                          const gp_XYZ& aParams,
00232                          const int z,
00233                          StdMeshers_TNode& aTN);
00234 
00235     void CreateNode(const bool theIsUpperLayer,
00236                     const gp_XYZ& aParams,
00237                     StdMeshers_TNode& aTN);
00238 
00239     void ClearMeshOnFxy1();
00240 
00241     void MakeMeshOnFxy1();
00242 
00243     void MakeConnectingMap();
00244 
00245     int GetIndexOnLayer(const int aID);
00246 
00247     void MakeVolumeMesh();
00248   
00249     void SetMesh(SMESH_Mesh& theMesh) {
00250       myMesh=(void *)&theMesh;
00251     }
00252     
00253     SMESH_Mesh* GetMesh()const {
00254       return (SMESH_Mesh*)myMesh;
00255     }
00256     
00257   protected: // fields
00258     TopoDS_Shape              myShape;
00259     StdMeshers_SMESHBlock     myBlock;
00260     void *                    myMesh;
00261     SMESH_ComputeErrorPtr     myErrorStatus;
00262     //
00263     std::vector <StdMeshers_TNode> myTNodes;
00264     int                       myISize;
00265     int                       myJSize;
00266     double                    myTol3D;        // Tolerance value     
00267     std::map < int, int >     myConnectingMap;
00268     //
00269     std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
00270     std::vector<gp_XYZ>               myShapeXYZ; // point on each sub-shape
00271 
00272     bool myCreateQuadratic;
00273     SMESH_MesherHelper* myTool; // tool building quadratic elements
00274 };
00275 
00276 #endif