+ class MEDCouplingTimeKeeper
+ {
+ public:
+ MEDCOUPLING_EXPORT MEDCouplingTimeKeeper():_time(0.),_iteration(-1),_order(-1) { }
+ MEDCOUPLING_EXPORT double getAllInfo(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
+ MEDCOUPLING_EXPORT void setAllInfo(double time, int iteration, int order) { _time=time; _iteration=iteration; _order=order; }
+ MEDCOUPLING_EXPORT int getIteration() const { return _iteration; }
+ MEDCOUPLING_EXPORT void setIteration(int it) { _iteration=it; }
+ MEDCOUPLING_EXPORT int getOrder() const { return _order; }
+ MEDCOUPLING_EXPORT void setOrder(int order) { _order=order; }
+ MEDCOUPLING_EXPORT double getTimeValue() const { return _time; }
+ MEDCOUPLING_EXPORT void setTimeValue(double time) { _time=time; }
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeKeeper& other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingTimeKeeper& other, double prec) const;
+ MEDCOUPLING_EXPORT void copyFrom(const MEDCouplingTimeKeeper& other);
+ MEDCOUPLING_EXPORT void checkTimePresence(double time, double eps) const;
+ private:
+ double _time;
+ int _iteration;
+ int _order;
+ };
+
+ class MEDCouplingTimeDiscretization : public MEDCouplingTimeDiscretizationTemplate<double>
+ {
+ protected:
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization() { }
+ MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCopy):MEDCouplingTimeDiscretizationTemplate<double>(other,deepCopy) { }
+ public:
+ MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
+ MEDCOUPLING_EXPORT virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec) const;
+ MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<double> *other, double prec, std::string& reason) const;
+ MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const;
+ MEDCOUPLING_EXPORT virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual void addEqual(const MEDCouplingTimeDiscretization *other) = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual void substractEqual(const MEDCouplingTimeDiscretization *other) = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0;
+ MEDCOUPLING_EXPORT virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0;
+ MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
+ MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
+ MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
+ MEDCOUPLING_EXPORT virtual void checkNoTimePresence() const = 0;
+ MEDCOUPLING_EXPORT virtual void checkTimePresence(double time) const = 0;
+ MEDCOUPLING_EXPORT virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const = 0;
+ MEDCOUPLING_EXPORT virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0;
+ MEDCOUPLING_EXPORT virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const;
+ MEDCOUPLING_EXPORT virtual void getValueOnTime(int eltId, double time, double *value) const = 0;
+ MEDCOUPLING_EXPORT virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const = 0;
+ //
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *computeVectorFieldCyl(const DataArrayDouble *coords, const double center[3], const double vect[3]) const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *determinant() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *eigenValues() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *eigenVectors() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *inverse() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *trace() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *deviator() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *magnitude() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *negate() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *maxPerTuple() const;
+ MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const;
+ MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds);
+ MEDCOUPLING_EXPORT virtual void changeNbOfComponents(int newNbOfComp, double dftValue);
+ MEDCOUPLING_EXPORT virtual void sortPerTuple(bool asc);
+ MEDCOUPLING_EXPORT virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
+ MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
+ MEDCOUPLING_EXPORT virtual void applyLin(double a, double b, int compoId);
+ MEDCOUPLING_EXPORT virtual void applyLin(double a, double b);
+ MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
+ MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const std::string& func);
+ MEDCOUPLING_EXPORT virtual void applyFuncCompo(int nbOfComp, const std::string& func);
+ MEDCOUPLING_EXPORT virtual void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
+ MEDCOUPLING_EXPORT virtual void applyFunc(const std::string& func);
+ MEDCOUPLING_EXPORT virtual void applyFuncFast32(const std::string& func);
+ MEDCOUPLING_EXPORT virtual void applyFuncFast64(const std::string& func);
+ MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func);
+ MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
+ MEDCOUPLING_EXPORT virtual void fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
+ MEDCOUPLING_EXPORT virtual void fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
+ };
+
+ template<class T>
+ class MEDCouplingTimeDiscretizationSimple : public MEDCouplingTimeDiscretizationTemplate<T>
+ {
+ public:
+ std::string getStringRepr() const;
+ double getStartTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); }
+ void setStartIteration(int it) { _tk.setIteration(it); }
+ void setStartOrder(int order) { _tk.setOrder(order); }
+ void setStartTimeValue(double time) { _tk.setTimeValue(time); }
+ void setStartTime(double time, int iteration, int order) { _tk.setAllInfo(time,iteration,order); }
+ double getEndTime(int& iteration, int& order) const;
+ void setEndIteration(int it);
+ void setEndOrder(int order);
+ void setEndTimeValue(double time);
+ void setEndTime(double time, int iteration, int order);
+ TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+ protected:
+ MEDCouplingTimeDiscretizationSimple(const MEDCouplingTimeDiscretizationSimple<T>& other, bool deepCopy);
+ MEDCouplingTimeDiscretizationSimple() { }
+ protected:
+ MEDCouplingTimeKeeper _tk;
+ private:
+ MEDCOUPLING_EXPORT static const char REPR[];
+ protected:
+ static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
+ };
+
+ class MEDCouplingTimeDiscretizationInt : public MEDCouplingTimeDiscretizationSimple<int>
+ {
+ public:
+ MEDCouplingTimeDiscretizationInt() { }
+ MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy);
+ static MEDCouplingTimeDiscretizationInt *New(TypeOfTimeDiscretization type);
+ MEDCouplingTimeDiscretizationInt *performCopyOrIncrRef(bool deepCopy) const;
+ bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec, std::string& reason) const;
+ bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec) const;
+ };
+
+ class MEDCouplingTimeDiscretizationFloat : public MEDCouplingTimeDiscretizationSimple<float>
+ {
+ public:
+ MEDCouplingTimeDiscretizationFloat() { }
+ MEDCouplingTimeDiscretizationFloat(const MEDCouplingTimeDiscretizationFloat& other, bool deepCopy);
+ static MEDCouplingTimeDiscretizationFloat *New(TypeOfTimeDiscretization type);
+ MEDCouplingTimeDiscretizationFloat *performCopyOrIncrRef(bool deepCopy) const;
+ bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec, std::string& reason) const;
+ bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec) const;
+ private:
+ static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
+ };
+