1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __INTERPKERNELGAUSSCOORDS_HXX__
21 #define __INTERPKERNELGAUSSCOORDS_HXX__
23 #include "INTERPKERNELDefines.hxx"
24 #include "NormalizedUnstructuredMesh.hxx"
25 #include "InterpKernelException.hxx"
29 namespace INTERP_KERNEL
31 typedef std::vector<double> DataVector;
32 typedef std::vector<int> IndexVector;
34 //Class to store Gauss Points information
38 INTERPKERNEL_EXPORT GaussInfo( NormalizedCellType theGeometry,
39 const DataVector& theGaussCoord,
41 const DataVector& theReferenceCoord,
44 INTERPKERNEL_EXPORT ~GaussInfo();
46 INTERPKERNEL_EXPORT NormalizedCellType getCellType() const;
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; }
54 INTERPKERNEL_EXPORT int getNbGauss() const;
55 INTERPKERNEL_EXPORT int getNbRef() const;
57 INTERPKERNEL_EXPORT GaussInfo convertToLinear() const;
59 INTERPKERNEL_EXPORT const double* getFunctionValues( const int theGaussId ) const;
61 INTERPKERNEL_EXPORT void initLocalInfo();
63 INTERPKERNEL_EXPORT static std::vector<double> NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector<double>& inputArray);
66 static const double SEG2_REF[2];
67 static const double SEG3_REF[3];
68 static const double TRIA3A_REF[6];
69 static const double TRIA3B_REF[6];
70 static const double TRIA6A_REF[12];
71 static const double TRIA6B_REF[12];
72 static const double TRIA7A_REF[14];
73 static const double QUAD4A_REF[8];
74 static const double QUAD4B_REF[8];
75 static const double QUAD8A_REF[16];
76 static const double QUAD8B_REF[16];
77 static const double QUAD9A_REF[18];
78 static const double TETRA4A_REF[12];
79 static const double TETRA4B_REF[12];
80 static const double TETRA10A_REF[30];
81 static const double TETRA10B_REF[30];
82 static const double PYRA5A_REF[15];
83 static const double PYRA5B_REF[15];
84 static const double PYRA13A_REF[39];
85 static const double PYRA13B_REF[39];
86 static const double PENTA6A_REF[18];
87 static const double PENTA6B_REF[18];
88 static const double PENTA15A_REF[45];
89 static const double PENTA15B_REF[45];
90 static const double HEXA8A_REF[24];
91 static const double HEXA8B_REF[24];
92 static const double HEXA20A_REF[60];
93 static const double HEXA20B_REF[60];
94 static const double HEXA27A_REF[81];
96 static bool IsSatisfy(const std::vector<double>& ref1, const std::vector<double>& ref2);
113 static void Quad4aInit(GaussInfo& obj) { obj.quad4aInit(); }
115 static void Quad4bInit(GaussInfo& obj) { obj.quad4bInit(); }
117 static void Quad4cInit(GaussInfo& obj) { obj.quad4cInit(); }
118 void quad4DegSeg2Init();
119 static void Quad4DegSeg2Init(GaussInfo& obj) { obj.quad4DegSeg2Init(); }
136 static void Penta6aInit(GaussInfo& obj) { obj.penta6aInit(); }
138 static void Penta6bInit(GaussInfo& obj) { obj.penta6bInit(); }
139 void penta6DegTria3aInit();
140 static void Penta6DegTria3aInit(GaussInfo& obj) { obj.penta6DegTria3aInit(); }
141 void penta6DegTria3bInit();
142 static void Penta6DegTria3bInit(GaussInfo& obj) { obj.penta6DegTria3bInit(); }
145 static void Penta15aInit(GaussInfo& obj) { obj.penta15aInit(); }
147 static void Penta15bInit(GaussInfo& obj) { obj.penta15bInit(); }
150 static void Hexa8aInit(GaussInfo& obj) { obj.hexa8aInit(); }
152 static void Hexa8bInit(GaussInfo& obj) { obj.hexa8bInit(); }
153 void hexa8DegQuad4aInit();
154 static void Hexa8DegQuad4aInit(GaussInfo& obj) { obj.hexa8DegQuad4aInit(); }
155 void hexa8DegQuad4bInit();
156 static void Hexa8DegQuad4bInit(GaussInfo& obj) { obj.hexa8DegQuad4bInit(); }
157 void hexa8DegQuad4cInit();
158 static void Hexa8DegQuad4cInit(GaussInfo& obj) { obj.hexa8DegQuad4cInit(); }
164 //INFORMATION from MEDMEM
165 NormalizedCellType _my_geometry; //Cell type
167 int _my_nb_gauss; //Nb of the gauss points for element
168 DataVector _my_gauss_coord; //Gauss coordinates
170 int _my_nb_ref; //Nb of the nodes for element:
176 DataVector _my_reference_coord; //Reference coordinates
179 DataVector _my_local_reference_coord; //Vector to store reference coordinates
180 int _my_local_ref_dim; //Dimension of the local reference coordinates:
183 // (x, y, z) - 3D case
184 int _my_local_nb_ref; //Nb of the local reference coordinates
186 DataVector _my_function_value; //Shape Function values
190 //Class for calculation of the coordinates of the gauss points
195 INTERPKERNEL_EXPORT GaussCoords();
196 INTERPKERNEL_EXPORT ~GaussCoords();
198 INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry,
200 const double* theGaussCoord,
202 const double* theReferenceCoord,
205 INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry,
206 const double* theNodeCoords,
207 const int theSpaceDim,
208 const int* theIndex);
210 INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry,
211 const double* theNodeCoords,
212 const int theSpaceDim,
216 const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType);
217 void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex,
220 typedef std::vector<GaussInfo*> GaussInfoVector;
221 GaussInfoVector _my_gauss_info;
224 #endif //INTERPKERNELGAUSSCOORDS