1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH StdMeshers : implementaion of SMESH idl descriptions
24 // File : StdMeshers_Penta_3D.hxx
27 #ifndef StdMeshers_Penta_3D_HeaderFile
28 #define StdMeshers_Penta_3D_HeaderFile
30 #include "SMESH_StdMeshers.hxx"
34 ////////////////////////////////////////////////////////////////////////
36 // class StdMeshers_SMESHBlock
38 ////////////////////////////////////////////////////////////////////////
39 #include <TColStd_MapOfInteger.hxx>
40 #include <TopTools_IndexedMapOfOrientedShape.hxx>
41 #include <TopoDS_Shell.hxx>
42 #include <TopoDS_Vertex.hxx>
46 #include "SMESH_Algo.hxx"
47 #include "SMESH_Block.hxx"
48 #include "SMESH_ComputeError.hxx"
49 #include "SMESH_MesherHelper.hxx"
51 typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
53 class STDMESHERS_EXPORT StdMeshers_SMESHBlock {
57 StdMeshers_SMESHBlock();
59 void Load (const TopoDS_Shell& theShell);
61 void Load (const TopoDS_Shell& theShell,
62 const TopoDS_Vertex& theV000,
63 const TopoDS_Vertex& theV001);
65 void ComputeParameters(const gp_Pnt& thePnt,
68 void ComputeParameters(const gp_Pnt& thePnt,
69 const TopoDS_Shape& theShape,
72 void ComputeParameters(const double& theU,
73 const TopoDS_Shape& theShape,
76 void Point(const gp_XYZ& theParams,
79 void Point(const gp_XYZ& theParams,
80 const TopoDS_Shape& theShape,
83 int ShapeID(const TopoDS_Shape& theShape);
85 const TopoDS_Shape& Shape(const int theID);
87 SMESH_Block & Block() { return myTBlock; }
89 bool IsForwadEdge(const int theEdgeID);
91 int ErrorStatus() const;
93 SMESH_ComputeErrorPtr GetError() const;
98 TopTools_IndexedMapOfOrientedShape myShapeIDMap;
100 TopoDS_Shape myEmptyShape;
101 std::vector<int> myIsEdgeForward;
106 ////////////////////////////////////////////////////////////////////////
108 // class StdMeshers_TNode
110 ////////////////////////////////////////////////////////////////////////
111 #include "SMDS_MeshNode.hxx"
113 class STDMESHERS_EXPORT StdMeshers_TNode {
119 myXYZ.SetCoord(99., 99., 99.);
124 void SetNode(const SMDS_MeshNode* theNode) {
125 myNode=(SMDS_MeshNode*) theNode;
128 const SMDS_MeshNode* Node()const {
132 void SetShapeSupportID (const int theID) {
133 myShapeSupportID=theID;
136 int ShapeSupportID()const {
137 return myShapeSupportID;
140 void SetNormCoord (const gp_XYZ& theXYZ) {
144 const gp_XYZ& NormCoord ()const{
148 void SetBaseNodeID (const int theID) {
152 int BaseNodeID ()const{
157 SMDS_MeshNode* myNode;
158 int myShapeSupportID;
163 ////////////////////////////////////////////////////////////////////////
165 // class StdMeshers_Penta_3D
167 ////////////////////////////////////////////////////////////////////////
168 #include "SMESH_Mesh.hxx"
169 #include <TopoDS_Shape.hxx>
171 class STDMESHERS_EXPORT StdMeshers_Penta_3D {
174 StdMeshers_Penta_3D();
176 ~StdMeshers_Penta_3D();
178 bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
180 int ErrorStatus() const {
181 if (myErrorStatus->IsOK())
183 return myErrorStatus->myName;
186 SMESH_ComputeErrorPtr GetComputeError() const {
187 return myErrorStatus;
190 void SetTolerance(const double theTol3D) {
194 double Tolerance() const {
198 bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
199 const TopoDS_Face& theFace,
200 const TopoDS_Edge& theBaseEdge,
201 SMESHDS_Mesh* theMesh);
202 // Load nodes bound to theFace into column (vectors) and rows
204 // The value of theIJNodes map is a vector of ordered nodes so
205 // that the 0-the one lies on theBaseEdge.
206 // The key of theIJNodes map is a normalized parameter of each
207 // 0-the node on theBaseEdge.
209 bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
210 MapShapeNbElems& aResMap);
213 protected: // methods
221 double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ,
223 std::vector<const SMDS_MeshNode*>*& aCol1,
224 std::vector<const SMDS_MeshNode*>*& aCol2);
226 void ShapeSupportID(const bool theIsUpperLayer,
227 const SMESH_Block::TShapeID theBNSSID,
228 SMESH_Block::TShapeID& theSSID);
230 void FindNodeOnShape(const TopoDS_Shape& aS,
231 const gp_XYZ& aParams,
233 StdMeshers_TNode& aTN);
235 void CreateNode(const bool theIsUpperLayer,
236 const gp_XYZ& aParams,
237 StdMeshers_TNode& aTN);
239 void ClearMeshOnFxy1();
241 void MakeMeshOnFxy1();
243 void MakeConnectingMap();
245 int GetIndexOnLayer(const int aID);
247 void MakeVolumeMesh();
249 void SetMesh(SMESH_Mesh& theMesh) {
250 myMesh=(void *)&theMesh;
253 SMESH_Mesh* GetMesh()const {
254 return (SMESH_Mesh*)myMesh;
258 TopoDS_Shape myShape;
259 StdMeshers_SMESHBlock myBlock;
261 SMESH_ComputeErrorPtr myErrorStatus;
263 std::vector <StdMeshers_TNode> myTNodes;
266 double myTol3D; // Tolerance value
267 std::map < int, int > myConnectingMap;
269 std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
270 std::vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
272 bool myCreateQuadratic;
273 SMESH_MesherHelper* myTool; // tool building quadratic elements