SALOME - SMESH
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 #include "SMESH_3D_Algo.hxx"
49 
50 typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
51 
53 
54 public:
55  //
57 
58  void Load (const TopoDS_Shell& theShell);
59 
60  void Load (const TopoDS_Shell& theShell,
61  const TopoDS_Vertex& theV000,
62  const TopoDS_Vertex& theV001);
63 
64  void ComputeParameters(const gp_Pnt& thePnt,
65  gp_XYZ& theXYZ);
66 
67  void ComputeParameters(const gp_Pnt& thePnt,
68  const TopoDS_Shape& theShape,
69  gp_XYZ& theXYZ);
70 
71  void ComputeParameters(const double& theU,
72  const TopoDS_Shape& theShape,
73  gp_XYZ& theXYZ);
74 
75  void Point(const gp_XYZ& theParams,
76  gp_Pnt& thePnt);
77 
78  void Point(const gp_XYZ& theParams,
79  const TopoDS_Shape& theShape,
80  gp_Pnt& thePnt);
81 
82  int ShapeID(const TopoDS_Shape& theShape);
83 
84  const TopoDS_Shape& Shape(const int theID);
85 
86  SMESH_Block & Block() { return myTBlock; }
87 
88  bool IsForwadEdge(const int theEdgeID);
89 
90  int ErrorStatus() const;
91 
93 
94 
95 protected:
96  TopoDS_Shell myShell;
97  TopTools_IndexedMapOfOrientedShape myShapeIDMap;
99  TopoDS_Shape myEmptyShape;
100  std::vector<int> myIsEdgeForward;
101  //
103 };
104 
106 //
107 // class StdMeshers_TNode
108 //
110 #include "SMDS_MeshNode.hxx"
111 
113 
114 public:
115 
117  myNode=NULL;
118  myXYZ.SetCoord(99., 99., 99.);
119  myShapeSupportID=-1;
120  myBaseNodeID=-1;
121  }
122 
123  void SetNode(const SMDS_MeshNode* theNode) {
124  myNode=(SMDS_MeshNode*) theNode;
125  }
126 
127  const SMDS_MeshNode* Node()const {
128  return myNode;
129  }
130 
131  void SetShapeSupportID (const int theID) {
132  myShapeSupportID=theID;
133  }
134 
135  int ShapeSupportID()const {
136  return myShapeSupportID;
137  }
138 
139  void SetNormCoord (const gp_XYZ& theXYZ) {
140  myXYZ=theXYZ;
141  }
142 
143  const gp_XYZ& NormCoord ()const{
144  return myXYZ;
145  }
146 
147  void SetBaseNodeID (const int theID) {
148  myBaseNodeID=theID;
149  }
150 
151  int BaseNodeID ()const{
152  return myBaseNodeID;
153  }
154 
155 private:
158  gp_XYZ myXYZ;
160 };
161 
163 //
164 // class StdMeshers_Penta_3D
165 //
167 #include "SMESH_Mesh.hxx"
168 #include <TopoDS_Shape.hxx>
169 //
171 //
172  public: // methods
174 
176 
177  bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
178 
179  int ErrorStatus() const {
180  if (myErrorStatus->IsOK())
181  return 0;
182  return myErrorStatus->myName;
183  }
184 
186  return myErrorStatus;
187  }
188 
189  void SetTolerance(const double theTol3D) {
190  myTol3D=theTol3D;
191  }
192 
193  double Tolerance() const {
194  return myTol3D;
195  }
196 
198  const TopoDS_Face& theFace,
199  const TopoDS_Edge& theBaseEdge,
200  SMESHDS_Mesh* theMesh);
201  // Load nodes bound to theFace into column (vectors) and rows
202  // of theIJNodes.
203  // The value of theIJNodes map is a vector of ordered nodes so
204  // that the 0-the one lies on theBaseEdge.
205  // The key of theIJNodes map is a normalized parameter of each
206  // 0-the node on theBaseEdge.
207 
208  bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
209  MapShapeNbElems& aResMap);
210 
211 
212  protected: // methods
213 
214  void CheckData();
215 
216  void MakeBlock();
217 
218  void MakeNodes();
219 
220  double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ,
221  const int aFaceID,
222  std::vector<const SMDS_MeshNode*>*& aCol1,
223  std::vector<const SMDS_MeshNode*>*& aCol2);
224 
225  void ShapeSupportID(const bool theIsUpperLayer,
226  const SMESH_Block::TShapeID theBNSSID,
227  SMESH_Block::TShapeID& theSSID);
228 
229  void FindNodeOnShape(const TopoDS_Shape& aS,
230  const gp_XYZ& aParams,
231  const int z,
232  StdMeshers_TNode& aTN);
233 
234  void CreateNode(const bool theIsUpperLayer,
235  const gp_XYZ& aParams,
236  StdMeshers_TNode& aTN);
237 
239 
241 
243 
244  int GetIndexOnLayer(const int aID);
245 
247 
248  void SetMesh(SMESH_Mesh& theMesh) {
249  myMesh=(void *)&theMesh;
250  }
251 
252  SMESH_Mesh* GetMesh()const {
253  return (SMESH_Mesh*)myMesh;
254  }
255 
256  protected: // fields
257  TopoDS_Shape myShape;
259  void * myMesh;
261  //
262  std::vector <StdMeshers_TNode> myTNodes;
263  int myISize;
264  int myJSize;
265  double myTol3D; // Tolerance value
266  std::map < int, int > myConnectingMap;
267  //
268  std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
269  std::vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
270 
272  SMESH_MesherHelper* myTool; // tool building quadratic elements
273 };
274 
275 #endif
StdMeshers_Penta_3D::~StdMeshers_Penta_3D
~StdMeshers_Penta_3D()
SMESH_ComputeError.hxx
StdMeshers_TNode::BaseNodeID
int BaseNodeID() const
Definition: StdMeshers_Penta_3D.hxx:151
SMESH_MesherHelper
Definition: SMESH_MesherHelper.hxx:58
SMESH_StdMeshers.hxx
StdMeshers_SMESHBlock
Definition: StdMeshers_Penta_3D.hxx:52
StdMeshers_Penta_3D::myJSize
int myJSize
Definition: StdMeshers_Penta_3D.hxx:264
StdMeshers_TNode::myXYZ
gp_XYZ myXYZ
Definition: StdMeshers_Penta_3D.hxx:158
StdMeshers_Penta_3D::MakeNodes
void MakeNodes()
StdMeshers_SMESHBlock::myErrorStatus
int myErrorStatus
Definition: StdMeshers_Penta_3D.hxx:102
StdMeshers_Penta_3D::myMesh
void * myMesh
Definition: StdMeshers_Penta_3D.hxx:259
StdMeshers_SMESHBlock::Point
void Point(const gp_XYZ &theParams, const TopoDS_Shape &theShape, gp_Pnt &thePnt)
StdMeshers_TNode
Definition: StdMeshers_Penta_3D.hxx:112
StdMeshers_SMESHBlock::myEmptyShape
TopoDS_Shape myEmptyShape
Definition: StdMeshers_Penta_3D.hxx:99
StdMeshers_Penta_3D::LoadIJNodes
bool LoadIJNodes(StdMeshers_IJNodeMap &theIJNodes, const TopoDS_Face &theFace, const TopoDS_Edge &theBaseEdge, SMESHDS_Mesh *theMesh)
StdMeshers_Penta_3D::myErrorStatus
SMESH_ComputeErrorPtr myErrorStatus
Definition: StdMeshers_Penta_3D.hxx:260
StdMeshers_SMESHBlock::GetError
SMESH_ComputeErrorPtr GetError() const
StdMeshers_TNode::SetShapeSupportID
void SetShapeSupportID(const int theID)
Definition: StdMeshers_Penta_3D.hxx:131
StdMeshers_Penta_3D::FindNodeOnShape
void FindNodeOnShape(const TopoDS_Shape &aS, const gp_XYZ &aParams, const int z, StdMeshers_TNode &aTN)
StdMeshers_TNode::myNode
SMDS_MeshNode * myNode
Definition: StdMeshers_Penta_3D.hxx:156
StdMeshers_Penta_3D::GetIndexOnLayer
int GetIndexOnLayer(const int aID)
StdMeshers_Penta_3D::MakeVolumeMesh
void MakeVolumeMesh()
SMDS_MeshNode.hxx
StdMeshers_Penta_3D::ErrorStatus
int ErrorStatus() const
Definition: StdMeshers_Penta_3D.hxx:179
SMESHDS_Mesh
Definition: SMESHDS_Mesh.hxx:59
StdMeshers_IJNodeMap
std::map< double, std::vector< const SMDS_MeshNode * > > StdMeshers_IJNodeMap
Definition: StdMeshers_Penta_3D.hxx:50
StdMeshers_Penta_3D::SetMesh
void SetMesh(SMESH_Mesh &theMesh)
Definition: StdMeshers_Penta_3D.hxx:248
StdMeshers_Penta_3D::StdMeshers_Penta_3D
StdMeshers_Penta_3D()
StdMeshers_Penta_3D::myTool
SMESH_MesherHelper * myTool
Definition: StdMeshers_Penta_3D.hxx:272
StdMeshers_Penta_3D::myShapeXYZ
std::vector< gp_XYZ > myShapeXYZ
Definition: StdMeshers_Penta_3D.hxx:269
StdMeshers_Penta_3D::CheckData
void CheckData()
StdMeshers_Penta_3D::Compute
bool Compute(SMESH_Mesh &, const TopoDS_Shape &)
StdMeshers_Penta_3D::SetHorizEdgeXYZ
double SetHorizEdgeXYZ(const gp_XYZ &aBNXYZ, const int aFaceID, std::vector< const SMDS_MeshNode * > *&aCol1, std::vector< const SMDS_MeshNode * > *&aCol2)
StdMeshers_SMESHBlock::myShell
TopoDS_Shell myShell
Definition: StdMeshers_Penta_3D.hxx:96
StdMeshers_TNode::NormCoord
const gp_XYZ & NormCoord() const
Definition: StdMeshers_Penta_3D.hxx:143
StdMeshers_SMESHBlock::ComputeParameters
void ComputeParameters(const double &theU, const TopoDS_Shape &theShape, gp_XYZ &theXYZ)
StdMeshers_SMESHBlock::StdMeshers_SMESHBlock
StdMeshers_SMESHBlock()
StdMeshers_TNode::SetNormCoord
void SetNormCoord(const gp_XYZ &theXYZ)
Definition: StdMeshers_Penta_3D.hxx:139
StdMeshers_Penta_3D::Tolerance
double Tolerance() const
Definition: StdMeshers_Penta_3D.hxx:193
SMESH_ComputeErrorPtr
boost::shared_ptr< SMESH_ComputeError > SMESH_ComputeErrorPtr
Definition: SMESH_ComputeError.hxx:37
StdMeshers_SMESHBlock::myShapeIDMap
TopTools_IndexedMapOfOrientedShape myShapeIDMap
Definition: StdMeshers_Penta_3D.hxx:97
SMESH_MesherHelper.hxx
StdMeshers_Penta_3D::ShapeSupportID
void ShapeSupportID(const bool theIsUpperLayer, const SMESH_Block::TShapeID theBNSSID, SMESH_Block::TShapeID &theSSID)
StdMeshers_Penta_3D::myBlock
StdMeshers_SMESHBlock myBlock
Definition: StdMeshers_Penta_3D.hxx:258
StdMeshers_Penta_3D::myTNodes
std::vector< StdMeshers_TNode > myTNodes
Definition: StdMeshers_Penta_3D.hxx:262
StdMeshers_Penta_3D::myCreateQuadratic
bool myCreateQuadratic
Definition: StdMeshers_Penta_3D.hxx:271
StdMeshers_SMESHBlock::Load
void Load(const TopoDS_Shell &theShell)
StdMeshers_Penta_3D::SetTolerance
void SetTolerance(const double theTol3D)
Definition: StdMeshers_Penta_3D.hxx:189
MapShapeNbElems
std::map< SMESH_subMesh *, std::vector< int > > MapShapeNbElems
Definition: SMESH_Algo.hxx:55
SMESH_3D_Algo.hxx
StdMeshers_SMESHBlock::Point
void Point(const gp_XYZ &theParams, gp_Pnt &thePnt)
StdMeshers_SMESHBlock::ErrorStatus
int ErrorStatus() const
StdMeshers_SMESHBlock::ComputeParameters
void ComputeParameters(const gp_Pnt &thePnt, const TopoDS_Shape &theShape, gp_XYZ &theXYZ)
StdMeshers_Penta_3D::Evaluate
bool Evaluate(SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap)
StdMeshers_SMESHBlock::Load
void Load(const TopoDS_Shell &theShell, const TopoDS_Vertex &theV000, const TopoDS_Vertex &theV001)
StdMeshers_SMESHBlock::ShapeID
int ShapeID(const TopoDS_Shape &theShape)
StdMeshers_TNode::StdMeshers_TNode
StdMeshers_TNode()
Definition: StdMeshers_Penta_3D.hxx:116
SMESH_Block::TShapeID
TShapeID
Definition: SMESH_Block.hxx:64
SMESH_Mesh
Definition: SMESH_Mesh.hxx:55
StdMeshers_Penta_3D::CreateNode
void CreateNode(const bool theIsUpperLayer, const gp_XYZ &aParams, StdMeshers_TNode &aTN)
StdMeshers_Penta_3D::MakeBlock
void MakeBlock()
StdMeshers_Penta_3D::myWallNodesMaps
std::vector< StdMeshers_IJNodeMap > myWallNodesMaps
Definition: StdMeshers_Penta_3D.hxx:268
StdMeshers_Penta_3D::GetComputeError
SMESH_ComputeErrorPtr GetComputeError() const
Definition: StdMeshers_Penta_3D.hxx:185
STDMESHERS_EXPORT
#define STDMESHERS_EXPORT
Definition: SMESH_StdMeshers.hxx:37
StdMeshers_Penta_3D::GetMesh
SMESH_Mesh * GetMesh() const
Definition: StdMeshers_Penta_3D.hxx:252
StdMeshers_TNode::Node
const SMDS_MeshNode * Node() const
Definition: StdMeshers_Penta_3D.hxx:127
StdMeshers_SMESHBlock::myIsEdgeForward
std::vector< int > myIsEdgeForward
Definition: StdMeshers_Penta_3D.hxx:100
StdMeshers_SMESHBlock::Block
SMESH_Block & Block()
Definition: StdMeshers_Penta_3D.hxx:86
StdMeshers_Penta_3D
Definition: StdMeshers_Penta_3D.hxx:170
StdMeshers_TNode::myShapeSupportID
int myShapeSupportID
Definition: StdMeshers_Penta_3D.hxx:157
StdMeshers_Penta_3D::myConnectingMap
std::map< int, int > myConnectingMap
Definition: StdMeshers_Penta_3D.hxx:266
SMDS_MeshNode
Definition: SMDS_MeshNode.hxx:36
StdMeshers_Penta_3D::myTol3D
double myTol3D
Definition: StdMeshers_Penta_3D.hxx:265
StdMeshers_TNode::SetNode
void SetNode(const SMDS_MeshNode *theNode)
Definition: StdMeshers_Penta_3D.hxx:123
SMESH_Mesh.hxx
StdMeshers_SMESHBlock::Shape
const TopoDS_Shape & Shape(const int theID)
StdMeshers_Penta_3D::myISize
int myISize
Definition: StdMeshers_Penta_3D.hxx:263
StdMeshers_SMESHBlock::myTBlock
SMESH_Block myTBlock
Definition: StdMeshers_Penta_3D.hxx:98
StdMeshers_SMESHBlock::IsForwadEdge
bool IsForwadEdge(const int theEdgeID)
SMESH_Block
Definition: SMESH_Block.hxx:62
StdMeshers_TNode::ShapeSupportID
int ShapeSupportID() const
Definition: StdMeshers_Penta_3D.hxx:135
StdMeshers_TNode::myBaseNodeID
int myBaseNodeID
Definition: StdMeshers_Penta_3D.hxx:159
StdMeshers_Penta_3D::MakeMeshOnFxy1
void MakeMeshOnFxy1()
SMESH_Block.hxx
StdMeshers_TNode::SetBaseNodeID
void SetBaseNodeID(const int theID)
Definition: StdMeshers_Penta_3D.hxx:147
StdMeshers_Penta_3D::ClearMeshOnFxy1
void ClearMeshOnFxy1()
StdMeshers_SMESHBlock::ComputeParameters
void ComputeParameters(const gp_Pnt &thePnt, gp_XYZ &theXYZ)
StdMeshers_Penta_3D::myShape
TopoDS_Shape myShape
Definition: StdMeshers_Penta_3D.hxx:257
StdMeshers_Penta_3D::MakeConnectingMap
void MakeConnectingMap()