SALOME - SMESH
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
StdMeshers_Penta_3D.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // SMESH StdMeshers : implementaion of SMESH idl descriptions
23 // File : StdMeshers_Penta_3D.hxx
24 // Module : SMESH
25 //
26 #ifndef StdMeshers_Penta_3D_HeaderFile
27 #define StdMeshers_Penta_3D_HeaderFile
28 
29 #include "SMESH_StdMeshers.hxx"
30 
31 #include <map>
32 
34 //
35 // class StdMeshers_SMESHBlock
36 //
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 #include <TColStd_MapOfInteger.hxx>
44 
45 #include "SMESH_Block.hxx"
46 #include "SMESH_ComputeError.hxx"
47 #include "SMESH_MesherHelper.hxx"
48 
49 typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
50 
52 
53 public:
54  //
56 
57  void Load (const TopoDS_Shell& theShell);
58 
59  void Load (const TopoDS_Shell& theShell,
60  const TopoDS_Vertex& theV000,
61  const TopoDS_Vertex& theV001);
62 
63  void ComputeParameters(const gp_Pnt& thePnt,
64  gp_XYZ& theXYZ);
65 
66  void ComputeParameters(const gp_Pnt& thePnt,
67  const TopoDS_Shape& theShape,
68  gp_XYZ& theXYZ);
69 
70  void ComputeParameters(const double& theU,
71  const TopoDS_Shape& theShape,
72  gp_XYZ& theXYZ);
73 
74  void Point(const gp_XYZ& theParams,
75  gp_Pnt& thePnt);
76 
77  void Point(const gp_XYZ& theParams,
78  const TopoDS_Shape& theShape,
79  gp_Pnt& thePnt);
80 
81  int ShapeID(const TopoDS_Shape& theShape);
82 
83  const TopoDS_Shape& Shape(const int theID);
84 
85  SMESH_Block & Block() { return myTBlock; }
86 
87  bool IsForwadEdge(const int theEdgeID);
88 
89  int ErrorStatus() const;
90 
91  SMESH_ComputeErrorPtr GetError() const;
92 
93 
94 protected:
95  TopoDS_Shell myShell;
96  TopTools_IndexedMapOfOrientedShape myShapeIDMap;
99  std::vector<int> myIsEdgeForward;
100  //
102 };
103 
105 //
106 // class StdMeshers_TNode
107 //
109 #include "SMDS_MeshNode.hxx"
110 
112 
113 public:
114 
116  myNode=NULL;
117  myXYZ.SetCoord(99., 99., 99.);
118  myShapeSupportID=-1;
119  myBaseNodeID=-1;
120  }
121 
122  void SetNode(const SMDS_MeshNode* theNode) {
123  myNode=(SMDS_MeshNode*) theNode;
124  }
125 
126  const SMDS_MeshNode* Node()const {
127  return myNode;
128  }
129 
130  void SetShapeSupportID (const int theID) {
131  myShapeSupportID=theID;
132  }
133 
134  int ShapeSupportID()const {
135  return myShapeSupportID;
136  }
137 
138  void SetNormCoord (const gp_XYZ& theXYZ) {
139  myXYZ=theXYZ;
140  }
141 
142  const gp_XYZ& NormCoord ()const{
143  return myXYZ;
144  }
145 
146  void SetBaseNodeID (const int theID) {
147  myBaseNodeID=theID;
148  }
149 
150  int BaseNodeID ()const{
151  return myBaseNodeID;
152  }
153 
154 private:
159 };
160 
162 //
163 // class StdMeshers_Penta_3D
164 //
166 #include "SMESH_Mesh.hxx"
167 #include <TopoDS_Shape.hxx>
168 //
170 //
171  public: // methods
173 
175 
176  bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
177 
178  int ErrorStatus() const {
179  if (myErrorStatus->IsOK())
180  return 0;
181  return myErrorStatus->myName;
182  }
183 
185  return myErrorStatus;
186  }
187 
188  void SetTolerance(const double theTol3D) {
189  myTol3D=theTol3D;
190  }
191 
192  double Tolerance() const {
193  return myTol3D;
194  }
195 
196  bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
197  const TopoDS_Face& theFace,
198  const TopoDS_Edge& theBaseEdge,
199  SMESHDS_Mesh* theMesh);
200  // Load nodes bound to theFace into column (vectors) and rows
201  // of theIJNodes.
202  // The value of theIJNodes map is a vector of ordered nodes so
203  // that the 0-the one lies on theBaseEdge.
204  // The key of theIJNodes map is a normalized parameter of each
205  // 0-the node on theBaseEdge.
206 
207 
208  protected: // methods
209 
210  void CheckData();
211 
212  void MakeBlock();
213 
214  void MakeNodes();
215 
216  double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ,
217  const int aFaceID,
218  std::vector<const SMDS_MeshNode*>*& aCol1,
219  std::vector<const SMDS_MeshNode*>*& aCol2);
220 
221  void ShapeSupportID(const bool theIsUpperLayer,
222  const SMESH_Block::TShapeID theBNSSID,
223  SMESH_Block::TShapeID& theSSID);
224 
225  void FindNodeOnShape(const TopoDS_Shape& aS,
226  const gp_XYZ& aParams,
227  const int z,
228  StdMeshers_TNode& aTN);
229 
230  void CreateNode(const bool theIsUpperLayer,
231  const gp_XYZ& aParams,
232  StdMeshers_TNode& aTN);
233 
234  void ClearMeshOnFxy1();
235 
236  void MakeMeshOnFxy1();
237 
238  void MakeConnectingMap();
239 
240  int GetIndexOnLayer(const int aID);
241 
242  void MakeVolumeMesh();
243 
244  void SetMesh(SMESH_Mesh& theMesh) {
245  myMesh=(void *)&theMesh;
246  }
247 
248  SMESH_Mesh* GetMesh()const {
249  return (SMESH_Mesh*)myMesh;
250  }
251 
252  protected: // fields
255  void * myMesh;
257  //
258  std::vector <StdMeshers_TNode> myTNodes;
259  int myISize;
260  int myJSize;
261  double myTol3D; // Tolerance value
262  std::map < int, int > myConnectingMap;
263  //
264  std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
265  std::vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
266 
268  SMESH_MesherHelper* myTool; // tool building quadratic elements
269 };
270 
271 #endif
std::map< double, std::vector< const SMDS_MeshNode * > > StdMeshers_IJNodeMap
void SetShapeSupportID(const int theID)
std::map< int, int > myConnectingMap
void SetBaseNodeID(const int theID)
const SMDS_MeshNode * Node() const
std::vector< int > myIsEdgeForward
boost::shared_ptr< SMESH_ComputeError > SMESH_ComputeErrorPtr
SMDS_MeshNode * myNode
std::vector< StdMeshers_TNode > myTNodes
void SetMesh(SMESH_Mesh &theMesh)
void SetNormCoord(const gp_XYZ &theXYZ)
SMESH_ComputeErrorPtr myErrorStatus
std::vector< StdMeshers_IJNodeMap > myWallNodesMaps
StdMeshers_SMESHBlock myBlock
#define STDMESHERS_EXPORT
SMESH_MesherHelper * myTool
void SetNode(const SMDS_MeshNode *theNode)
const gp_XYZ & NormCoord() const
std::vector< gp_XYZ > myShapeXYZ
void SetTolerance(const double theTol3D)
SMESH_ComputeErrorPtr GetComputeError() const
TopTools_IndexedMapOfOrientedShape myShapeIDMap
SMESH_Mesh * GetMesh() const