Salome HOME
Merge from V6_main (04/10/2012)
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingTimeDiscretization.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __PARAMEDMEM_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
22 #define __PARAMEDMEM_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
23
24 #include "MEDCoupling.hxx"
25 #include "MEDCouplingTimeLabel.hxx"
26 #include "MEDCouplingRefCountObject.hxx"
27 #include "InterpKernelException.hxx"
28
29 #include <vector>
30
31 namespace ParaMEDMEM
32 {
33   class DataArrayDouble;
34   class TimeLabel;
35
36   class MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization : public TimeLabel
37   {
38   protected:
39     MEDCouplingTimeDiscretization();
40     MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy);
41   public:
42     void updateTime() const;
43     static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
44     void setTimeUnit(const char *unit) { _time_unit=unit; }
45     const char *getTimeUnit() const { return _time_unit.c_str(); }
46     virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
47     virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
48     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
49     virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
50     virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
51     virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
52     virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
53     virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
54     virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
55     virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
56     virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
57     virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const;
58     virtual std::string getStringRepr() const = 0;
59     virtual TypeOfTimeDiscretization getEnum() const = 0;
60     virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
61     virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const = 0;
62     virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const = 0;
63     virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const = 0;
64     virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const = 0;
65     virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const = 0;
66     virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const = 0;
67     virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const = 0;
68     virtual void addEqual(const MEDCouplingTimeDiscretization *other) = 0;
69     virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const = 0;
70     virtual void substractEqual(const MEDCouplingTimeDiscretization *other) = 0;
71     virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const = 0;
72     virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) = 0;
73     virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const = 0;
74     virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
75     virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
76     virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
77     virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
78     virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
79     virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
80     virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
81     virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
82     virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
83     virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0;
84     void setTimeTolerance(double val) { _time_tolerance=val; }
85     double getTimeTolerance() const { return _time_tolerance; }
86     virtual void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) = 0;
87     virtual void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception) = 0;
88     virtual void setArray(DataArrayDouble *array, TimeLabel *owner);
89     virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner);
90     virtual void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
91     DataArrayDouble *getArray() { return _array; }
92     const DataArrayDouble *getArray() const { return _array; }
93     virtual const DataArrayDouble *getEndArray() const;
94     virtual DataArrayDouble *getEndArray();
95     virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception) = 0;
96     virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0; 
97     virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const;
98     virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
99     virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
100     double getTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { return getStartTime(iteration,order); }
101     virtual double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) = 0;
102     virtual double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) = 0;
103     void setTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { setStartTime(time,iteration,order); }
104     void setIteration(int it) throw(INTERP_KERNEL::Exception) { setStartIteration(it); }
105     void setOrder(int order) throw(INTERP_KERNEL::Exception) { setStartOrder(order); }
106     void setTimeValue(double val) throw(INTERP_KERNEL::Exception) { setStartTimeValue(val); }
107     virtual void setStartIteration(int it) throw(INTERP_KERNEL::Exception) = 0;
108     virtual void setEndIteration(int it) throw(INTERP_KERNEL::Exception) = 0;
109     virtual void setStartOrder(int order) throw(INTERP_KERNEL::Exception) = 0;
110     virtual void setEndOrder(int order) throw(INTERP_KERNEL::Exception) = 0;
111     virtual void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) = 0;
112     virtual void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) = 0;
113     virtual void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) = 0;
114     virtual void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) = 0;
115     virtual void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception) = 0;
116     virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception) = 0;
117     //
118     virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
119     virtual MEDCouplingTimeDiscretization *determinant() const throw(INTERP_KERNEL::Exception);
120     virtual MEDCouplingTimeDiscretization *eigenValues() const throw(INTERP_KERNEL::Exception);
121     virtual MEDCouplingTimeDiscretization *eigenVectors() const throw(INTERP_KERNEL::Exception);
122     virtual MEDCouplingTimeDiscretization *inverse() const throw(INTERP_KERNEL::Exception);
123     virtual MEDCouplingTimeDiscretization *trace() const throw(INTERP_KERNEL::Exception);
124     virtual MEDCouplingTimeDiscretization *deviator() const throw(INTERP_KERNEL::Exception);
125     virtual MEDCouplingTimeDiscretization *magnitude() const throw(INTERP_KERNEL::Exception);
126     virtual MEDCouplingTimeDiscretization *maxPerTuple() const throw(INTERP_KERNEL::Exception);
127     virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
128     virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
129     virtual void changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception);
130     virtual void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
131     virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
132     virtual void applyLin(double a, double b, int compoId);
133     virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
134     virtual void applyFunc(int nbOfComp, const char *func);
135     virtual void applyFunc2(int nbOfComp, const char *func);
136     virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
137     virtual void applyFunc(const char *func);
138     virtual void applyFuncFast32(const char *func);
139     virtual void applyFuncFast64(const char *func);
140     virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
141     virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
142     virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
143     virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
144     //
145     virtual ~MEDCouplingTimeDiscretization();
146   protected:
147     std::string _time_unit;
148     double _time_tolerance;
149     DataArrayDouble *_array;
150   protected:
151     static const double TIME_TOLERANCE_DFT;
152   };
153
154   class MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel : public MEDCouplingTimeDiscretization
155   {
156   public:
157     MEDCouplingNoTimeLabel();
158     MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy);
159     std::string getStringRepr() const;
160     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
161     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
162     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
163     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
164     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
165     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
166     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
167     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
168     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
169     void addEqual(const MEDCouplingTimeDiscretization *other);
170     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
171     void substractEqual(const MEDCouplingTimeDiscretization *other);
172     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
173     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
174     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
175     void divideEqual(const MEDCouplingTimeDiscretization *other);
176     bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
177     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
178     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
179     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
180     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
181     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
182     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
183     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
184     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) { }
185     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
186     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
187     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
188     bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
189     bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
190     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
191     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
192     void setStartIteration(int it) throw(INTERP_KERNEL::Exception);
193     void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
194     void setStartOrder(int order) throw(INTERP_KERNEL::Exception);
195     void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
196     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception);
197     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception);
198     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
199     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
200     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
201     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
202     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
203     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
204     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
205   public:
206     static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
207     static const char REPR[];
208   private:
209     static const char EXCEPTION_MSG[];
210   };
211
212   class MEDCOUPLING_EXPORT MEDCouplingWithTimeStep : public MEDCouplingTimeDiscretization
213   {
214   protected:
215     MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy);
216   public:
217     MEDCouplingWithTimeStep();
218     std::string getStringRepr() const;
219     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
220     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
221     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
222     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
223     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
224     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
225     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
226     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
227     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
228     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
229     void addEqual(const MEDCouplingTimeDiscretization *other);
230     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
231     void substractEqual(const MEDCouplingTimeDiscretization *other);
232     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
233     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
234     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
235     void divideEqual(const MEDCouplingTimeDiscretization *other);
236     bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
237     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
238     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
239     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
240     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
241     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
242     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
243     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
244     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
245     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
246     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
247     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
248     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
249     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
250     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
251     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
252     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
253     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
254     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_iteration; order=_order; return _time; }
255     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_iteration; order=_order; return _time; }
256     void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _iteration=it; }
257     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _iteration=it; }
258     void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _order=order; }
259     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _order=order; }
260     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
261     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
262     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
263     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
264     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
265     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
266   public:
267     static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
268     static const char REPR[];
269   private:
270     static const char EXCEPTION_MSG[];
271   protected:
272     double _time;
273     int _iteration;
274     int _order;
275   };
276
277   class MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval : public MEDCouplingTimeDiscretization
278   {
279   protected:
280     MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy);
281   public:
282     MEDCouplingConstOnTimeInterval();
283     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
284     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
285     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
286     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
287     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
288     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
289     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
290     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
291     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
292     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
293     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
294     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
295     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
296     bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
297     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
298     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
299     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
300     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
301     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
302     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
303     std::string getStringRepr() const;
304     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
305     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
306     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
307     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
308     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
309     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
310     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
311     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
312     void addEqual(const MEDCouplingTimeDiscretization *other);
313     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
314     void substractEqual(const MEDCouplingTimeDiscretization *other);
315     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
316     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
317     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
318     void divideEqual(const MEDCouplingTimeDiscretization *other);
319     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
320     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
321     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
322     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_end_iteration; order=_end_order; return _end_time; }
323     void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _start_iteration=it; }
324     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _end_iteration=it; }
325     void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _start_order=order; }
326     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
327     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
328     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
329     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
330     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
331   public:
332     static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL;
333     static const char REPR[];
334   private:
335     static const char EXCEPTION_MSG[];
336   protected:
337     double _start_time;
338     double _end_time;
339     int _start_iteration;
340     int _end_iteration;
341     int _start_order;
342     int _end_order;
343   };
344
345   class MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps : public MEDCouplingTimeDiscretization
346   {
347   protected:
348     MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy);
349     MEDCouplingTwoTimeSteps();
350     ~MEDCouplingTwoTimeSteps();
351   public:
352     void updateTime() const;
353     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
354     void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
355     const DataArrayDouble *getEndArray() const;
356     DataArrayDouble *getEndArray();
357     void checkCoherency() const throw(INTERP_KERNEL::Exception);
358     bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
359     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
360     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
361     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
362     void getArrays(std::vector<DataArrayDouble *>& arrays) const;
363     void setEndArray(DataArrayDouble *array, TimeLabel *owner);
364     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
365     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
366     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
367     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_end_iteration; order=_end_order; return _end_time; }
368     void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _start_iteration=it; }
369     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _end_iteration=it; }
370     void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _start_order=order; }
371     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
372     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
373     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
374     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
375     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
376     void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
377     void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
378     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
379     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
380     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
381     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
382     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
383     void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
384   protected:
385     static const char EXCEPTION_MSG[];
386   protected:
387     double _start_time;
388     double _end_time;
389     int _start_iteration;
390     int _end_iteration;
391     int _start_order;
392     int _end_order;
393     DataArrayDouble *_end_array;
394   };
395
396   class MEDCOUPLING_EXPORT MEDCouplingLinearTime : public MEDCouplingTwoTimeSteps
397   {
398   protected:
399     MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy);
400   public:
401     MEDCouplingLinearTime();
402     std::string getStringRepr() const;
403     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
404     void checkCoherency() const throw(INTERP_KERNEL::Exception);
405     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
406     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
407     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
408     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
409     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
410     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
411     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
412     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
413     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
414     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
415     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
416     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
417     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
418     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
419     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
420     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
421     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
422     void addEqual(const MEDCouplingTimeDiscretization *other);
423     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
424     void substractEqual(const MEDCouplingTimeDiscretization *other);
425     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
426     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
427     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
428     void divideEqual(const MEDCouplingTimeDiscretization *other);
429   public:
430     static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME;
431     static const char REPR[];
432   };
433 }
434
435 #endif