1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __PARAMEDMEM_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 MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization : public TimeLabel
40 MEDCouplingTimeDiscretization();
41 MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy);
43 void updateTime() const;
44 virtual std::size_t getHeapMemorySize() const;
45 static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
46 void setTimeUnit(const char *unit) { _time_unit=unit; }
47 const char *getTimeUnit() const { return _time_unit.c_str(); }
48 virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
49 virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
50 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
51 virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
52 virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
53 virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
54 virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
55 virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
56 virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
57 virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
58 virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
59 virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const;
60 virtual std::string getStringRepr() const = 0;
61 virtual TypeOfTimeDiscretization getEnum() const = 0;
62 virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) = 0;
63 virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
64 virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const = 0;
65 virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const = 0;
66 virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const = 0;
67 virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const = 0;
68 virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const = 0;
69 virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const = 0;
70 virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const = 0;
71 virtual void addEqual(const MEDCouplingTimeDiscretization *other) = 0;
72 virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const = 0;
73 virtual void substractEqual(const MEDCouplingTimeDiscretization *other) = 0;
74 virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const = 0;
75 virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) = 0;
76 virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const = 0;
77 virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
78 virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0;
79 virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0;
80 virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
81 virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
82 virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
83 virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
84 virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
85 virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
86 virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
87 virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
88 virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0;
89 void setTimeTolerance(double val) { _time_tolerance=val; }
90 double getTimeTolerance() const { return _time_tolerance; }
91 virtual void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) = 0;
92 virtual void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception) = 0;
93 virtual void setArray(DataArrayDouble *array, TimeLabel *owner);
94 virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner);
95 virtual void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
96 DataArrayDouble *getArray() { return _array; }
97 const DataArrayDouble *getArray() const { return _array; }
98 virtual const DataArrayDouble *getEndArray() const;
99 virtual DataArrayDouble *getEndArray();
100 virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception) = 0;
101 virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0;
102 virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const;
103 virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
104 virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
105 double getTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { return getStartTime(iteration,order); }
106 virtual double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) = 0;
107 virtual double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) = 0;
108 void setTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { setStartTime(time,iteration,order); }
109 void setIteration(int it) throw(INTERP_KERNEL::Exception) { setStartIteration(it); }
110 void setOrder(int order) throw(INTERP_KERNEL::Exception) { setStartOrder(order); }
111 void setTimeValue(double val) throw(INTERP_KERNEL::Exception) { setStartTimeValue(val); }
112 virtual void setStartIteration(int it) throw(INTERP_KERNEL::Exception) = 0;
113 virtual void setEndIteration(int it) throw(INTERP_KERNEL::Exception) = 0;
114 virtual void setStartOrder(int order) throw(INTERP_KERNEL::Exception) = 0;
115 virtual void setEndOrder(int order) throw(INTERP_KERNEL::Exception) = 0;
116 virtual void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) = 0;
117 virtual void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) = 0;
118 virtual void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) = 0;
119 virtual void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) = 0;
120 virtual void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception) = 0;
121 virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception) = 0;
123 virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
124 virtual MEDCouplingTimeDiscretization *determinant() const throw(INTERP_KERNEL::Exception);
125 virtual MEDCouplingTimeDiscretization *eigenValues() const throw(INTERP_KERNEL::Exception);
126 virtual MEDCouplingTimeDiscretization *eigenVectors() const throw(INTERP_KERNEL::Exception);
127 virtual MEDCouplingTimeDiscretization *inverse() const throw(INTERP_KERNEL::Exception);
128 virtual MEDCouplingTimeDiscretization *trace() const throw(INTERP_KERNEL::Exception);
129 virtual MEDCouplingTimeDiscretization *deviator() const throw(INTERP_KERNEL::Exception);
130 virtual MEDCouplingTimeDiscretization *magnitude() const throw(INTERP_KERNEL::Exception);
131 virtual MEDCouplingTimeDiscretization *negate() const throw(INTERP_KERNEL::Exception);
132 virtual MEDCouplingTimeDiscretization *maxPerTuple() const throw(INTERP_KERNEL::Exception);
133 virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
134 virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
135 virtual void changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception);
136 virtual void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
137 virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
138 virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
139 virtual void applyLin(double a, double b, int compoId);
140 virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
141 virtual void applyFunc(int nbOfComp, const char *func);
142 virtual void applyFunc2(int nbOfComp, const char *func);
143 virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
144 virtual void applyFunc(const char *func);
145 virtual void applyFuncFast32(const char *func);
146 virtual void applyFuncFast64(const char *func);
147 virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
148 virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
149 virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
150 virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
152 virtual ~MEDCouplingTimeDiscretization();
154 std::string _time_unit;
155 double _time_tolerance;
156 DataArrayDouble *_array;
158 static const double TIME_TOLERANCE_DFT;
161 class MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel : public MEDCouplingTimeDiscretization
164 MEDCouplingNoTimeLabel();
165 MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy);
166 std::string getStringRepr() const;
167 TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
168 void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
169 MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
170 MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
171 MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
172 MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
173 MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
174 MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
175 MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
176 MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
177 void addEqual(const MEDCouplingTimeDiscretization *other);
178 MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
179 void substractEqual(const MEDCouplingTimeDiscretization *other);
180 MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
181 void multiplyEqual(const MEDCouplingTimeDiscretization *other);
182 MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
183 void divideEqual(const MEDCouplingTimeDiscretization *other);
184 MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
185 void powEqual(const MEDCouplingTimeDiscretization *other);
186 bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
187 bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
188 bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
189 bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
190 bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
191 bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
192 bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
193 MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
194 void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) { }
195 void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
196 std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
197 void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
198 bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
199 bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
200 double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
201 double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
202 void setStartIteration(int it) throw(INTERP_KERNEL::Exception);
203 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
204 void setStartOrder(int order) throw(INTERP_KERNEL::Exception);
205 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
206 void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception);
207 void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception);
208 void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
209 void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
210 void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
211 void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
212 void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
213 void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
214 void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
216 static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
217 static const char REPR[];
219 static const char EXCEPTION_MSG[];
222 class MEDCOUPLING_EXPORT MEDCouplingWithTimeStep : public MEDCouplingTimeDiscretization
225 MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy);
227 MEDCouplingWithTimeStep();
228 std::string getStringRepr() const;
229 void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
230 TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
231 void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
232 MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
233 MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
234 MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
235 MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
236 MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
237 MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
238 MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
239 MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
240 void addEqual(const MEDCouplingTimeDiscretization *other);
241 MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
242 void substractEqual(const MEDCouplingTimeDiscretization *other);
243 MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
244 void multiplyEqual(const MEDCouplingTimeDiscretization *other);
245 MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
246 void divideEqual(const MEDCouplingTimeDiscretization *other);
247 MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
248 void powEqual(const MEDCouplingTimeDiscretization *other);
249 bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
250 bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
251 bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
252 bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
253 bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
254 bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
255 bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
256 void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
257 void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
258 void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
259 void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
260 void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
261 void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
262 MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
263 void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
264 void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
265 void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
266 void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
267 double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_iteration; order=_order; return _time; }
268 double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_iteration; order=_order; return _time; }
269 void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _iteration=it; }
270 void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _iteration=it; }
271 void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _order=order; }
272 void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _order=order; }
273 void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
274 void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
275 std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
276 void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
277 void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
278 void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
280 static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
281 static const char REPR[];
283 static const char EXCEPTION_MSG[];
290 class MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval : public MEDCouplingTimeDiscretization
293 MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy);
295 MEDCouplingConstOnTimeInterval();
296 void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
297 void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
298 void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
299 void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
300 void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
301 void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
302 void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
303 MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
304 bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
305 bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
306 bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
307 bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
308 bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
309 bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
310 bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
311 std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
312 void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
313 void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
314 void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
315 TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
316 void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
317 std::string getStringRepr() const;
318 MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
319 MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
320 MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
321 MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
322 MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
323 MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
324 MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
325 MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
326 void addEqual(const MEDCouplingTimeDiscretization *other);
327 MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
328 void substractEqual(const MEDCouplingTimeDiscretization *other);
329 MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
330 void multiplyEqual(const MEDCouplingTimeDiscretization *other);
331 MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
332 void divideEqual(const MEDCouplingTimeDiscretization *other);
333 MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
334 void powEqual(const MEDCouplingTimeDiscretization *other);
335 void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
336 void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
337 double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
338 double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_end_iteration; order=_end_order; return _end_time; }
339 void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _start_iteration=it; }
340 void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _end_iteration=it; }
341 void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _start_order=order; }
342 void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
343 void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
344 void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
345 void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
346 void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
348 static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL;
349 static const char REPR[];
351 static const char EXCEPTION_MSG[];
355 int _start_iteration;
361 class MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps : public MEDCouplingTimeDiscretization
364 MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy);
365 MEDCouplingTwoTimeSteps();
366 ~MEDCouplingTwoTimeSteps();
368 void updateTime() const;
369 void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
370 std::size_t getHeapMemorySize() const;
371 void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
372 void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
373 const DataArrayDouble *getEndArray() const;
374 DataArrayDouble *getEndArray();
375 void checkCoherency() const throw(INTERP_KERNEL::Exception);
376 bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
377 bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
378 void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
379 void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
380 void getArrays(std::vector<DataArrayDouble *>& arrays) const;
381 void setEndArray(DataArrayDouble *array, TimeLabel *owner);
382 void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
383 void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
384 double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
385 double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_end_iteration; order=_end_order; return _end_time; }
386 void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _start_iteration=it; }
387 void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _end_iteration=it; }
388 void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _start_order=order; }
389 void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
390 void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
391 void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
392 void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
393 void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
394 void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
395 void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
396 void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
397 void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
398 void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
399 void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
400 std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
401 void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
403 static const char EXCEPTION_MSG[];
407 int _start_iteration;
411 DataArrayDouble *_end_array;
414 class MEDCOUPLING_EXPORT MEDCouplingLinearTime : public MEDCouplingTwoTimeSteps
417 MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy);
419 MEDCouplingLinearTime();
420 std::string getStringRepr() const;
421 TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
422 void checkCoherency() const throw(INTERP_KERNEL::Exception);
423 MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
424 bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
425 bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
426 bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
427 bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
428 bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
429 void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
430 void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
431 void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
432 MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
433 MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
434 MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
435 MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
436 MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
437 MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
438 MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
439 MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
440 void addEqual(const MEDCouplingTimeDiscretization *other);
441 MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
442 void substractEqual(const MEDCouplingTimeDiscretization *other);
443 MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
444 void multiplyEqual(const MEDCouplingTimeDiscretization *other);
445 MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
446 void divideEqual(const MEDCouplingTimeDiscretization *other);
447 MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
448 void powEqual(const MEDCouplingTimeDiscretization *other);
450 static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME;
451 static const char REPR[];