Salome HOME
Merge from V6_main (dev of Anthony GEAY) 11/06/2013
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingFieldDiscretization.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 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__
22 #define __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__
23
24 #include "MEDCoupling.hxx"
25 #include "MEDCouplingRefCountObject.hxx"
26 #include "InterpKernelException.hxx"
27 #include "MEDCouplingTimeLabel.hxx"
28 #include "MEDCouplingNatureOfField.hxx"
29 #include "MEDCouplingGaussLocalization.hxx"
30 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
31
32 #include <set>
33 #include <vector>
34
35 namespace ParaMEDMEM
36 {
37   class DataArray;
38   class DataArrayInt;
39   class MEDCouplingMesh;
40   class DataArrayDouble;
41   class MEDCouplingFieldDouble;
42
43   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization : public RefCountObject, public TimeLabel
44   {
45   public:
46     static MEDCouplingFieldDiscretization *New(TypeOfField type);
47     double getPrecision() const { return _precision; }
48     void setPrecision(double val) { _precision=val; }
49     void updateTime() const;
50     std::size_t getHeapMemorySize() const;
51     static TypeOfField GetTypeOfFieldFromStringRepr(const char *repr) throw(INTERP_KERNEL::Exception);
52     virtual TypeOfField getEnum() const = 0;
53     virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
54     virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const = 0;
55     virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
56     virtual MEDCouplingFieldDiscretization *deepCpy() const;
57     virtual MEDCouplingFieldDiscretization *clone() const = 0;
58     virtual MEDCouplingFieldDiscretization *clonePart(const int *startCellIds, const int *endCellIds) const;
59     virtual MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
60     virtual std::string getStringRepr() const = 0;
61     virtual const char *getRepr() const = 0;
62     virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception) = 0;
63     virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const = 0;
64     virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const = 0;
65     virtual void normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception);
66     virtual void normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception);
67     virtual void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
68     virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const = 0;
69     virtual void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
70                                                     DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception) = 0;
71     virtual void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception) = 0;
72     virtual void renumberCells(const int *old2NewBg, bool check=true) throw(INTERP_KERNEL::Exception);
73     virtual void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
74                                        const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception) = 0;
75     virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
76     virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception) = 0;
77     virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0;
78     virtual void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const = 0;
79     virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const = 0;
80     virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const = 0;
81     virtual DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const = 0;
82     virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const = 0;
83     virtual MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
84     virtual void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const = 0;
85     virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const = 0;
86     virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const = 0;
87     virtual void getSerializationIntArray(DataArrayInt *& arr) const;
88     virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
89     virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
90     virtual void finishUnserialization(const std::vector<double>& tinyInfo);
91     virtual void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr);
92     virtual void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
93                                             const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
94     virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
95                                              const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
96     virtual void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
97     virtual MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
98     virtual int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
99     virtual int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
100     virtual int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
101     virtual std::set<int> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
102     virtual void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception);
103     virtual const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
104     virtual void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
105     virtual ~MEDCouplingFieldDiscretization();
106   protected:
107     MEDCouplingFieldDiscretization();
108     static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const char *msg);
109     static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg);
110   protected:
111     double _precision;
112     static const double DFLT_PRECISION;
113   };
114
115   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationP0 : public MEDCouplingFieldDiscretization
116   {
117   public:
118     TypeOfField getEnum() const;
119     MEDCouplingFieldDiscretization *clone() const;
120     std::string getStringRepr() const;
121     const char *getRepr() const;
122     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
123     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
124     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
125     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
126     void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
127                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
128     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
129     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
130     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
131                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
132     void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
133     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
134     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
135     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
136     DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
137     void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
138     void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
139     void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
140     MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
141     MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
142     DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
143     void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
144   public:
145     static const char REPR[];
146     static const TypeOfField TYPE;
147   };
148
149   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationOnNodes : public MEDCouplingFieldDiscretization
150   {
151   public:
152     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
153     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
154     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
155     void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
156                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
157     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
158     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
159                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
160     void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
161     MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
162     MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
163     DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
164     void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
165     void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
166     void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
167   public:
168     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
169   };
170
171   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationP1 : public MEDCouplingFieldDiscretizationOnNodes
172   {
173   public:
174     TypeOfField getEnum() const;
175     MEDCouplingFieldDiscretization *clone() const;
176     std::string getStringRepr() const;
177     const char *getRepr() const;
178     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
179     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
180     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
181     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
182     DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
183     void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
184   public:
185     static const char REPR[];
186     static const TypeOfField TYPE;
187   protected:
188     void getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const;
189   };
190
191   /*!
192    * This class abstracts MEDCouplingFieldDiscretization that needs an information on each cell to perform their job.
193    * All classes that inherits from this are more linked to mesh.
194    */
195   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization
196   {
197   public:
198     const DataArrayInt *getArrayOfDiscIds() const;
199     void setArrayOfDiscIds(const DataArrayInt *adids) throw(INTERP_KERNEL::Exception);
200     void checkNoOrphanCells() const throw(INTERP_KERNEL::Exception);
201     std::vector<DataArrayInt *> splitIntoSingleGaussDicrPerCellType(std::vector< int >& locIds) const throw(INTERP_KERNEL::Exception);
202   protected:
203     MEDCouplingFieldDiscretizationPerCell();
204     MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const int *startCellIds, const int *endCellIds);
205     MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, int beginCellIds, int endCellIds, int stepCellIds);
206     ~MEDCouplingFieldDiscretizationPerCell();
207     void updateTime() const;
208     std::size_t getHeapMemorySize() const;
209     void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
210     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
211     bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
212     void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
213   protected:
214     void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh);
215   protected:
216     DataArrayInt *_discr_per_cell;
217     static const int DFT_INVALID_LOCID_VALUE;
218   };
219
220   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGauss : public MEDCouplingFieldDiscretizationPerCell
221   {
222   public:
223     MEDCouplingFieldDiscretizationGauss();
224     TypeOfField getEnum() const;
225     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
226     bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
227     MEDCouplingFieldDiscretization *clone() const;
228     MEDCouplingFieldDiscretization *clonePart(const int *startCellIds, const int *endCellIds) const;
229     MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const;
230     std::string getStringRepr() const;
231     const char *getRepr() const;
232     std::size_t getHeapMemorySize() const;
233     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
234     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
235     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
236     void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
237                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
238     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
239     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
240                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
241     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
242     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
243     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
244     void finishUnserialization(const std::vector<double>& tinyInfo);
245     void getSerializationIntArray(DataArrayInt *& arr) const;
246     void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr);
247     double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
248     void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
249     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
250     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
251     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
252     DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
253     MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
254     MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
255     DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
256     void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
257     void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
258     void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
259     void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
260                                     const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
261     void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
262                                      const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
263     void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
264     void setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc) throw(INTERP_KERNEL::Exception);
265     void resizeLocalizationVector(int newSz) throw(INTERP_KERNEL::Exception);
266     MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
267     int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
268     int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
269     int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
270     std::set<int> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
271     void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception);
272     const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
273     DataArrayInt *buildNbOfGaussPointPerCellField() const throw(INTERP_KERNEL::Exception);
274     void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
275   protected:
276     MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const int *startCellIds=0, const int *endCellIds=0);
277     MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, int beginCellIds, int endCellIds, int stepCellIds);
278     void zipGaussLocalizations();
279     int getOffsetOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
280     void checkLocalizationId(int locId) const throw(INTERP_KERNEL::Exception);
281   public:
282     static const char REPR[];
283     static const TypeOfField TYPE;
284   private:
285     std::vector<MEDCouplingGaussLocalization> _loc;
286   };
287
288   /*!
289    * Gauss with points of values located on nodes of element. This is a specialization of MEDCouplingFieldDiscretizationGauss.
290    */
291   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGaussNE : public MEDCouplingFieldDiscretization
292   {
293   public:
294     MEDCouplingFieldDiscretizationGaussNE();
295     TypeOfField getEnum() const;
296     MEDCouplingFieldDiscretization *clone() const;
297     std::string getStringRepr() const;
298     const char *getRepr() const;
299     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
300     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
301     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
302     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
303     void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
304                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
305     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
306     void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
307     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
308                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
309     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
310     double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
311     void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
312     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
313     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
314     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
315     DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
316     MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
317     MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
318     DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
319     void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
320     void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
321     void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
322     void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
323     static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth) throw(INTERP_KERNEL::Exception);
324     static const double *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth) throw(INTERP_KERNEL::Exception);
325   protected:
326     MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other);
327   public:
328     static const char REPR[];
329     static const TypeOfField TYPE;
330     static const double FGP_SEG2[2];
331     static const double FGP_SEG3[3];
332     static const double FGP_SEG4[4];
333     static const double FGP_TRI3[3];
334     static const double FGP_TRI6[6];
335     static const double FGP_TRI7[7];
336     static const double FGP_QUAD4[4];
337     //static const double FGP_QUAD8[8];
338     static const double FGP_QUAD9[9];
339     static const double FGP_TETRA4[4];
340     //static const double FGP_TETRA10[10];
341     static const double FGP_PENTA6[6];
342     //static const double FGP_PENTA15[15];
343     static const double FGP_HEXA8[8];
344     static const double FGP_HEXA27[27];
345     static const double FGP_PYRA5[5];
346     //static const double FGP_PYRA13[13];
347     static const double REF_SEG2[2];
348     static const double REF_SEG3[3];
349     static const double REF_SEG4[4];
350     static const double REF_TRI3[6];
351     static const double REF_TRI6[12];
352     static const double REF_TRI7[14];
353     static const double REF_QUAD4[8];
354     static const double REF_QUAD8[16];
355     static const double REF_QUAD9[18];
356     static const double REF_TETRA4[12];
357     static const double REF_TETRA10[30];
358     static const double REF_PENTA6[18];
359     static const double REF_PENTA15[45];
360     static const double REF_HEXA8[24];
361     static const double REF_HEXA20[60];
362     static const double REF_HEXA27[81];
363     static const double REF_PYRA5[15];
364     static const double REF_PYRA13[39];
365   };
366
367   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes
368   {
369   public:
370     TypeOfField getEnum() const;
371     const char *getRepr() const;
372     MEDCouplingFieldDiscretization *clone() const;
373     std::string getStringRepr() const;
374     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
375     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
376     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
377     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
378     DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
379     void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
380   public://specific part
381     DataArrayDouble *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const;
382   protected:
383     void operateOnDenseMatrix(int spaceDimension, int nbOfElems, double *matrixPtr) const;
384     DataArrayDouble *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const;
385   public:
386     static const char REPR[];
387     static const TypeOfField TYPE;
388   };
389 }
390
391 #endif