1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
22 #define __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
24 #include "MEDCouplingRefCountObject.hxx"
25 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
27 #include "InterpKernelException.hxx"
34 class MEDCouplingFieldDouble;
36 class MEDCouplingDefinitionTimeSlice : public RefCountObject
39 MEDCOUPLING_EXPORT static MEDCouplingDefinitionTimeSlice *New(const MEDCouplingFieldDouble *f, int meshId, const std::vector<int>& arrId, int fieldId);
40 MEDCOUPLING_EXPORT static MEDCouplingDefinitionTimeSlice *New(TypeOfTimeDiscretization type, const std::vector<int>& tiI, const std::vector<double>& tiD);
41 MEDCOUPLING_EXPORT int getArrayId() const { return _array_id; }
42 MEDCOUPLING_EXPORT virtual MEDCouplingDefinitionTimeSlice *copy() const = 0;
43 MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
44 MEDCOUPLING_EXPORT virtual void getHotSpotsTime(std::vector<double>& ret) const = 0;
45 MEDCOUPLING_EXPORT virtual void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const = 0;
46 MEDCOUPLING_EXPORT virtual bool isContaining(double tmp, double eps) const = 0;
47 MEDCOUPLING_EXPORT virtual int getStartId() const;
48 MEDCOUPLING_EXPORT virtual int getEndId() const;
49 MEDCOUPLING_EXPORT virtual void appendRepr(std::ostream& stream) const;
50 MEDCOUPLING_EXPORT virtual double getStartTime() const = 0;
51 MEDCOUPLING_EXPORT virtual double getEndTime() const = 0;
52 MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const = 0;
53 MEDCOUPLING_EXPORT virtual TypeOfTimeDiscretization getTimeType() const = 0;
54 MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
55 MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
56 MEDCOUPLING_EXPORT bool isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
57 MEDCOUPLING_EXPORT bool isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
58 MEDCOUPLING_EXPORT bool isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
59 MEDCOUPLING_EXPORT bool isBeforeMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
61 MEDCOUPLING_EXPORT MEDCouplingDefinitionTimeSlice() { }
62 MEDCOUPLING_EXPORT MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId);
69 class MEDCouplingDefinitionTimeSliceInst : public MEDCouplingDefinitionTimeSlice
72 static MEDCouplingDefinitionTimeSliceInst *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
73 MEDCouplingDefinitionTimeSlice *copy() const;
74 bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
75 void getHotSpotsTime(std::vector<double>& ret) const;
76 void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
77 bool isContaining(double tmp, double eps) const;
78 void appendRepr(std::ostream& stream) const;
79 double getStartTime() const;
80 double getEndTime() const;
81 void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
82 void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
83 TypeOfTimeDiscretization getTimeType() const;
85 MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId);
87 MEDCouplingDefinitionTimeSliceInst() { }
92 class MEDCouplingDefinitionTimeSliceCstOnTI : public MEDCouplingDefinitionTimeSlice
95 static MEDCouplingDefinitionTimeSliceCstOnTI *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
96 MEDCouplingDefinitionTimeSlice *copy() const;
97 bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
98 void getHotSpotsTime(std::vector<double>& ret) const;
99 void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
100 bool isContaining(double tmp, double eps) const;
101 void appendRepr(std::ostream& stream) const;
102 double getStartTime() const;
103 double getEndTime() const;
104 void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
105 void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
106 TypeOfTimeDiscretization getTimeType() const;
108 MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId);
110 MEDCouplingDefinitionTimeSliceCstOnTI() { }
116 class MEDCouplingDefinitionTimeSliceLT : public MEDCouplingDefinitionTimeSlice
119 static MEDCouplingDefinitionTimeSliceLT *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
120 MEDCouplingDefinitionTimeSlice *copy() const;
121 bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
122 void getHotSpotsTime(std::vector<double>& ret) const;
123 void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
124 bool isContaining(double tmp, double eps) const;
125 void appendRepr(std::ostream& stream) const;
126 double getStartTime() const;
127 double getEndTime() const;
128 int getEndId() const;
129 void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
130 void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
131 TypeOfTimeDiscretization getTimeType() const;
133 MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId);
135 MEDCouplingDefinitionTimeSliceLT() { }
142 class MEDCouplingDefinitionTime
145 MEDCOUPLING_EXPORT MEDCouplingDefinitionTime();
146 MEDCOUPLING_EXPORT MEDCouplingDefinitionTime(const std::vector<const MEDCouplingFieldDouble *>& fs, const std::vector<int>& meshRefs, const std::vector<std::vector<int> >& arrRefs);
147 MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
148 MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
149 MEDCOUPLING_EXPORT void assign(const MEDCouplingDefinitionTime& other);
150 MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingDefinitionTime& other) const;
151 MEDCOUPLING_EXPORT double getTimeResolution() const { return _eps; }
152 MEDCOUPLING_EXPORT void getIdsOnTimeRight(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
153 MEDCOUPLING_EXPORT void getIdsOnTimeLeft(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const;
154 MEDCOUPLING_EXPORT void getIdsOnTime(double tm, std::vector<int>& meshIds, std::vector<int>& arrIds, std::vector<int>& arrIdsInField, std::vector<int>& fieldIds) const;
155 MEDCOUPLING_EXPORT std::vector<double> getHotSpotsTime() const;
156 MEDCOUPLING_EXPORT void appendRepr(std::ostream& stream) const;
158 MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<int>& tinyInfoI, std::vector<double>& tinyInfoD) const;
159 MEDCOUPLING_EXPORT void unserialize(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
162 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> > _slices;
163 static const double EPS_DFT;