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