Salome HOME
Delete usaged StdMeshers_Helper. Fix bug 11772
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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 //  $Header$
29
30 #ifndef _SMESH_HEXA_3D_HXX_
31 #define _SMESH_HEXA_3D_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 "StdMeshers_Helper.hxx"
39
40 typedef struct point3Dstruct
41 {
42         const SMDS_MeshNode * node;
43 } Point3DStruct;
44
45 typedef double Pt3[3];
46
47 typedef struct conv2dstruct
48 {
49   double a1; // X = a1*x + b1*y + c1 
50   double b1; // Y = a2*x + b2*y + c2
51   double c1; // a1, b1 a2, b2 in {-1,0,1}
52   double a2; // c1, c2 in {0,1}
53   double b2;
54   double c2;
55   int ia;    // I = ia*i + ib*j + ic
56   int ib;
57   int ic;
58   int ja;    // J = ja*i + jb*j + jc
59   int jb;
60   int jc;
61 } Conv2DStruct;
62
63 typedef struct cubeStruct
64 {
65   TopoDS_Vertex V000;
66   TopoDS_Vertex V001;
67   TopoDS_Vertex V010;
68   TopoDS_Vertex V011;
69   TopoDS_Vertex V100;
70   TopoDS_Vertex V101;
71   TopoDS_Vertex V110;
72   TopoDS_Vertex V111;
73   faceQuadStruct* quad_X0;
74   faceQuadStruct* quad_X1;
75   faceQuadStruct* quad_Y0;
76   faceQuadStruct* quad_Y1;
77   faceQuadStruct* quad_Z0;
78   faceQuadStruct* quad_Z1;
79   Point3DStruct* np; // normalised 3D coordinates
80 } CubeStruct;
81
82 class StdMeshers_Hexa_3D:
83   public SMESH_3D_Algo
84 {
85 public:
86   StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen* gen);
87   virtual ~StdMeshers_Hexa_3D();
88
89   virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
90                                const TopoDS_Shape& aShape,
91                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
92
93   virtual bool Compute(SMESH_Mesh& aMesh,
94                        const TopoDS_Shape& aShape)
95     throw (SALOME_Exception);
96
97   ostream & SaveTo(ostream & save);
98   istream & LoadFrom(istream & load);
99   friend ostream & operator << (ostream & save, StdMeshers_Hexa_3D & hyp);
100   friend istream & operator >> (istream & load, StdMeshers_Hexa_3D & hyp);
101
102 protected:
103   TopoDS_Edge
104   EdgeNotInFace(SMESH_Mesh& aMesh,
105                 const TopoDS_Shape& aShape,
106                 const TopoDS_Face& aFace,
107                 const TopoDS_Vertex& aVertex,
108                 const TopTools_IndexedDataMapOfShapeListOfShape& MS);
109
110   int GetFaceIndex(SMESH_Mesh& aMesh,
111                    const TopoDS_Shape& aShape,
112                    const vector<SMESH_subMesh*>& meshFaces,
113                    const TopoDS_Vertex& V0,
114                    const TopoDS_Vertex& V1,
115                    const TopoDS_Vertex& V2,
116                    const TopoDS_Vertex& V3);
117
118   void GetConv2DCoefs(const faceQuadStruct& quad,
119                       const TopoDS_Shape& aShape,
120                       const TopoDS_Vertex& V0,
121                       const TopoDS_Vertex& V1,
122                       const TopoDS_Vertex& V2,
123                       const TopoDS_Vertex& V3,
124                       Conv2DStruct& conv);
125
126   void GetPoint(Pt3 p,
127                 int i, int j, int k,
128                 int nbx, int nby, int nbz,
129                 Point3DStruct *np,
130                 const SMESHDS_Mesh* meshDS);
131
132   bool ClearAndReturn(const bool res);
133
134   CubeStruct _cube;
135   FaceQuadStruct* _quads[6];
136   int _indX0;
137   int _indX1;
138   int _indY0;
139   int _indY1;
140   int _indZ0;
141   int _indZ1;
142
143   bool myCreateQuadratic;
144   StdMeshers_Helper* myTool; // toll for working with quadratic elements
145 };
146
147 #endif