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"
49 typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
51 class STDMESHERS_EXPORT StdMeshers_SMESHBlock {
55 StdMeshers_SMESHBlock();
57 void Load (const TopoDS_Shell& theShell);
59 void Load (const TopoDS_Shell& theShell,
60 const TopoDS_Vertex& theV000,
61 const TopoDS_Vertex& theV001);
63 void ComputeParameters(const gp_Pnt& thePnt,
66 void ComputeParameters(const gp_Pnt& thePnt,
67 const TopoDS_Shape& theShape,
70 void ComputeParameters(const double& theU,
71 const TopoDS_Shape& theShape,
74 void Point(const gp_XYZ& theParams,
77 void Point(const gp_XYZ& theParams,
78 const TopoDS_Shape& theShape,
81 int ShapeID(const TopoDS_Shape& theShape);
83 const TopoDS_Shape& Shape(const int theID);
85 SMESH_Block & Block() { return myTBlock; }
87 bool IsForwadEdge(const int theEdgeID);
89 int ErrorStatus() const;
91 SMESH_ComputeErrorPtr GetError() const;
96 TopTools_IndexedMapOfOrientedShape myShapeIDMap;
98 TopoDS_Shape myEmptyShape;
99 std::vector<int> myIsEdgeForward;
104 ////////////////////////////////////////////////////////////////////////
106 // class StdMeshers_TNode
108 ////////////////////////////////////////////////////////////////////////
109 #include "SMDS_MeshNode.hxx"
111 class STDMESHERS_EXPORT StdMeshers_TNode {
117 myXYZ.SetCoord(99., 99., 99.);
122 void SetNode(const SMDS_MeshNode* theNode) {
123 myNode=(SMDS_MeshNode*) theNode;
126 const SMDS_MeshNode* Node()const {
130 void SetShapeSupportID (const int theID) {
131 myShapeSupportID=theID;
134 int ShapeSupportID()const {
135 return myShapeSupportID;
138 void SetNormCoord (const gp_XYZ& theXYZ) {
142 const gp_XYZ& NormCoord ()const{
146 void SetBaseNodeID (const int theID) {
150 int BaseNodeID ()const{
155 SMDS_MeshNode* myNode;
156 int myShapeSupportID;
161 ////////////////////////////////////////////////////////////////////////
163 // class StdMeshers_Penta_3D
165 ////////////////////////////////////////////////////////////////////////
166 #include "SMESH_Mesh.hxx"
167 #include <TopoDS_Shape.hxx>
169 class STDMESHERS_EXPORT StdMeshers_Penta_3D {
172 StdMeshers_Penta_3D();
174 ~StdMeshers_Penta_3D();
176 bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
178 int ErrorStatus() const {
179 if (myErrorStatus->IsOK())
181 return myErrorStatus->myName;
184 SMESH_ComputeErrorPtr GetComputeError() const {
185 return myErrorStatus;
188 void SetTolerance(const double theTol3D) {
192 double Tolerance() const {
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
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.
208 protected: // methods
216 double SetHorizEdgeXYZ(const gp_XYZ& aBNXYZ,
218 std::vector<const SMDS_MeshNode*>*& aCol1,
219 std::vector<const SMDS_MeshNode*>*& aCol2);
221 void ShapeSupportID(const bool theIsUpperLayer,
222 const SMESH_Block::TShapeID theBNSSID,
223 SMESH_Block::TShapeID& theSSID);
225 void FindNodeOnShape(const TopoDS_Shape& aS,
226 const gp_XYZ& aParams,
228 StdMeshers_TNode& aTN);
230 void CreateNode(const bool theIsUpperLayer,
231 const gp_XYZ& aParams,
232 StdMeshers_TNode& aTN);
234 void ClearMeshOnFxy1();
236 void MakeMeshOnFxy1();
238 void MakeConnectingMap();
240 int GetIndexOnLayer(const int aID);
242 void MakeVolumeMesh();
244 void SetMesh(SMESH_Mesh& theMesh) {
245 myMesh=(void *)&theMesh;
248 SMESH_Mesh* GetMesh()const {
249 return (SMESH_Mesh*)myMesh;
253 TopoDS_Shape myShape;
254 StdMeshers_SMESHBlock myBlock;
256 SMESH_ComputeErrorPtr myErrorStatus;
258 std::vector <StdMeshers_TNode> myTNodes;
261 double myTol3D; // Tolerance value
262 std::map < int, int > myConnectingMap;
264 std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
265 std::vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
267 bool myCreateQuadratic;
268 SMESH_MesherHelper* myTool; // tool building quadratic elements