Back to index

salome-med  6.5.0
MEDCouplingTimeDiscretization.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __PARAMEDMEM_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
00022 
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingTimeLabel.hxx"
00025 #include "MEDCouplingRefCountObject.hxx"
00026 #include "InterpKernelException.hxx"
00027 
00028 #include <vector>
00029 
00030 namespace ParaMEDMEM
00031 {
00032   class DataArrayDouble;
00033   class TimeLabel;
00034 
00035   class MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization : public TimeLabel
00036   {
00037   protected:
00038     MEDCouplingTimeDiscretization();
00039     MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy);
00040   public:
00041     void updateTime() const;
00042     static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
00043     void setTimeUnit(const char *unit) { _time_unit=unit; }
00044     const char *getTimeUnit() const { return _time_unit.c_str(); }
00045     virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
00046     virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
00047     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
00048     virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
00049     virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const;
00050     virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
00051     virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
00052     virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
00053     virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
00054     virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
00055     virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const;
00056     virtual std::string getStringRepr() const = 0;
00057     virtual TypeOfTimeDiscretization getEnum() const = 0;
00058     virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
00059     virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const = 0;
00060     virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const = 0;
00061     virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const = 0;
00062     virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const = 0;
00063     virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const = 0;
00064     virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const = 0;
00065     virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const = 0;
00066     virtual void addEqual(const MEDCouplingTimeDiscretization *other) = 0;
00067     virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const = 0;
00068     virtual void substractEqual(const MEDCouplingTimeDiscretization *other) = 0;
00069     virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const = 0;
00070     virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) = 0;
00071     virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const = 0;
00072     virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
00073     virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00074     virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
00075     virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
00076     virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
00077     virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
00078     virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
00079     virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
00080     virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
00081     virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0;
00082     void setTimeTolerance(double val) { _time_tolerance=val; }
00083     double getTimeTolerance() const { return _time_tolerance; }
00084     virtual void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) = 0;
00085     virtual void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception) = 0;
00086     virtual void setArray(DataArrayDouble *array, TimeLabel *owner);
00087     virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner);
00088     virtual void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
00089     DataArrayDouble *getArray() { return _array; }
00090     const DataArrayDouble *getArray() const { return _array; }
00091     virtual const DataArrayDouble *getEndArray() const;
00092     virtual DataArrayDouble *getEndArray();
00093     virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception) = 0;
00094     virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0; 
00095     virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const;
00096     virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
00097     virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
00098     double getTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { return getStartTime(iteration,order); }
00099     virtual double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) = 0;
00100     virtual double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) = 0;
00101     void setTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { setStartTime(time,iteration,order); }
00102     void setIteration(int it) throw(INTERP_KERNEL::Exception) { setStartIteration(it); }
00103     void setOrder(int order) throw(INTERP_KERNEL::Exception) { setStartOrder(order); }
00104     void setTimeValue(double val) throw(INTERP_KERNEL::Exception) { setStartTimeValue(val); }
00105     virtual void setStartIteration(int it) throw(INTERP_KERNEL::Exception) = 0;
00106     virtual void setEndIteration(int it) throw(INTERP_KERNEL::Exception) = 0;
00107     virtual void setStartOrder(int order) throw(INTERP_KERNEL::Exception) = 0;
00108     virtual void setEndOrder(int order) throw(INTERP_KERNEL::Exception) = 0;
00109     virtual void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) = 0;
00110     virtual void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) = 0;
00111     virtual void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) = 0;
00112     virtual void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) = 0;
00113     virtual void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception) = 0;
00114     virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception) = 0;
00115     //
00116     virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
00117     virtual MEDCouplingTimeDiscretization *determinant() const throw(INTERP_KERNEL::Exception);
00118     virtual MEDCouplingTimeDiscretization *eigenValues() const throw(INTERP_KERNEL::Exception);
00119     virtual MEDCouplingTimeDiscretization *eigenVectors() const throw(INTERP_KERNEL::Exception);
00120     virtual MEDCouplingTimeDiscretization *inverse() const throw(INTERP_KERNEL::Exception);
00121     virtual MEDCouplingTimeDiscretization *trace() const throw(INTERP_KERNEL::Exception);
00122     virtual MEDCouplingTimeDiscretization *deviator() const throw(INTERP_KERNEL::Exception);
00123     virtual MEDCouplingTimeDiscretization *magnitude() const throw(INTERP_KERNEL::Exception);
00124     virtual MEDCouplingTimeDiscretization *maxPerTuple() const throw(INTERP_KERNEL::Exception);
00125     virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
00126     virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
00127     virtual void changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception);
00128     virtual void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
00129     virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
00130     virtual void applyLin(double a, double b, int compoId);
00131     virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
00132     virtual void applyFunc(int nbOfComp, const char *func);
00133     virtual void applyFunc2(int nbOfComp, const char *func);
00134     virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
00135     virtual void applyFunc(const char *func);
00136     virtual void applyFuncFast32(const char *func);
00137     virtual void applyFuncFast64(const char *func);
00138     virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
00139     virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00140     virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00141     virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
00142     //
00143     virtual ~MEDCouplingTimeDiscretization();
00144   protected:
00145     std::string _time_unit;
00146     double _time_tolerance;
00147     DataArrayDouble *_array;
00148   protected:
00149     static const double TIME_TOLERANCE_DFT;
00150   };
00151 
00152   class MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel : public MEDCouplingTimeDiscretization
00153   {
00154   public:
00155     MEDCouplingNoTimeLabel();
00156     MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy);
00157     std::string getStringRepr() const;
00158     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
00159     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
00160     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
00161     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
00162     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
00163     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
00164     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
00165     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
00166     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
00167     void addEqual(const MEDCouplingTimeDiscretization *other);
00168     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
00169     void substractEqual(const MEDCouplingTimeDiscretization *other);
00170     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
00171     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
00172     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
00173     void divideEqual(const MEDCouplingTimeDiscretization *other);
00174     bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
00175     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
00176     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
00177     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const;
00178     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
00179     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
00180     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
00181     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
00182     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) { }
00183     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
00184     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
00185     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
00186     bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
00187     bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
00188     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
00189     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
00190     void setStartIteration(int it) throw(INTERP_KERNEL::Exception);
00191     void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
00192     void setStartOrder(int order) throw(INTERP_KERNEL::Exception);
00193     void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
00194     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception);
00195     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception);
00196     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
00197     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
00198     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
00199     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
00200     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
00201     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
00202     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
00203   public:
00204     static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
00205     static const char REPR[];
00206   private:
00207     static const char EXCEPTION_MSG[];
00208   };
00209 
00210   class MEDCOUPLING_EXPORT MEDCouplingWithTimeStep : public MEDCouplingTimeDiscretization
00211   {
00212   protected:
00213     MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy);
00214   public:
00215     MEDCouplingWithTimeStep();
00216     std::string getStringRepr() const;
00217     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
00218     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
00219     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
00220     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
00221     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
00222     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
00223     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
00224     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
00225     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
00226     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
00227     void addEqual(const MEDCouplingTimeDiscretization *other);
00228     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
00229     void substractEqual(const MEDCouplingTimeDiscretization *other);
00230     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
00231     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
00232     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
00233     void divideEqual(const MEDCouplingTimeDiscretization *other);
00234     bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
00235     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
00236     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
00237     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const;
00238     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
00239     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
00240     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
00241     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00242     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
00243     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
00244     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
00245     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
00246     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
00247     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
00248     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
00249     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
00250     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
00251     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
00252     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_iteration; order=_order; return _time; }
00253     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_iteration; order=_order; return _time; }
00254     void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _iteration=it; }
00255     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _iteration=it; }
00256     void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _order=order; }
00257     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _order=order; }
00258     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
00259     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
00260     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
00261     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
00262     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
00263     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
00264   public:
00265     static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
00266     static const char REPR[];
00267   private:
00268     static const char EXCEPTION_MSG[];
00269   protected:
00270     double _time;
00271     int _iteration;
00272     int _order;
00273   };
00274 
00275   class MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval : public MEDCouplingTimeDiscretization
00276   {
00277   protected:
00278     MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy);
00279   public:
00280     MEDCouplingConstOnTimeInterval();
00281     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
00282     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00283     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
00284     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
00285     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
00286     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
00287     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
00288     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
00289     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
00290     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const;
00291     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
00292     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
00293     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
00294     bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
00295     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
00296     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
00297     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
00298     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
00299     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
00300     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
00301     std::string getStringRepr() const;
00302     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
00303     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
00304     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
00305     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
00306     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
00307     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
00308     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
00309     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
00310     void addEqual(const MEDCouplingTimeDiscretization *other);
00311     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
00312     void substractEqual(const MEDCouplingTimeDiscretization *other);
00313     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
00314     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
00315     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
00316     void divideEqual(const MEDCouplingTimeDiscretization *other);
00317     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
00318     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
00319     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
00320     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_end_iteration; order=_end_order; return _end_time; }
00321     void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _start_iteration=it; }
00322     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _end_iteration=it; }
00323     void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _start_order=order; }
00324     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
00325     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
00326     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
00327     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
00328     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
00329   public:
00330     static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL;
00331     static const char REPR[];
00332   private:
00333     static const char EXCEPTION_MSG[];
00334   protected:
00335     double _start_time;
00336     double _end_time;
00337     int _start_iteration;
00338     int _end_iteration;
00339     int _start_order;
00340     int _end_order;
00341   };
00342 
00343   class MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps : public MEDCouplingTimeDiscretization
00344   {
00345   protected:
00346     MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy);
00347     MEDCouplingTwoTimeSteps();
00348     ~MEDCouplingTwoTimeSteps();
00349   public:
00350     void updateTime() const;
00351     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
00352     void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
00353     const DataArrayDouble *getEndArray() const;
00354     DataArrayDouble *getEndArray();
00355     void checkCoherency() const throw(INTERP_KERNEL::Exception);
00356     bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
00357     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
00358     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
00359     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
00360     void getArrays(std::vector<DataArrayDouble *>& arrays) const;
00361     void setEndArray(DataArrayDouble *array, TimeLabel *owner);
00362     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
00363     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
00364     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
00365     double getEndTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_end_iteration; order=_end_order; return _end_time; }
00366     void setStartIteration(int it) throw(INTERP_KERNEL::Exception) { _start_iteration=it; }
00367     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _end_iteration=it; }
00368     void setStartOrder(int order) throw(INTERP_KERNEL::Exception) { _start_order=order; }
00369     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
00370     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
00371     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
00372     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00373     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
00374     void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
00375     void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
00376     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
00377     void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
00378     void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
00379     void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
00380     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
00381     void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
00382   protected:
00383     static const char EXCEPTION_MSG[];
00384   protected:
00385     double _start_time;
00386     double _end_time;
00387     int _start_iteration;
00388     int _end_iteration;
00389     int _start_order;
00390     int _end_order;
00391     DataArrayDouble *_end_array;
00392   };
00393 
00394   class MEDCOUPLING_EXPORT MEDCouplingLinearTime : public MEDCouplingTwoTimeSteps
00395   {
00396   protected:
00397     MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy);
00398   public:
00399     MEDCouplingLinearTime();
00400     std::string getStringRepr() const;
00401     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
00402     void checkCoherency() const throw(INTERP_KERNEL::Exception);
00403     MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
00404     bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
00405     bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const;
00406     bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
00407     bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
00408     bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
00409     void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
00410     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
00411     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
00412     MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
00413     MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
00414     MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
00415     MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
00416     MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
00417     MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
00418     MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
00419     MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
00420     void addEqual(const MEDCouplingTimeDiscretization *other);
00421     MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
00422     void substractEqual(const MEDCouplingTimeDiscretization *other);
00423     MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
00424     void multiplyEqual(const MEDCouplingTimeDiscretization *other);
00425     MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
00426     void divideEqual(const MEDCouplingTimeDiscretization *other);
00427   public:
00428     static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME;
00429     static const char REPR[];
00430   };
00431 }
00432 
00433 #endif