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