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