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