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_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
22 #define __PARAMEDMEM_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
24 #include "MEDCoupling.hxx"
25 #include "MEDCouplingTimeLabel.hxx"
26 #include "MEDCouplingRefCountObject.hxx"
27 #include "InterpKernelException.hxx"
33 class MEDCouplingMesh;
34 class DataArrayDouble;
37 class MEDCouplingTimeDiscretization : public TimeLabel, public BigMemoryObject
40 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization();
41 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy);
43 MEDCOUPLING_EXPORT void updateTime() const;
44 MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const;
45 MEDCOUPLING_EXPORT virtual std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
46 MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
47 MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; }
48 MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; }
49 MEDCOUPLING_EXPORT virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
50 MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
51 MEDCOUPLING_EXPORT virtual void checkCoherency() const;
52 MEDCOUPLING_EXPORT virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
53 MEDCOUPLING_EXPORT virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
54 MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
55 MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
56 MEDCOUPLING_EXPORT virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
57 MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
58 MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
59 MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
60 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const;
61 MEDCOUPLING_EXPORT virtual std::string getStringRepr() const = 0;
62 MEDCOUPLING_EXPORT virtual TypeOfTimeDiscretization getEnum() const = 0;
63 MEDCOUPLING_EXPORT virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) = 0;
64 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
65 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const = 0;
66 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const = 0;
67 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const = 0;
68 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const = 0;
69 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const = 0;
70 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const = 0;
71 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const = 0;
72 MEDCOUPLING_EXPORT virtual void addEqual(const MEDCouplingTimeDiscretization *other) = 0;
73 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const = 0;
74 MEDCOUPLING_EXPORT virtual void substractEqual(const MEDCouplingTimeDiscretization *other) = 0;
75 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const = 0;
76 MEDCOUPLING_EXPORT virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) = 0;
77 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const = 0;
78 MEDCOUPLING_EXPORT virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
79 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0;
80 MEDCOUPLING_EXPORT virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0;
81 MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
82 MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
83 MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
84 MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
85 MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays);
86 MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
87 MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
88 MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
89 MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
90 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0;
91 MEDCOUPLING_EXPORT void setTimeTolerance(double val) { _time_tolerance=val; }
92 MEDCOUPLING_EXPORT double getTimeTolerance() const { return _time_tolerance; }
93 MEDCOUPLING_EXPORT virtual void checkNoTimePresence() const = 0;
94 MEDCOUPLING_EXPORT virtual void checkTimePresence(double time) const = 0;
95 MEDCOUPLING_EXPORT virtual void setArray(DataArrayDouble *array, TimeLabel *owner);
96 MEDCOUPLING_EXPORT virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner);
97 MEDCOUPLING_EXPORT virtual void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner);
98 MEDCOUPLING_EXPORT DataArrayDouble *getArray() { return _array; }
99 MEDCOUPLING_EXPORT const DataArrayDouble *getArray() const { return _array; }
100 MEDCOUPLING_EXPORT virtual const DataArrayDouble *getEndArray() const;
101 MEDCOUPLING_EXPORT virtual DataArrayDouble *getEndArray();
102 MEDCOUPLING_EXPORT virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const = 0;
103 MEDCOUPLING_EXPORT virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0;
104 MEDCOUPLING_EXPORT virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const;
105 MEDCOUPLING_EXPORT virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const;
106 MEDCOUPLING_EXPORT virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const;
107 MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { return getStartTime(iteration,order); }
108 MEDCOUPLING_EXPORT virtual double getStartTime(int& iteration, int& order) const = 0;
109 MEDCOUPLING_EXPORT virtual double getEndTime(int& iteration, int& order) const = 0;
110 MEDCOUPLING_EXPORT void setTime(double time, int iteration, int order) { setStartTime(time,iteration,order); }
111 MEDCOUPLING_EXPORT void setIteration(int it) { setStartIteration(it); }
112 MEDCOUPLING_EXPORT void setOrder(int order) { setStartOrder(order); }
113 MEDCOUPLING_EXPORT void setTimeValue(double val) { setStartTimeValue(val); }
114 MEDCOUPLING_EXPORT virtual void setStartIteration(int it) = 0;
115 MEDCOUPLING_EXPORT virtual void setEndIteration(int it) = 0;
116 MEDCOUPLING_EXPORT virtual void setStartOrder(int order) = 0;
117 MEDCOUPLING_EXPORT virtual void setEndOrder(int order) = 0;
118 MEDCOUPLING_EXPORT virtual void setStartTimeValue(double time) = 0;
119 MEDCOUPLING_EXPORT virtual void setEndTimeValue(double time) = 0;
120 MEDCOUPLING_EXPORT virtual void setStartTime(double time, int iteration, int order) = 0;
121 MEDCOUPLING_EXPORT virtual void setEndTime(double time, int iteration, int order) = 0;
122 MEDCOUPLING_EXPORT virtual void getValueOnTime(int eltId, double time, double *value) const = 0;
123 MEDCOUPLING_EXPORT virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const = 0;
125 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const;
126 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *determinant() const;
127 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *eigenValues() const;
128 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *eigenVectors() const;
129 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *inverse() const;
130 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *trace() const;
131 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *deviator() const;
132 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *magnitude() const;
133 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *negate() const;
134 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *maxPerTuple() const;
135 MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const;
136 MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds);
137 MEDCOUPLING_EXPORT virtual void changeNbOfComponents(int newNbOfComp, double dftValue);
138 MEDCOUPLING_EXPORT virtual void sortPerTuple(bool asc);
139 MEDCOUPLING_EXPORT virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
140 MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
141 MEDCOUPLING_EXPORT virtual void applyLin(double a, double b, int compoId);
142 MEDCOUPLING_EXPORT virtual void applyLin(double a, double b);
143 MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
144 MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const std::string& func);
145 MEDCOUPLING_EXPORT virtual void applyFunc2(int nbOfComp, const std::string& func);
146 MEDCOUPLING_EXPORT virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
147 MEDCOUPLING_EXPORT virtual void applyFunc(const std::string& func);
148 MEDCOUPLING_EXPORT virtual void applyFuncFast32(const std::string& func);
149 MEDCOUPLING_EXPORT virtual void applyFuncFast64(const std::string& func);
150 MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func);
151 MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
152 MEDCOUPLING_EXPORT virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
153 MEDCOUPLING_EXPORT virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
155 MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretization();
157 std::string _time_unit;
158 double _time_tolerance;
159 DataArrayDouble *_array;
161 static const double TIME_TOLERANCE_DFT;
164 class MEDCouplingNoTimeLabel : public MEDCouplingTimeDiscretization
167 MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel();
168 MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy);
169 MEDCOUPLING_EXPORT std::string getStringRepr() const;
170 MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
171 MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
172 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
173 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
174 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
175 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
176 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
177 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
178 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
179 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
180 MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
181 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
182 MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
183 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
184 MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
185 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
186 MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
187 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
188 MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
189 MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
190 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
191 MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
192 MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
193 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
194 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
195 MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
196 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
197 MEDCOUPLING_EXPORT void checkNoTimePresence() const { }
198 MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
199 MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
200 MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
201 MEDCOUPLING_EXPORT bool isBefore(const MEDCouplingTimeDiscretization *other) const;
202 MEDCOUPLING_EXPORT bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const;
203 MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const;
204 MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const;
205 MEDCOUPLING_EXPORT void setStartIteration(int it);
206 MEDCOUPLING_EXPORT void setEndIteration(int it);
207 MEDCOUPLING_EXPORT void setStartOrder(int order);
208 MEDCOUPLING_EXPORT void setEndOrder(int order);
209 MEDCOUPLING_EXPORT void setStartTimeValue(double time);
210 MEDCOUPLING_EXPORT void setEndTimeValue(double time);
211 MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order);
212 MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order);
213 MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
214 MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
215 MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
216 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
217 MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
219 static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
220 MEDCOUPLING_EXPORT static const char REPR[];
222 static const char EXCEPTION_MSG[];
225 class MEDCouplingWithTimeStep : public MEDCouplingTimeDiscretization
228 MEDCOUPLING_EXPORT MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy);
230 MEDCOUPLING_EXPORT MEDCouplingWithTimeStep();
231 MEDCOUPLING_EXPORT std::string getStringRepr() const;
232 MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
233 MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
234 MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
235 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
236 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
237 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
238 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
239 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
240 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
241 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
242 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
243 MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
244 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
245 MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
246 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
247 MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
248 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
249 MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
250 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
251 MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
252 MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
253 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
254 MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
255 MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
256 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
257 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
258 MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
259 MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
260 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
261 MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
262 MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
263 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
264 MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
265 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
266 MEDCOUPLING_EXPORT void checkNoTimePresence() const;
267 MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
268 MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _time=time; _iteration=iteration; _order=order; }
269 MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _time=time; _iteration=iteration; _order=order; }
270 MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
271 MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
272 MEDCOUPLING_EXPORT void setStartIteration(int it) { _iteration=it; }
273 MEDCOUPLING_EXPORT void setEndIteration(int it) { _iteration=it; }
274 MEDCOUPLING_EXPORT void setStartOrder(int order) { _order=order; }
275 MEDCOUPLING_EXPORT void setEndOrder(int order) { _order=order; }
276 MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _time=time; }
277 MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _time=time; }
278 MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
279 MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
280 MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
281 MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
283 static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
284 MEDCOUPLING_EXPORT static const char REPR[];
286 static const char EXCEPTION_MSG[];
293 class MEDCouplingConstOnTimeInterval : public MEDCouplingTimeDiscretization
296 MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy);
298 MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval();
299 MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
300 MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
301 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
302 MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
303 MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
304 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
305 MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
306 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
307 MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
308 MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
309 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
310 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
311 MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
312 MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
313 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
314 MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
315 MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
316 MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
317 MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
318 MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
319 MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
320 MEDCOUPLING_EXPORT std::string getStringRepr() const;
321 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
322 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
323 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
324 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
325 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
326 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
327 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
328 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
329 MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
330 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
331 MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
332 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
333 MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
334 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
335 MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
336 MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
337 MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
338 MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _start_time=time; _start_iteration=iteration; _start_order=order; }
339 MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _end_time=time; _end_iteration=iteration; _end_order=order; }
340 MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { iteration=_start_iteration; order=_start_order; return _start_time; }
341 MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { iteration=_end_iteration; order=_end_order; return _end_time; }
342 MEDCOUPLING_EXPORT void setStartIteration(int it) { _start_iteration=it; }
343 MEDCOUPLING_EXPORT void setEndIteration(int it) { _end_iteration=it; }
344 MEDCOUPLING_EXPORT void setStartOrder(int order) { _start_order=order; }
345 MEDCOUPLING_EXPORT void setEndOrder(int order) { _end_order=order; }
346 MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start_time=time; }
347 MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end_time=time; }
348 MEDCOUPLING_EXPORT void checkNoTimePresence() const;
349 MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
351 static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL;
352 MEDCOUPLING_EXPORT static const char REPR[];
354 static const char EXCEPTION_MSG[];
358 int _start_iteration;
364 class MEDCouplingTwoTimeSteps : public MEDCouplingTimeDiscretization
367 MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy);
368 MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps();
369 MEDCOUPLING_EXPORT ~MEDCouplingTwoTimeSteps();
371 MEDCOUPLING_EXPORT void updateTime() const;
372 MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh);
373 MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
374 MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
375 MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
376 MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
377 MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const;
378 MEDCOUPLING_EXPORT DataArrayDouble *getEndArray();
379 MEDCOUPLING_EXPORT void checkCoherency() const;
380 MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
381 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
382 MEDCOUPLING_EXPORT void checkNoTimePresence() const;
383 MEDCOUPLING_EXPORT void checkTimePresence(double time) const;
384 MEDCOUPLING_EXPORT void getArrays(std::vector<DataArrayDouble *>& arrays) const;
385 MEDCOUPLING_EXPORT void setEndArray(DataArrayDouble *array, TimeLabel *owner);
386 MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _start_time=time; _start_iteration=iteration; _start_order=order; }
387 MEDCOUPLING_EXPORT void setEndTime(double time, int iteration, int order) { _end_time=time; _end_iteration=iteration; _end_order=order; }
388 MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { iteration=_start_iteration; order=_start_order; return _start_time; }
389 MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { iteration=_end_iteration; order=_end_order; return _end_time; }
390 MEDCOUPLING_EXPORT void setStartIteration(int it) { _start_iteration=it; }
391 MEDCOUPLING_EXPORT void setEndIteration(int it) { _end_iteration=it; }
392 MEDCOUPLING_EXPORT void setStartOrder(int order) { _start_order=order; }
393 MEDCOUPLING_EXPORT void setEndOrder(int order) { _end_order=order; }
394 MEDCOUPLING_EXPORT void setStartTimeValue(double time) { _start_time=time; }
395 MEDCOUPLING_EXPORT void setEndTimeValue(double time) { _end_time=time; }
396 MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
397 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
398 MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
399 MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
400 MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays);
401 MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
402 MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
403 MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
404 MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
405 MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const;
406 MEDCOUPLING_EXPORT void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner);
408 static const char EXCEPTION_MSG[];
412 int _start_iteration;
416 DataArrayDouble *_end_array;
419 class MEDCouplingLinearTime : public MEDCouplingTwoTimeSteps
422 MEDCOUPLING_EXPORT MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy);
424 MEDCOUPLING_EXPORT MEDCouplingLinearTime();
425 MEDCOUPLING_EXPORT std::string getStringRepr() const;
426 MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
427 MEDCOUPLING_EXPORT void checkCoherency() const;
428 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
429 MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
430 MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
431 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
432 MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
433 MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
434 MEDCOUPLING_EXPORT void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
435 MEDCOUPLING_EXPORT void getValueOnTime(int eltId, double time, double *value) const;
436 MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const;
437 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
438 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
439 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
440 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
441 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
442 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
443 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
444 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
445 MEDCOUPLING_EXPORT void addEqual(const MEDCouplingTimeDiscretization *other);
446 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
447 MEDCOUPLING_EXPORT void substractEqual(const MEDCouplingTimeDiscretization *other);
448 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
449 MEDCOUPLING_EXPORT void multiplyEqual(const MEDCouplingTimeDiscretization *other);
450 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
451 MEDCOUPLING_EXPORT void divideEqual(const MEDCouplingTimeDiscretization *other);
452 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
453 MEDCOUPLING_EXPORT void powEqual(const MEDCouplingTimeDiscretization *other);
455 static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME;
456 MEDCOUPLING_EXPORT static const char REPR[];