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