Salome HOME
Warning hunting
[modules/med.git] / src / INTERP_KERNEL / GaussPoints / InterpKernelGaussCoords.hxx
1 // Copyright (C) 2007-2013  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.
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
51     INTERPKERNEL_EXPORT int getNbGauss() const;
52     INTERPKERNEL_EXPORT int getNbRef() const;
53
54     INTERPKERNEL_EXPORT const double* getFunctionValues( const int theGaussId ) const;
55
56     INTERPKERNEL_EXPORT void initLocalInfo();
57
58   protected:
59
60     bool isSatisfy();
61
62     //1D
63     void seg2Init();
64     void seg3Init();
65
66     //2D
67     void tria3aInit();
68     void tria3bInit();
69     void tria6aInit();
70     void tria6bInit();
71
72     void quad4aInit();
73     void quad4bInit();
74     void quad8aInit();
75     void quad8bInit();
76     void quad9aInit();
77
78     //3D
79     void tetra4aInit();
80     void tetra4bInit();
81     void tetra10aInit();
82     void tetra10bInit();
83
84     void pyra5aInit();
85     void pyra5bInit();
86     void pyra13aInit();
87     void pyra13bInit();
88
89     void penta6aInit();
90     void penta6bInit();
91     void penta15aInit();
92     void penta15bInit();
93
94     void hexa8aInit();
95     void hexa8bInit();
96     void hexa20aInit();
97     void hexa20bInit();
98
99
100   private:
101     //INFORMATION from MEDMEM
102     NormalizedCellType _my_geometry;               //Cell type
103
104     int                _my_nb_gauss;                //Nb of the gauss points for element
105     DataVector         _my_gauss_coord;             //Gauss coordinates
106
107     int                _my_nb_ref;                  //Nb of the nodes for element:
108                                                  //NORM_SEG2 - 2
109                                                  //NORM_SEG3 - 3
110                                                  //NORM_TRI3 - 3
111                                                  //.............
112
113     DataVector         _my_reference_coord;         //Reference coordinates
114
115     //LOCAL INFORMATION
116     DataVector         _my_local_reference_coord;    //Vector to store reference coordinates
117     int                _my_local_ref_dim;            //Dimension of the local reference coordinates:
118                                                  // (x)       - 1D case
119                                                  // (x, y)    - 2D case
120                                                  // (x, y, z) - 3D case
121     int                _my_local_nb_ref;             //Nb of the local reference coordinates
122
123     DataVector         _my_function_value;          //Shape Function values
124   };
125
126
127   //Class for calculation of the coordinates of the gauss points 
128   class GaussCoords 
129   {
130   public:
131
132     INTERPKERNEL_EXPORT GaussCoords();
133     INTERPKERNEL_EXPORT ~GaussCoords();
134
135     INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry,
136                                            int coordDim,
137                                            const double* theGaussCoord,
138                                            int theNbGauss,
139                                            const double* theReferenceCoord,
140                                            int theNbRef);
141
142     INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry, 
143                                                  const double* theNodeCoords, 
144                                                  const int theSpaceDim,
145                                                  const int* theIndex);
146
147     INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry, 
148                                               const double* theNodeCoords, 
149                                               const int theSpaceDim,
150                                               const int* theIndex,
151                                               double *result);
152   private:
153     const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType);
154     void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex,
155                             double *result);
156   private:
157     typedef std::vector<GaussInfo*> GaussInfoVector;
158     GaussInfoVector _my_gauss_info;
159   };
160 }
161 #endif //INTERPKERNELGAUSSCOORDS