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