Salome HOME
aac472ec0594b7ad0d128e96382b460bfb3fef27
[modules/smesh.git] / src / StdMeshers / StdMeshers_Penta_3D.hxx
1 //  SMESH StdMeshers : implementaion of SMESH idl descriptions
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : StdMeshers_Penta_3D.hxx
25 //  Module : SMESH
26
27 #ifndef StdMeshers_Penta_3D_HeaderFile
28 #define StdMeshers_Penta_3D_HeaderFile
29
30 #include <map>
31
32 typedef std::map < int, int > StdMeshers_DataMapOfIntegerInteger;
33
34 ////////////////////////////////////////////////////////////////////////
35 //
36 //  class StdMeshers_SMESHBlock
37 //
38 #include <gp_Pnt.hxx>
39 #include <gp_XYZ.hxx>
40 #include <TopoDS_Vertex.hxx>
41 #include <TopoDS_Shell.hxx>
42 #include <TopTools_IndexedMapOfOrientedShape.hxx>
43
44 #include "SMESH_Block.hxx"
45
46 class StdMeshers_SMESHBlock {
47  
48 public:
49   //
50   StdMeshers_SMESHBlock();
51   
52   void Load (const TopoDS_Shell& theShell);
53   
54   void Load (const TopoDS_Shell& theShell,
55              const TopoDS_Vertex& theV000,
56              const TopoDS_Vertex& theV001);
57   
58   void ComputeParameters(const gp_Pnt& thePnt, 
59                          gp_XYZ& theXYZ);
60   
61   void ComputeParameters(const gp_Pnt& thePnt,
62                          const TopoDS_Shape& theShape,
63                          gp_XYZ& theXYZ);
64   
65   void Point(const gp_XYZ& theParams, 
66              gp_Pnt& thePnt);
67   
68   void Point(const gp_XYZ& theParams,
69              const TopoDS_Shape& theShape, 
70              gp_Pnt& thePnt);
71   
72   int ShapeID(const TopoDS_Shape& theShape); 
73   
74   const TopoDS_Shape& Shape(const int theID);
75   
76   
77   int  ErrorStatus() const;
78
79
80 protected:
81   TopoDS_Shell                       myShell;
82   TopTools_IndexedMapOfOrientedShape myShapeIDMap;
83   SMESH_Block                        myTBlock;
84   TopoDS_Shape                       myEmptyShape;
85   //
86   int myErrorStatus;
87 };
88 ////////////////////////////////////////////////////////////////////////
89 //
90 //  class StdMeshers_TNode
91 //
92 #include "SMDS_MeshNode.hxx"
93
94 class StdMeshers_TNode {
95
96 public:
97   
98   StdMeshers_TNode(){
99     myNode=NULL;
100     myXYZ.SetCoord(99., 99., 99.);
101     myShapeSupportID=-1;
102     myBaseNodeID=-1;
103   }
104   
105   void SetNode(const SMDS_MeshNode* theNode) {
106     myNode=(SMDS_MeshNode*) theNode;
107   }
108   
109   const SMDS_MeshNode* Node()const {
110     return myNode;
111   }
112
113   void SetShapeSupportID (const int theID) {
114     myShapeSupportID=theID;
115   }
116   
117   int ShapeSupportID()const {
118     return myShapeSupportID;
119   }
120   
121   void SetNormCoord (const gp_XYZ& theXYZ) {
122     myXYZ=theXYZ;
123   }
124
125   const gp_XYZ& NormCoord ()const{
126     return myXYZ;
127   }
128   
129   void SetBaseNodeID (const int theID) {
130     myBaseNodeID=theID;
131   }
132   
133   int BaseNodeID ()const{
134     return myBaseNodeID;
135   }
136
137 private:
138   SMDS_MeshNode* myNode;
139   int  myShapeSupportID;
140   gp_XYZ         myXYZ;
141   int            myBaseNodeID;
142 };
143
144 ////////////////////////////////////////////////////////////////////////
145 //
146 //  class StdMeshers_Penta_3D
147 //
148 #include "SMESH_Mesh.hxx"
149 #include <TopoDS_Shape.hxx>
150 //
151 class StdMeshers_Penta_3D {
152 //
153   public: // methods
154     StdMeshers_Penta_3D();
155     
156     //~StdMeshers_Penta_3D();
157     
158     bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
159     
160     int ErrorStatus() const {
161       return myErrorStatus;
162     }
163    
164     void SetTolerance(const double theTol3D) {
165       myTol3D=theTol3D;
166     }
167     
168     double Tolerance() const {
169       return myTol3D;
170     }
171     
172
173   protected: // methods
174     
175     void CheckData();
176     
177     void MakeBlock();
178
179     void MakeNodes();
180
181     void ShapeSupportID(const bool theIsUpperLayer,
182                         const SMESH_Block::TShapeID theBNSSID,
183                         SMESH_Block::TShapeID& theSSID);
184
185     void FindNodeOnShape(const TopoDS_Shape& aS,
186                          const gp_XYZ& aParams,
187                          StdMeshers_TNode& aTN);
188
189     void CreateNode(const bool theIsUpperLayer,
190                     const gp_XYZ& aParams,
191                     StdMeshers_TNode& aTN);
192
193     void ClearMeshOnFxy1();
194
195     void MakeMeshOnFxy1();
196
197     void MakeConnectingMap();
198
199     int GetIndexOnLayer(const int aID);
200
201     void MakeVolumeMesh();
202   
203     void SetMesh(SMESH_Mesh& theMesh) {
204       myMesh=(void *)&theMesh;
205     }
206     
207     SMESH_Mesh* GetMesh()const {
208       return (SMESH_Mesh*)myMesh;
209     }
210     
211   protected: // fields
212     TopoDS_Shape myShape;
213     StdMeshers_SMESHBlock myBlock;
214     void *       myMesh;
215     int          myErrorStatus;
216     //
217     vector <StdMeshers_TNode> myTNodes;
218     int myISize;
219     int myJSize;
220     double   myTol3D;        // Tolerance value     
221     StdMeshers_DataMapOfIntegerInteger myConnectingMap;
222
223 };
224
225 #endif