]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx
Salome HOME
Voronoi deal with quadratic meshes + FieldDouble::convertQuadToLinear works with...
[tools/medcoupling.git] / src / INTERP_KERNEL / GaussPoints / InterpKernelGaussCoords.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __INTERPKERNELGAUSSCOORDS_HXX__
21 #define __INTERPKERNELGAUSSCOORDS_HXX__
22
23 #include "INTERPKERNELDefines.hxx"
24 #include "NormalizedUnstructuredMesh.hxx"
25 #include "InterpKernelException.hxx"
26
27 #include <vector>
28
29 namespace INTERP_KERNEL 
30 {
31   typedef std::vector<double> DataVector;
32   typedef std::vector<int>    IndexVector;
33
34   //Class to store Gauss Points information
35   class GaussInfo 
36   {
37   public:
38     INTERPKERNEL_EXPORT GaussInfo( NormalizedCellType theGeometry,
39                                    const DataVector& theGaussCoord,
40                                    int theNbGauss,
41                                    const DataVector& theReferenceCoord,
42                                    int theNbRef
43                                    );
44     INTERPKERNEL_EXPORT ~GaussInfo();
45
46     INTERPKERNEL_EXPORT NormalizedCellType getCellType() const;    
47
48     INTERPKERNEL_EXPORT int getGaussCoordDim() const;
49     INTERPKERNEL_EXPORT int getReferenceCoordDim() const;
50     INTERPKERNEL_EXPORT DataVector getGaussCoords() const { return _my_gauss_coord; }
51     INTERPKERNEL_EXPORT DataVector getRefCoords() const { return _my_reference_coord; }
52     INTERPKERNEL_EXPORT NormalizedCellType getGeoType() const { return _my_geometry; }
53
54     INTERPKERNEL_EXPORT int getNbGauss() const;
55     INTERPKERNEL_EXPORT int getNbRef() const;
56
57     INTERPKERNEL_EXPORT GaussInfo convertToLinear() const;
58
59     INTERPKERNEL_EXPORT const double* getFunctionValues( const int theGaussId ) const;
60
61     INTERPKERNEL_EXPORT void initLocalInfo();
62     
63     INTERPKERNEL_EXPORT static std::vector<double> NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector<double>& inputArray);
64
65   public:
66     static const double TETRA4A_REF[12];
67     static const double TETRA4B_REF[12];
68     static const double TETRA10A_REF[30];
69     static const double TETRA10B_REF[30];
70
71   protected:
72     static bool IsSatisfy(const std::vector<double>& ref1, const std::vector<double>& ref2);
73     bool isSatisfy();
74     
75     void point1Init();
76     
77     //1D
78     void seg2Init();
79     void seg3Init();
80
81     //2D
82     void tria3aInit();
83     void tria3bInit();
84     void tria6aInit();
85     void tria6bInit();
86     void tria7aInit();
87
88     void quad4aInit();
89     static void Quad4aInit(GaussInfo& obj) { obj.quad4aInit(); }
90     void quad4bInit();
91     static void Quad4bInit(GaussInfo& obj) { obj.quad4bInit(); }
92     void quad4cInit();
93     static void Quad4cInit(GaussInfo& obj) { obj.quad4cInit(); }
94     void quad4DegSeg2Init();
95     static void Quad4DegSeg2Init(GaussInfo& obj) { obj.quad4DegSeg2Init(); }
96     void quad8aInit();
97     void quad8bInit();
98     void quad9aInit();
99
100     //3D
101     void tetra4aInit();
102     void tetra4bInit();
103     void tetra10aInit();
104     void tetra10bInit();
105
106     void pyra5aInit();
107     void pyra5bInit();
108     void pyra13aInit();
109     void pyra13bInit();
110
111     void penta6aInit();
112     static void Penta6aInit(GaussInfo& obj) { obj.penta6aInit(); }
113     void penta6bInit();
114     static void Penta6bInit(GaussInfo& obj) { obj.penta6bInit(); }
115     void penta6DegTria3aInit();
116     static void Penta6DegTria3aInit(GaussInfo& obj) { obj.penta6DegTria3aInit(); }
117     void penta6DegTria3bInit();
118     static void Penta6DegTria3bInit(GaussInfo& obj) { obj.penta6DegTria3bInit(); }
119     
120     void penta15aInit();
121     static void Penta15aInit(GaussInfo& obj) { obj.penta15aInit(); }
122     void penta15bInit();
123     static void Penta15bInit(GaussInfo& obj) { obj.penta15bInit(); }
124
125     void hexa8aInit();
126     static void Hexa8aInit(GaussInfo& obj) { obj.hexa8aInit(); }
127     void hexa8bInit();
128     static void Hexa8bInit(GaussInfo& obj) { obj.hexa8bInit(); }
129     void hexa8DegQuad4aInit();
130     static void Hexa8DegQuad4aInit(GaussInfo& obj) { obj.hexa8DegQuad4aInit(); }
131     void hexa8DegQuad4bInit();
132     static void Hexa8DegQuad4bInit(GaussInfo& obj) { obj.hexa8DegQuad4bInit(); }
133     void hexa8DegQuad4cInit();
134     static void Hexa8DegQuad4cInit(GaussInfo& obj) { obj.hexa8DegQuad4cInit(); }
135     void hexa20aInit();
136     void hexa20bInit();
137     void hexa27aInit();
138
139   private:
140     //INFORMATION from MEDMEM
141     NormalizedCellType _my_geometry;               //Cell type
142
143     int                _my_nb_gauss;                //Nb of the gauss points for element
144     DataVector         _my_gauss_coord;             //Gauss coordinates
145
146     int                _my_nb_ref;                  //Nb of the nodes for element:
147                                                  //NORM_SEG2 - 2
148                                                  //NORM_SEG3 - 3
149                                                  //NORM_TRI3 - 3
150                                                  //.............
151
152     DataVector         _my_reference_coord;         //Reference coordinates
153
154     //LOCAL INFORMATION
155     DataVector         _my_local_reference_coord;    //Vector to store reference coordinates
156     int                _my_local_ref_dim;            //Dimension of the local reference coordinates:
157                                                  // (x)       - 1D case
158                                                  // (x, y)    - 2D case
159                                                  // (x, y, z) - 3D case
160     int                _my_local_nb_ref;             //Nb of the local reference coordinates
161
162     DataVector         _my_function_value;          //Shape Function values
163   };
164
165
166   //Class for calculation of the coordinates of the gauss points 
167   class GaussCoords 
168   {
169   public:
170
171     INTERPKERNEL_EXPORT GaussCoords();
172     INTERPKERNEL_EXPORT ~GaussCoords();
173
174     INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry,
175                                            int coordDim,
176                                            const double* theGaussCoord,
177                                            int theNbGauss,
178                                            const double* theReferenceCoord,
179                                            int theNbRef);
180
181     INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry, 
182                                                  const double* theNodeCoords, 
183                                                  const int theSpaceDim,
184                                                  const int* theIndex);
185
186     INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry, 
187                                               const double* theNodeCoords, 
188                                               const int theSpaceDim,
189                                               const int* theIndex,
190                                               double *result);
191   private:
192     const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType);
193     void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex,
194                             double *result);
195   private:
196     typedef std::vector<GaussInfo*> GaussInfoVector;
197     GaussInfoVector _my_gauss_info;
198   };
199 }
200 #endif //INTERPKERNELGAUSSCOORDS