1 // Copyright (C) 2007-2008 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.
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
22 // SMESH StdMeshers : implementaion of SMESH idl descriptions
23 // File : StdMeshers_Penta_3D.hxx
26 #ifndef StdMeshers_Penta_3D_HeaderFile
27 #define StdMeshers_Penta_3D_HeaderFile
29 #include "SMESH_StdMeshers.hxx"
33 ////////////////////////////////////////////////////////////////////////
35 // class StdMeshers_SMESHBlock
37 ////////////////////////////////////////////////////////////////////////
40 #include <TopoDS_Vertex.hxx>
41 #include <TopoDS_Shell.hxx>
42 #include <TopTools_IndexedMapOfOrientedShape.hxx>
43 #include <TColStd_MapOfInteger.hxx>
45 #include "SMESH_Block.hxx"
46 #include "SMESH_ComputeError.hxx"
47 #include "SMESH_MesherHelper.hxx"
48 #include "SMESH_3D_Algo.hxx"
50 typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
52 class STDMESHERS_EXPORT StdMeshers_SMESHBlock {
56 StdMeshers_SMESHBlock();
58 void Load (const TopoDS_Shell& theShell);
60 void Load (const TopoDS_Shell& theShell,
61 const TopoDS_Vertex& theV000,
62 const TopoDS_Vertex& theV001);
64 void ComputeParameters(const gp_Pnt& thePnt,
67 void ComputeParameters(const gp_Pnt& thePnt,
68 const TopoDS_Shape& theShape,
71 void ComputeParameters(const double& theU,
72 const TopoDS_Shape& theShape,
75 void Point(const gp_XYZ& theParams,
78 void Point(const gp_XYZ& theParams,
79 const TopoDS_Shape& theShape,
82 int ShapeID(const TopoDS_Shape& theShape);
84 const TopoDS_Shape& Shape(const int theID);
86 SMESH_Block & Block() { return myTBlock; }
88 bool IsForwadEdge(const int theEdgeID);
90 int ErrorStatus() const;
92 SMESH_ComputeErrorPtr GetError() const;
97 TopTools_IndexedMapOfOrientedShape myShapeIDMap;
99 TopoDS_Shape myEmptyShape;
100 std::vector<int> myIsEdgeForward;
105 ////////////////////////////////////////////////////////////////////////
107 // class StdMeshers_TNode
109 ////////////////////////////////////////////////////////////////////////
110 #include "SMDS_MeshNode.hxx"
112 class STDMESHERS_EXPORT StdMeshers_TNode {
118 myXYZ.SetCoord(99., 99., 99.);
123 void SetNode(const SMDS_MeshNode* theNode) {
124 myNode=(SMDS_MeshNode*) theNode;
127 const SMDS_MeshNode* Node()const {
131 void SetShapeSupportID (const int theID) {
132 myShapeSupportID=theID;
135 int ShapeSupportID()const {
136 return myShapeSupportID;
139 void SetNormCoord (const gp_XYZ& theXYZ) {
143 const gp_XYZ& NormCoord ()const{
147 void SetBaseNodeID (const int theID) {
151 int BaseNodeID ()const{
156 SMDS_MeshNode* myNode;
157 int myShapeSupportID;
162 ////////////////////////////////////////////////////////////////////////
164 // class StdMeshers_Penta_3D
166 ////////////////////////////////////////////////////////////////////////
167 #include "SMESH_Mesh.hxx"
168 #include <TopoDS_Shape.hxx>
170 class STDMESHERS_EXPORT StdMeshers_Penta_3D {
173 StdMeshers_Penta_3D();
175 ~StdMeshers_Penta_3D();
177 bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
179 int ErrorStatus() const {
180 if (myErrorStatus->IsOK())
182 return myErrorStatus->myName;
185 SMESH_ComputeErrorPtr GetComputeError() const {
186 return myErrorStatus;
189 void SetTolerance(const double theTol3D) {
193 double Tolerance() const {
197 bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
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
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.
208 bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
209 MapShapeNbElems& aResMap);
212 protected: // methods
220 double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ,
222 std::vector<const SMDS_MeshNode*>*& aCol1,
223 std::vector<const SMDS_MeshNode*>*& aCol2);
225 void ShapeSupportID(const bool theIsUpperLayer,
226 const SMESH_Block::TShapeID theBNSSID,
227 SMESH_Block::TShapeID& theSSID);
229 void FindNodeOnShape(const TopoDS_Shape& aS,
230 const gp_XYZ& aParams,
232 StdMeshers_TNode& aTN);
234 void CreateNode(const bool theIsUpperLayer,
235 const gp_XYZ& aParams,
236 StdMeshers_TNode& aTN);
238 void ClearMeshOnFxy1();
240 void MakeMeshOnFxy1();
242 void MakeConnectingMap();
244 int GetIndexOnLayer(const int aID);
246 void MakeVolumeMesh();
248 void SetMesh(SMESH_Mesh& theMesh) {
249 myMesh=(void *)&theMesh;
252 SMESH_Mesh* GetMesh()const {
253 return (SMESH_Mesh*)myMesh;
257 TopoDS_Shape myShape;
258 StdMeshers_SMESHBlock myBlock;
260 SMESH_ComputeErrorPtr myErrorStatus;
262 std::vector <StdMeshers_TNode> myTNodes;
265 double myTol3D; // Tolerance value
266 std::map < int, int > myConnectingMap;
268 std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
269 std::vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
271 bool myCreateQuadratic;
272 SMESH_MesherHelper* myTool; // tool building quadratic elements