Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / StdMeshers / StdMeshers_Hexa_3D.hxx
1 //  SMESH SMESH : implementaion of SMESH idl descriptions
2 //
3 //  Copyright (C) 2003  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 //
23 //
24 //  File   : StdMeshers_Hexa_3D.hxx
25 //           Moved here from SMESH_Hexa_3D.hxx
26 //  Author : Paul RASCLE, EDF
27 //  Module : SMESH
28
29 #ifndef _SMESH_HEXA_3D_HXX_
30 #define _SMESH_HEXA_3D_HXX_
31
32 #include "SMESH_StdMeshers.hxx"
33
34 #include "SMESH_3D_Algo.hxx"
35 #include "SMESH_Mesh.hxx"
36 #include "StdMeshers_Quadrangle_2D.hxx"
37 #include "Utils_SALOME_Exception.hxx"
38
39 #include "SMESH_MesherHelper.hxx"
40
41 class TopTools_IndexedMapOfShape;
42
43 typedef struct point3Dstruct
44 {
45   const SMDS_MeshNode * node;
46 } Point3DStruct;
47
48 typedef double Pt3[3];
49
50 typedef struct conv2dstruct
51 {
52   double a1; // X = a1*x + b1*y + c1 
53   double b1; // Y = a2*x + b2*y + c2
54   double c1; // a1, b1 a2, b2 in {-1,0,1}
55   double a2; // c1, c2 in {0,1}
56   double b2;
57   double c2;
58   int ia;    // I = ia*i + ib*j + ic
59   int ib;
60   int ic;
61   int ja;    // J = ja*i + jb*j + jc
62   int jb;
63   int jc;
64 } Conv2DStruct;
65
66 class STDMESHERS_EXPORT StdMeshers_Hexa_3D:
67   public SMESH_3D_Algo
68 {
69 public:
70   StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen* gen);
71   virtual ~StdMeshers_Hexa_3D();
72
73   virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
74                                const TopoDS_Shape& aShape,
75                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
76
77   virtual bool Compute(SMESH_Mesh& aMesh,
78                        const TopoDS_Shape& aShape)
79     /*throw (SALOME_Exception)*/;
80
81   static TopoDS_Vertex OppositeVertex(const TopoDS_Vertex& aVertex,
82                                       const TopTools_IndexedMapOfShape& aQuads0Vertices,
83                                       FaceQuadStruct* aQuads[6]);
84
85 protected:
86   TopoDS_Edge
87   EdgeNotInFace(SMESH_Mesh& aMesh,
88                 const TopoDS_Shape& aShape,
89                 const TopoDS_Face& aFace,
90                 const TopoDS_Vertex& aVertex,
91                 const TopTools_IndexedDataMapOfShapeListOfShape& MS);
92
93   int GetFaceIndex(SMESH_Mesh& aMesh,
94                    const TopoDS_Shape& aShape,
95                    const vector<SMESH_subMesh*>& meshFaces,
96                    const TopoDS_Vertex& V0,
97                    const TopoDS_Vertex& V1,
98                    const TopoDS_Vertex& V2,
99                    const TopoDS_Vertex& V3);
100
101   void GetConv2DCoefs(const faceQuadStruct& quad,
102                       const TopoDS_Shape& aShape,
103                       const TopoDS_Vertex& V0,
104                       const TopoDS_Vertex& V1,
105                       const TopoDS_Vertex& V2,
106                       const TopoDS_Vertex& V3,
107                       Conv2DStruct& conv);
108
109   void GetPoint(Pt3 p,
110                 int i, int j, int k,
111                 int nbx, int nby, int nbz,
112                 Point3DStruct *np,
113                 const SMESHDS_Mesh* meshDS);
114
115   bool ClearAndReturn(FaceQuadStruct* theQuads[6], const bool res);
116 };
117
118 #endif