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