]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/MEDLoader/MEDFileField.hxx
Salome HOME
8995fc045394d72d79769444b27ec0ed0fa1b72d
[tools/medcoupling.git] / src / MEDLoader / MEDFileField.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 __MEDFILEFIELD_HXX__
22 #define __MEDFILEFIELD_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25
26 #include "MEDFileFieldOverView.hxx"
27 #include "MEDFileUtilities.txx"
28 #include "MEDFileEntities.hxx"
29
30 #include "MCAuto.hxx"
31 #include "MEDLoaderTraits.hxx"
32 #include "MEDCouplingTraits.hxx"
33 #include "MEDCouplingRefCountObject.hxx"
34 #include "MEDCouplingFieldInt.hxx"
35 #include "MEDCouplingMemArray.hxx"
36
37 #include "NormalizedUnstructuredMesh.hxx"
38 #include "InterpKernelException.hxx"
39
40 #include <vector>
41 #include <string>
42 #include <list>
43 #include <set>
44
45 #include "med.h"
46
47 namespace MEDCoupling
48 {
49   class MEDFileFieldGlobs;
50   class MEDCouplingMesh;
51   class MEDCouplingFieldDouble;
52   class MEDFileMesh;
53
54   class MEDFileFieldLoc : public RefCountObject
55   {
56   public:
57     MEDLOADER_EXPORT void simpleRepr(std::ostream& oss) const;
58     MEDLOADER_EXPORT std::string getName() const { return _name; }
59     MEDLOADER_EXPORT void setName(const std::string& name);
60     static MEDFileFieldLoc *New(med_idt fid, const std::string& locName);
61     static MEDFileFieldLoc *New(med_idt fid, int id);
62     static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
63     std::size_t getHeapMemorySizeWithoutChildren() const;
64     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
65     MEDFileFieldLoc *deepCopy() const;
66     MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
67     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
68     MEDLOADER_EXPORT std::string repr() const;
69     MEDLOADER_EXPORT bool isName(const std::string& name) const { return _name==name; }
70     MEDLOADER_EXPORT int getDimension() const { return _dim; }
71     MEDLOADER_EXPORT int getNumberOfGaussPoints() const { return _nb_gauss_pt; }
72     MEDLOADER_EXPORT int getNumberOfPointsInCells() const { return _nb_node_per_cell; }
73     MEDLOADER_EXPORT const std::vector<double>& getRefCoords() const { return _ref_coo; }
74     MEDLOADER_EXPORT const std::vector<double>& getGaussCoords() const { return _gs_coo; }
75     MEDLOADER_EXPORT const std::vector<double>& getGaussWeights() const { return _w; }
76     MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; }
77     MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const;
78   private:
79     MEDFileFieldLoc(med_idt fid, const std::string& locName);
80     MEDFileFieldLoc(med_idt fid, int id);
81     MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
82   private:
83     int _dim;
84     int _nb_gauss_pt;
85     int _nb_node_per_cell;
86     std::string _name;
87     INTERP_KERNEL::NormalizedCellType _geo_type;
88     std::vector<double> _ref_coo;
89     std::vector<double> _gs_coo;
90     std::vector<double> _w;
91   };
92
93   /// @cond INTERNAL
94   class MEDFileAnyTypeField1TSWithoutSDA;
95   class MEDFileFieldPerMeshPerTypeCommon;
96   class MEDFileFieldPerMeshPerType;
97   class MEDFileField1TSWithoutSDA;
98   class MEDFileFieldNameScope;
99   class MEDFileFieldGlobsReal;
100   class MEDFileFieldPerMesh;
101   class PartDefinition;
102
103   class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
104   {
105   public:
106     static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
107     static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId);
108     static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
109     std::size_t getHeapMemorySizeWithoutChildren() const;
110     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
111     MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
112     void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
113     void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
114     void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
115     void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const;
116     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
117     const MEDFileFieldPerMeshPerTypeCommon *getFather() const;
118     void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc);
119     void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc);
120     void setNewStart(int newValueOfStart);
121     int getIteration() const;
122     int getOrder() const;
123     double getTime() const;
124     std::string getMeshName() const;
125     TypeOfField getType() const;
126     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
127     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
128     void setType(TypeOfField newType);
129     INTERP_KERNEL::NormalizedCellType getGeoType() const;
130     int getNumberOfComponents() const;
131     int getNumberOfTuples() const;
132     int getStart() const { return _start; }
133     int getEnd() const { return _end; }
134     int getNumberOfVals() const { return _nval; }
135     DataArray *getOrCreateAndGetArray();
136     const DataArray *getOrCreateAndGetArray() const;
137     const std::vector<std::string>& getInfo() const;
138     std::string getProfile() const;
139     void setProfile(const std::string& newPflName);
140     std::string getLocalization() const;
141     void setLocalization(const std::string& newLocName);
142     int getLocId() const { return _loc_id; }
143     void setLocId(int newId) const { _loc_id=newId; }
144     void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; }
145     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
146     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
147     void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
148                          std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
149     void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
150     int fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const;
151     int fillTupleIds(int *ptToFill) const;
152     static int ConvertType(TypeOfField type, int locId);
153     static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
154     static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
155                                const DataArrayInt *explicitIdsInMesh, const std::vector<int>& newCode,
156                                MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result);
157     static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
158                                                                           bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
159                                                                           MEDFileFieldGlobsReal& glob, bool &notInExisting);
160     static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(int &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
161     MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { }
162   private:
163     MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
164     MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy);
165     MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
166     MEDFileFieldPerMeshPerTypePerDisc();
167   private:
168     void goReadZeValuesInFile(med_idt fid, const std::string& fieldName, int nbOfCompo, int iteration, int order, med_entity_type menti, med_geometry_type mgeoti, unsigned char *startFeedingPtr);
169   private:
170     TypeOfField _type;
171     MEDFileFieldPerMeshPerTypeCommon *_father;
172     int _start;
173     int _end;
174     //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
175     int _nval;
176     std::string _profile;
177     std::string _localization;
178     //! only on assignement -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
179     mutable int _loc_id;
180     mutable int _profile_it;
181     MCAuto<PartDefinition> _pd;
182   public:
183     mutable int _tmp_work1;
184   };
185
186   class MEDFileFieldPerMeshPerTypeCommon : public RefCountObject, public MEDFileWritable
187   {
188   public:
189     std::size_t getHeapMemorySizeWithoutChildren() const;
190     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
191     void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
192     void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
193     void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
194     void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
195     const MEDFileFieldPerMesh *getFather() const;
196     void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
197     void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
198     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
199     bool isUniqueLevel(int& dim) const;
200     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
201     void fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
202     int getIteration() const;
203     int getOrder() const;
204     double getTime() const;
205     std::string getMeshName() const;
206     void getSizes(int& globalSz, int& nbOfEntries) const;
207     int getNumberOfComponents() const;
208     bool presenceOfMultiDiscPerGeoType() const;
209     DataArray *getOrCreateAndGetArray();
210     const DataArray *getOrCreateAndGetArray() const;
211     const std::vector<std::string>& getInfo() const;
212     std::vector<std::string> getPflsReallyUsed() const;
213     std::vector<std::string> getLocsReallyUsed() const;
214     std::vector<std::string> getPflsReallyUsedMulti() const;
215     std::vector<std::string> getLocsReallyUsedMulti() const;
216     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
217     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
218     MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId);
219     const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const;
220     int getNumberOfLoc() const { return _field_pm_pt_pd.size(); }
221     void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
222     void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
223     bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
224     bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
225     static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
226     MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { }
227   public:
228     virtual ~MEDFileFieldPerMeshPerTypeCommon();
229     virtual void getDimension(int& dim) const = 0;
230     virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0;
231     virtual void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const = 0;
232     virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0;
233     virtual std::string getGeoTypeRepr() const = 0;
234     virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0;
235     virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
236   protected:
237     void setFather(MEDFileFieldPerMesh *father);
238     void deepCopyElements();
239     std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells);
240     std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells);
241     std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells);
242     std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells);
243   private:
244     MEDFileFieldPerMesh *_father;
245   protected:
246     std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
247   };
248
249   class MEDFileFieldPerMeshPerType : public MEDFileFieldPerMeshPerTypeCommon
250   {
251   public:
252     static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType);
253     static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
254     static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(int &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
255   public:// overload of abstract methods
256     void getDimension(int& dim) const;
257     INTERP_KERNEL::NormalizedCellType getGeoType() const;
258     void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
259     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
260     std::string getGeoTypeRepr() const;
261     MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
262     void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
263   private:
264     MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
265     MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt);
266   private:
267     INTERP_KERNEL::NormalizedCellType _geo_type;
268   };
269
270   class MEDFileFieldPerMeshPerTypeDyn : public MEDFileFieldPerMeshPerTypeCommon
271   {
272   public:
273     static MEDFileFieldPerMeshPerTypeDyn *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileEntities *entities, int idGT, const MEDFileFieldNameScope& nasc);
274     int getDynGT() const;
275   public:
276     void getDimension(int& dim) const;
277     INTERP_KERNEL::NormalizedCellType getGeoType() const;
278     void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
279     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
280     std::string getGeoTypeRepr() const;
281     MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
282     void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
283   private:
284     MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc);
285   private:
286     MCConstAuto<MEDFileStructureElement> _se;
287   };
288   
289   class MEDFileMesh;
290
291   class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
292   {
293   public:
294     static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
295     static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
296     std::size_t getHeapMemorySizeWithoutChildren() const;
297     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
298     MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
299     void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
300     void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
301     void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
302     void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
303     void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
304     void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
305     void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
306     void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
307     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
308     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
309     std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
310     void getDimension(int& dim) const;
311     bool isUniqueLevel(int& dim) const;
312     double getTime() const;
313     int getIteration() const;
314     int getOrder() const;
315     int getMeshIteration() const { return _mesh_iteration; }
316     int getMeshOrder() const { return _mesh_order; }
317     std::string getMeshName() const { return _mesh_name; }
318     int getNumberOfComponents() const;
319     bool presenceOfMultiDiscPerGeoType() const;
320     bool presenceOfStructureElements() const;
321     bool onlyStructureElements() const;
322     void killStructureElements();
323     DataArray *getOrCreateAndGetArray();
324     const DataArray *getOrCreateAndGetArray() const;
325     const std::vector<std::string>& getInfo() const;
326     std::vector<std::string> getPflsReallyUsed() const;
327     std::vector<std::string> getLocsReallyUsed() const;
328     std::vector<std::string> getPflsReallyUsedMulti() const;
329     std::vector<std::string> getLocsReallyUsedMulti() const;
330     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
331     bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
332     void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
333     void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
334     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
335     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
336     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
337     DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
338     void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
339     MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId);
340     const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const;
341     static MCAuto<MEDFileFieldPerMesh> Aggregate(int &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
342   private:
343     int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
344     MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
345                                         const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
346     MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
347                                          const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
348                                          const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
349                                          const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
350     MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
351                                              const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
352                                              const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
353     DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const;
354     void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
355     static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, 
356                                   const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
357                                   std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
358     static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs);
359     MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
360     MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
361     MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_name(meshName),_mesh_iteration(meshIt),_mesh_order(meshOrd) { }
362   private:
363     std::string _mesh_name;
364     int _mesh_iteration;
365     int _mesh_order;
366     MEDFileAnyTypeField1TSWithoutSDA *_father;
367     std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > _field_pm_pt;
368   };
369
370   class MEDFileFieldGlobsReal;
371
372   class MEDFileFieldGlobs : public RefCountObject
373   {
374   public:
375     static MEDFileFieldGlobs *New(med_idt fid);
376     static MEDFileFieldGlobs *New();
377     std::size_t getHeapMemorySizeWithoutChildren() const;
378     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
379     MEDFileFieldGlobs *deepCopy() const;
380     MEDFileFieldGlobs *shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const;
381     MEDFileFieldGlobs *deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const;
382     void simpleRepr(std::ostream& oss) const;
383     void appendGlobs(const MEDFileFieldGlobs& other, double eps);
384     void checkGlobsPflsPartCoherency(const std::vector<std::string>& pflsUsed) const;
385     void checkGlobsLocsPartCoherency(const std::vector<std::string>& locsUsed) const;
386     void loadProfileInFile(med_idt fid, int id, const std::string& pflName);
387     void loadProfileInFile(med_idt fid, int id);
388     void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real);
389     void loadAllGlobals(med_idt fid);
390     void writeGlobals(med_idt fid, const MEDFileWritable& opt) const;
391     std::vector<std::string> getPfls() const;
392     std::vector<std::string> getLocs() const;
393     bool existsPfl(const std::string& pflName) const;
394     bool existsLoc(const std::string& locName) const;
395     std::string createNewNameOfPfl() const;
396     std::string createNewNameOfLoc() const;
397     std::vector< std::vector<int> > whichAreEqualProfiles() const;
398     std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
399     void setFileName(const std::string& fileName) { _file_name=fileName; }
400     void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
401     void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
402     int getNbOfGaussPtPerCell(int locId) const;
403     int getLocalizationId(const std::string& loc) const;
404     std::string getFileName() const { return _file_name; }
405     const MEDFileFieldLoc& getLocalizationFromId(int locId) const;
406     const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
407     const DataArrayInt *getProfileFromId(int pflId) const;
408     const DataArrayInt *getProfile(const std::string& pflName) const;
409     MEDFileFieldLoc& getLocalizationFromId(int locId);
410     MEDFileFieldLoc& getLocalization(const std::string& locName);
411     DataArrayInt *getProfile(const std::string& pflName);
412     DataArrayInt *getProfileFromId(int pflId);
413     void killProfileIds(const std::vector<int>& pflIds);
414     void killLocalizationIds(const std::vector<int>& locIds);
415     //
416     void appendProfile(DataArrayInt *pfl);
417     void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
418     //
419     static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector<std::string>& namesToAvoid);
420   protected:
421     MEDFileFieldGlobs(med_idt fid);
422     MEDFileFieldGlobs();
423     ~MEDFileFieldGlobs();
424   protected:
425     std::vector< MCAuto<DataArrayInt> > _pfls;
426     std::vector< MCAuto<MEDFileFieldLoc> > _locs;
427     std::string _file_name;
428   };
429
430   /// @endcond INTERNAL
431
432   class MEDFileFieldGlobsReal
433   {
434   public:
435     MEDLOADER_EXPORT MEDFileFieldGlobsReal(med_idt fid);
436     MEDLOADER_EXPORT MEDFileFieldGlobsReal();
437     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
438     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
439     MEDLOADER_EXPORT void simpleReprGlobs(std::ostream& oss) const;
440     MEDLOADER_EXPORT void resetContent();
441     MEDLOADER_EXPORT void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
442     MEDLOADER_EXPORT void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
443     MEDLOADER_EXPORT void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
444     MEDLOADER_EXPORT void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
445     MEDLOADER_EXPORT void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
446     MEDLOADER_EXPORT void checkGlobsCoherency() const;
447     MEDLOADER_EXPORT void checkGlobsPflsPartCoherency() const;
448     MEDLOADER_EXPORT void checkGlobsLocsPartCoherency() const;
449     MEDLOADER_EXPORT virtual std::vector<std::string> getPflsReallyUsed() const = 0;
450     MEDLOADER_EXPORT virtual std::vector<std::string> getLocsReallyUsed() const = 0;
451     MEDLOADER_EXPORT virtual std::vector<std::string> getPflsReallyUsedMulti() const = 0;
452     MEDLOADER_EXPORT virtual std::vector<std::string> getLocsReallyUsedMulti() const = 0;
453     MEDLOADER_EXPORT virtual void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) = 0;
454     MEDLOADER_EXPORT virtual void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) = 0;
455     MEDLOADER_EXPORT virtual ~MEDFileFieldGlobsReal();
456     //
457     MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName);
458     MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id);
459     MEDLOADER_EXPORT void loadGlobals(med_idt fid);
460     MEDLOADER_EXPORT void loadAllGlobals(med_idt fid);
461     MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const;
462     MEDLOADER_EXPORT std::vector<std::string> getPfls() const;
463     MEDLOADER_EXPORT std::vector<std::string> getLocs() const;
464     MEDLOADER_EXPORT bool existsPfl(const std::string& pflName) const;
465     MEDLOADER_EXPORT bool existsLoc(const std::string& locName) const;
466     MEDLOADER_EXPORT std::string createNewNameOfPfl() const;
467     MEDLOADER_EXPORT std::string createNewNameOfLoc() const;
468     MEDLOADER_EXPORT std::vector< std::vector<int> > whichAreEqualProfiles() const;
469     MEDLOADER_EXPORT std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
470     MEDLOADER_EXPORT void setFileName(const std::string& fileName);
471     MEDLOADER_EXPORT void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
472     MEDLOADER_EXPORT void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
473     MEDLOADER_EXPORT void changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
474     MEDLOADER_EXPORT void changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
475     MEDLOADER_EXPORT void changePflName(const std::string& oldName, const std::string& newName);
476     MEDLOADER_EXPORT void changeLocName(const std::string& oldName, const std::string& newName);
477     MEDLOADER_EXPORT std::vector< std::pair<std::vector<std::string>, std::string > > zipPflsNames();
478     MEDLOADER_EXPORT std::vector< std::pair<std::vector<std::string>, std::string > > zipLocsNames(double eps);
479     MEDLOADER_EXPORT int getNbOfGaussPtPerCell(int locId) const;
480     MEDLOADER_EXPORT int getLocalizationId(const std::string& loc) const;
481     MEDLOADER_EXPORT std::string getFileName() const;
482     MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalizationFromId(int locId) const;
483     MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
484     MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId);
485     MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName);
486     MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const;
487     MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const;
488     MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName);
489     MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId);
490     MEDLOADER_EXPORT void killProfileIds(const std::vector<int>& pflIds);
491     MEDLOADER_EXPORT void killLocalizationIds(const std::vector<int>& locIds);
492     //
493     MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl);
494     MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
495   protected:
496     MEDFileFieldGlobs *contentNotNull();
497     const MEDFileFieldGlobs *contentNotNull() const;
498   protected:
499     MCAuto< MEDFileFieldGlobs > _globals;
500   };
501
502   class MEDFileFieldNameScope
503   {
504   public:
505     MEDLOADER_EXPORT MEDFileFieldNameScope();
506     MEDLOADER_EXPORT MEDFileFieldNameScope(const std::string& fieldName);
507     MEDLOADER_EXPORT std::string getName() const;
508     MEDLOADER_EXPORT void setName(const std::string& fieldName);
509     MEDLOADER_EXPORT std::string getDtUnit() const;
510     MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit);
511     MEDLOADER_EXPORT void copyNameScope(const MEDFileFieldNameScope& other);
512   protected:
513     std::string _name;
514     std::string _dt_unit;
515   };
516
517   class MEDFileMeshes;
518
519   /*!
520    * SDA is for Shared Data Arrays such as profiles.
521    */
522   class MEDFileAnyTypeField1TSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
523   {
524   public:
525     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA();
526     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order);
527     MEDLOADER_EXPORT int getIteration() const { return _iteration; }
528     MEDLOADER_EXPORT int getOrder() const { return _order; }
529     MEDLOADER_EXPORT double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; }
530     MEDLOADER_EXPORT void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; }
531     MEDLOADER_EXPORT int getDimension() const;
532     MEDLOADER_EXPORT std::string getMeshName() const;
533     MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
534     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
535     MEDLOADER_EXPORT int getMeshIteration() const;
536     MEDLOADER_EXPORT int getMeshOrder() const;
537     MEDLOADER_EXPORT bool isDealingTS(int iteration, int order) const;
538     MEDLOADER_EXPORT std::pair<int,int> getDtIt() const;
539     MEDLOADER_EXPORT void fillIteration(std::pair<int,int>& p) const;
540     MEDLOADER_EXPORT void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const;
541     MEDLOADER_EXPORT std::vector<TypeOfField> getTypesOfFieldAvailable() const;
542     //
543     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed2() const;
544     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed2() const;
545     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti2() const;
546     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti2() const;
547     MEDLOADER_EXPORT void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
548     MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
549     //
550     MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
551     MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
552     //
553     MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
554     MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
555     MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other);
556   public:
557     MEDLOADER_EXPORT int getNumberOfComponents() const;
558     MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
559     MEDLOADER_EXPORT std::vector<std::string>& getInfo();
560     MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
561     MEDLOADER_EXPORT bool presenceOfStructureElements() const;
562     MEDLOADER_EXPORT bool onlyStructureElements() const;
563     MEDLOADER_EXPORT void killStructureElements();
564     MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
565     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
566     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
567     MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
568     MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
569     MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
570     MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
571     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0;
572     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0;
573     MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitComponents() const;
574     MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0;
575     MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArray() const = 0;
576     MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const = 0;
577     MEDLOADER_EXPORT virtual void setArray(DataArray *arr) = 0;
578     MEDLOADER_EXPORT virtual DataArray *createNewEmptyDataArrayInstance() const = 0;
579     MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0;
580     MEDLOADER_EXPORT virtual const DataArray *getOrCreateAndGetArray() const = 0;
581   public:
582     MEDLOADER_EXPORT MEDCouplingFieldDouble *fieldOnMesh(const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const;
583     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
584     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
585     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
586     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
587     DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
588   public:
589     MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
590     MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitDiscretizations() const;
591     MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
592     MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its);
593     MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& its);
594   public:
595     MEDLOADER_EXPORT void allocNotFromFile(int newNbOfTuples);
596     MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile();
597     MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities);
598     MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
599     MEDLOADER_EXPORT void loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc);
600     MEDLOADER_EXPORT void loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities);
601     MEDLOADER_EXPORT void unloadArrays();
602     MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const;
603   protected:
604     int getMeshIdFromMeshName(const std::string& mName) const;
605     int addNewEntryIfNecessary(const MEDCouplingMesh *mesh);
606     void updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops);
607   protected:
608     std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh;
609     int _iteration;
610     int _order;
611     double _dt;
612   public:
613     //! only useable on reading
614     mutable int _csit;
615     // -3 means allocated and build from scratch
616     // -2 means allocated and read from a file
617     // -1 means not allocated and build from scratch
618     // >=0 means not allocated and read from a file
619     mutable int _nb_of_tuples_to_be_allocated;
620   };
621
622   class MEDFileIntField1TSWithoutSDA;
623
624   template<class T>
625   class MEDFileField1TSTemplateWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA
626   {
627   protected:
628     MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order) { }
629     MEDFileField1TSTemplateWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA() { }
630   public:
631     MEDLOADER_EXPORT void setArray(DataArray *arr);
632     MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const;
633     MEDLOADER_EXPORT typename Traits<T>::ArrayType *getOrCreateAndGetArrayTemplate();
634     MEDLOADER_EXPORT typename Traits<T>::ArrayType const *getOrCreateAndGetArrayTemplate() const;
635     MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplate() const;
636     MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray();
637     MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const;
638     MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const;
639     MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits<T>::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts);
640   protected:
641     MCAuto< typename Traits<T>::ArrayType > _arr;
642   };
643
644   /*!
645    * SDA is for Shared Data Arrays such as profiles.
646    */
647   class MEDFileField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA<double>
648   {
649   public:
650     MEDLOADER_EXPORT const char *getTypeStr() const;
651     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
652     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
653     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
654     MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax);
655     MEDLOADER_EXPORT static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh);
656     MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
657   public:
658     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
659     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
660     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const;
661     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const;
662     MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const;
663   public:
664     static const char TYPE_STR[];
665   };
666
667   /*!
668    * SDA is for Shared Data Arrays such as profiles.
669    */
670   class MEDFileIntField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA<int>
671   {
672   public:
673     MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA();
674     MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
675     MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const;
676     MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const;
677     MEDLOADER_EXPORT const char *getTypeStr() const;
678     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
679     MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
680     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const;
681   protected:
682     MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
683   public:
684     MEDLOADER_EXPORT static const char TYPE_STR[];
685   };
686
687   /*!
688    * User class.
689    */
690   class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileFieldGlobsReal
691   {
692   protected:
693     MEDLOADER_EXPORT MEDFileAnyTypeField1TS();
694     MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
695     MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
696     MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
697     MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent);
698     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c);
699     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, med_idt fid);
700     MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
701     MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
702     MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
703     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
704     // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content
705   public:
706     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
707     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(med_idt fid, bool loadAll=true);
708     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
709     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
710     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
711     MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
712     MEDLOADER_EXPORT int getDimension() const;
713     MEDLOADER_EXPORT int getIteration() const;
714     MEDLOADER_EXPORT int getOrder() const;
715     MEDLOADER_EXPORT double getTime(int& iteration, int& order) const;
716     MEDLOADER_EXPORT void setTime(int iteration, int order, double val);
717     MEDLOADER_EXPORT std::string getName() const;
718     MEDLOADER_EXPORT void setName(const std::string& name);
719     MEDLOADER_EXPORT std::string simpleRepr() const;
720     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
721     MEDLOADER_EXPORT std::string getDtUnit() const;
722     MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit);
723     MEDLOADER_EXPORT std::string getMeshName() const;
724     MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
725     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
726     MEDLOADER_EXPORT int getMeshIteration() const;
727     MEDLOADER_EXPORT int getMeshOrder() const;
728     MEDLOADER_EXPORT int getNumberOfComponents() const;
729     MEDLOADER_EXPORT bool isDealingTS(int iteration, int order) const;
730     MEDLOADER_EXPORT std::pair<int,int> getDtIt() const;
731     MEDLOADER_EXPORT void fillIteration(std::pair<int,int>& p) const;
732     MEDLOADER_EXPORT void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const;
733     MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
734     MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
735     MEDLOADER_EXPORT std::vector<std::string>& getInfo();
736     MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
737     MEDLOADER_EXPORT std::vector<TypeOfField> getTypesOfFieldAvailable() const;
738     MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
739         std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
740     MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
741     MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
742     MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
743   public:
744     MEDLOADER_EXPORT void loadArrays();
745     MEDLOADER_EXPORT void loadArraysIfNecessary();
746     MEDLOADER_EXPORT void unloadArrays();
747     MEDLOADER_EXPORT void unloadArraysWithoutDataLoss();
748     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitComponents() const;
749     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitDiscretizations() const;
750     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const;
751     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const;
752     MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
753     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0;
754   public:
755     //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
756     MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
757     //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf
758     MEDLOADER_EXPORT void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
759     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
760     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
761     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
762     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
763     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const;
764     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const;
765     MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
766     MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
767   public:
768     MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut);
769     MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut);
770   public:
771     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
772   public:
773     MEDLOADER_EXPORT virtual med_field_type getMEDFileFieldType() const = 0;
774     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase();
775     MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() const;
776   protected:
777     MCAuto<MEDFileAnyTypeField1TSWithoutSDA> _content;
778   };
779
780   class MEDFileIntField1TS;
781
782   /*!
783    * User class.
784    */
785   class MEDFileField1TS : public MEDFileAnyTypeField1TS
786   {
787   public:
788     MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
789     MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, bool loadAll=true);
790     MEDLOADER_EXPORT static MEDFileField1TS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileField1TS>(db); }
791     MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
792     MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
793     MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
794     MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
795     MEDLOADER_EXPORT static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
796     MEDLOADER_EXPORT static MEDFileField1TS *New();
797     MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
798     //
799     MEDLOADER_EXPORT MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
800     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
801     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
802     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
803     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
804     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
805     MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
806     //
807     MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
808     MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
809     // direct forwarding to MEDFileField1TSWithoutSDA instance _content
810   public:
811     MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const;
812     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const;
813     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
814
815     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
816         std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
817   public:
818     MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
819     MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MCAuto<DataArray>& arr);
820   public:
821     MEDLOADER_EXPORT MEDFileField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
822   private:
823     med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
824     const MEDFileField1TSWithoutSDA *contentNotNull() const;
825     MEDFileField1TSWithoutSDA *contentNotNull();
826   private:
827     ~MEDFileField1TS() { }
828     MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
829     MEDFileField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
830     MEDFileField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
831     MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
832     MEDFileField1TS();
833   };
834
835   class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
836   {
837   public:
838     MEDLOADER_EXPORT static MEDFileIntField1TS *New();
839     MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
840     MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, bool loadAll=true);
841     MEDLOADER_EXPORT static MEDFileIntField1TS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileIntField1TS>(db); }
842     MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
843     MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
844     MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
845     MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
846     MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
847     MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
848     MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const;
849     //
850     MEDLOADER_EXPORT MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
851     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
852     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
853     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
854     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
855     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
856     MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
857     //
858     MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
859     MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
860     MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray() const;
861   public:
862     MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MCAuto<DataArray>& arr);
863     MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldInt> SetDataArrayDoubleInIntField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
864     MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f);
865   public:
866     MEDLOADER_EXPORT MEDFileIntField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
867   private:
868     med_field_type getMEDFileFieldType() const { return MED_INT32; }
869     const MEDFileIntField1TSWithoutSDA *contentNotNull() const;
870     MEDFileIntField1TSWithoutSDA *contentNotNull();
871   private:
872     ~MEDFileIntField1TS() { }
873     MEDFileIntField1TS();
874     MEDFileIntField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
875     MEDFileIntField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
876     MEDFileIntField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
877     MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
878   };
879
880   class MEDFileAnyTypeFieldMultiTSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
881   {
882   protected:
883     MEDFileAnyTypeFieldMultiTSWithoutSDA();
884     MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName);
885     MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
886     MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
887   public:
888     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
889     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
890     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCopy() const;
891     MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitComponents() const;
892     MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitDiscretizations() const;
893     MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
894     MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0;
895     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const = 0;
896     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const = 0;
897     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const = 0;
898     MEDLOADER_EXPORT virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const = 0;
899     MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
900     MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
901     MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& info);
902     MEDLOADER_EXPORT int getTimeStepPos(int iteration, int order) const;
903     MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const;
904     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order);
905     MEDLOADER_EXPORT std::string getMeshName() const;
906     MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
907     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
908     MEDLOADER_EXPORT int getNumberOfTS() const;
909     MEDLOADER_EXPORT void eraseEmptyTS();
910     MEDLOADER_EXPORT void eraseTimeStepIds(const int *startIds, const int *endIds);
911     MEDLOADER_EXPORT void eraseTimeStepIds2(int bg, int end, int step);
912     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds(const int *startIds, const int *endIds) const;
913     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds2(int bg, int end, int step) const;
914     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
915     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
916     MEDLOADER_EXPORT bool presenceOfStructureElements() const;
917     MEDLOADER_EXPORT bool onlyStructureElements() const;
918     MEDLOADER_EXPORT void killStructureElements();
919     MEDLOADER_EXPORT int getPosOfTimeStep(int iteration, int order) const;
920     MEDLOADER_EXPORT int getPosGivenTime(double time, double eps=1e-8) const;
921     MEDLOADER_EXPORT std::vector< std::pair<int,int> > getIterations() const;
922     MEDLOADER_EXPORT std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const;
923     MEDLOADER_EXPORT void pushBackTimeStep(MCAuto<MEDFileAnyTypeField1TSWithoutSDA>& tse);
924     MEDLOADER_EXPORT void synchronizeNameScope();
925     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
926     MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
927     MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
928     MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob);
929     MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
930     MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
931     MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const;
932     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
933     MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
934     MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
935     MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const;
936     MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
937     MEDLOADER_EXPORT void loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc);
938     MEDLOADER_EXPORT void unloadArrays();
939   public:
940     MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA *getTimeStepAtPos2(int pos) const;
941     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *getTimeStepAtPos2(int pos);
942     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed2() const;
943     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed2() const;
944     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti2() const;
945     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti2() const;
946     MEDLOADER_EXPORT void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
947     MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
948     MEDLOADER_EXPORT void setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts);
949   protected:
950     virtual med_field_type getMEDFileFieldType() const = 0;
951     void copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
952     void checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const;
953     void checkThatComponentsMatch(const std::vector<std::string>& compos) const;
954     void checkThatNbOfCompoOfTSMatchThis() const;
955   protected:
956     std::vector<std::string> _infos;
957     std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > _time_steps;
958   };
959
960   class MEDFileIntFieldMultiTSWithoutSDA;
961
962   class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
963   {
964   public:
965     MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
966     MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
967     MEDLOADER_EXPORT const char *getTypeStr() const;
968     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const;
969     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
970     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
971     MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const;
972   protected:
973     MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName);
974     MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
975     med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
976     MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
977     void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
978   public:
979     MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA();
980   };
981
982   class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
983   {
984   public:
985     MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
986     MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
987     MEDLOADER_EXPORT const char *getTypeStr() const;
988     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const;
989     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
990     MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const;
991   protected:
992     MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName);
993     MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
994     med_field_type getMEDFileFieldType() const { return MED_INT32; }
995     MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
996     void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
997   public:
998     MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA();
999   };
1000
1001   class MEDFileAnyTypeFieldMultiTSIterator;
1002   class MEDFileFastCellSupportComparator;
1003   /*!
1004    * User class.
1005    */
1006   class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileFieldGlobsReal
1007   {
1008   protected:
1009     MEDFileAnyTypeFieldMultiTS();
1010     MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
1011     MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
1012     MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
1013     static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c);
1014     static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid);
1015     static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
1016     static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
1017   public:
1018     MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
1019     MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, bool loadAll=true);
1020     MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
1021     MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
1022     MEDLOADER_EXPORT void loadArrays();
1023     MEDLOADER_EXPORT void loadArraysIfNecessary();
1024     MEDLOADER_EXPORT void unloadArrays();
1025     MEDLOADER_EXPORT void unloadArraysWithoutDataLoss();
1026     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
1027     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
1028     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
1029     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *deepCopy() const;
1030     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitComponents() const;
1031     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitDiscretizations() const;
1032     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitMultiDiscrPerGeoTypes() const;
1033     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const = 0;
1034     MEDLOADER_EXPORT virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const = 0;
1035     //
1036     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const = 0;
1037     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
1038     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
1039     MEDLOADER_EXPORT static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS);
1040     MEDLOADER_EXPORT static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& fsc);
1041     MEDLOADER_EXPORT static int CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1);
1042   public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content
1043     MEDLOADER_EXPORT std::string getName() const;
1044     MEDLOADER_EXPORT void setName(const std::string& name);
1045     MEDLOADER_EXPORT std::string getDtUnit() const;
1046     MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit);
1047     MEDLOADER_EXPORT std::string getMeshName() const;
1048     MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
1049     MEDLOADER_EXPORT std::string simpleRepr() const;
1050     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
1051     MEDLOADER_EXPORT int getNumberOfTS() const;
1052     MEDLOADER_EXPORT void eraseEmptyTS();
1053     MEDLOADER_EXPORT void eraseTimeStepIds(const int *startIds, const int *endIds);
1054     MEDLOADER_EXPORT void eraseTimeStepIds2(int bg, int end, int step);
1055     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *buildSubPart(const int *startIds, const int *endIds) const;
1056     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *buildSubPartSlice(int bg, int end, int step) const;
1057     MEDLOADER_EXPORT std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const;
1058     MEDLOADER_EXPORT std::vector< std::pair<int,int> > getIterations() const;
1059     MEDLOADER_EXPORT void pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts);
1060     MEDLOADER_EXPORT void pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts);
1061     MEDLOADER_EXPORT void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
1062     MEDLOADER_EXPORT void synchronizeNameScope();
1063     MEDLOADER_EXPORT int getPosOfTimeStep(int iteration, int order) const;
1064     MEDLOADER_EXPORT int getPosGivenTime(double time, double eps=1e-8) const;
1065     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSIterator *iterator();
1066     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
1067     MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
1068     MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
1069     MEDLOADER_EXPORT void killStructureElements();
1070     MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& info);
1071     MEDLOADER_EXPORT int getNumberOfComponents() const;
1072     MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
1073     MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
1074     MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
1075     MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
1076   public:
1077     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0;
1078     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
1079     MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts);
1080   public:
1081     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
1082     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
1083     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const;
1084     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const;
1085     MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
1086     MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
1087   protected:
1088     MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase();
1089     const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const;
1090   private:
1091     static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps);
1092   protected:
1093     MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> _content;
1094   };
1095
1096   class MEDFileIntFieldMultiTS;
1097
1098   /*!
1099    * User class.
1100    */
1101   class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1102   {
1103   public:
1104     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New();
1105     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
1106     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(med_idt fid, bool loadAll=true);
1107     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileFieldMultiTS>(db); }
1108     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
1109     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
1110     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
1111     MEDLOADER_EXPORT static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
1112     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
1113     MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
1114     MEDLOADER_EXPORT MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
1115     //
1116     MEDLOADER_EXPORT MEDFileField1TS *getTimeStepAtPos(int pos) const;
1117     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
1118     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
1119     //
1120     MEDLOADER_EXPORT MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
1121     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
1122     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
1123     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
1124     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
1125     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
1126     MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
1127     //
1128     MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
1129     MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
1130     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
1131     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray(int iteration, int order) const;
1132     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
1133   public:
1134     MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const;
1135   private:
1136     const MEDFileFieldMultiTSWithoutSDA *contentNotNull() const;
1137     MEDFileFieldMultiTSWithoutSDA *contentNotNull();
1138   private:
1139     ~MEDFileFieldMultiTS() { }
1140     MEDFileFieldMultiTS();
1141     MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
1142     MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
1143     MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
1144   };
1145
1146   /*!
1147    * User class.
1148    */
1149   class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1150   {
1151   public:
1152     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New();
1153     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
1154     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(med_idt fid, bool loadAll=true);
1155     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileIntFieldMultiTS>(db); }
1156     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
1157     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
1158     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
1159     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
1160     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
1161     MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
1162     MEDLOADER_EXPORT MEDFileIntField1TS *getTimeStepAtPos(int pos) const;
1163     MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
1164     //
1165     MEDLOADER_EXPORT MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
1166     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
1167     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
1168     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
1169     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
1170     MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
1171     MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
1172     //
1173     MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
1174     MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
1175     //
1176     MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray(int iteration, int order) const;
1177   public:
1178     MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const;
1179   private:
1180     const MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() const;
1181     MEDFileIntFieldMultiTSWithoutSDA *contentNotNull();
1182   private:
1183     ~MEDFileIntFieldMultiTS() { }
1184     MEDFileIntFieldMultiTS();
1185     MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
1186     MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
1187     MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
1188   };
1189
1190   class MEDFileAnyTypeFieldMultiTSIterator
1191   {
1192   public:
1193     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts);
1194     MEDLOADER_EXPORT ~MEDFileAnyTypeFieldMultiTSIterator();
1195     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *nextt();
1196   private:
1197     MCAuto<MEDFileAnyTypeFieldMultiTS> _fmts;
1198     int _iter_id;
1199     int _nb_iter;
1200   };
1201
1202   class MEDFileFieldsIterator;
1203   class MEDFileStructureElements;
1204   
1205   /*!
1206    * Use class.
1207    */
1208   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
1209   {
1210   public:
1211     MEDLOADER_EXPORT static MEDFileFields *New();
1212     MEDLOADER_EXPORT static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
1213     MEDLOADER_EXPORT static MEDFileFields *New(med_idt fid, bool loadAll=true);
1214     MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true);
1215     MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll=true);
1216     MEDLOADER_EXPORT static MEDFileFields *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileFields>(db); }
1217     MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0);
1218     MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
1219     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
1220     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
1221     MEDLOADER_EXPORT MEDFileFields *deepCopy() const;
1222     MEDLOADER_EXPORT MEDFileFields *shallowCpy() const;
1223     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
1224     MEDLOADER_EXPORT void loadArrays();
1225     MEDLOADER_EXPORT void loadArraysIfNecessary();
1226     MEDLOADER_EXPORT void unloadArrays();
1227     MEDLOADER_EXPORT void unloadArraysWithoutDataLoss();
1228     MEDLOADER_EXPORT int getNumberOfFields() const;
1229     MEDLOADER_EXPORT std::vector< std::pair<int,int> > getCommonIterations(bool& areThereSomeForgottenTS) const;
1230     MEDLOADER_EXPORT std::vector<std::string> getFieldsNames() const;
1231     MEDLOADER_EXPORT std::vector<std::string> getMeshesNames() const;
1232     MEDLOADER_EXPORT std::string simpleRepr() const;
1233     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss) const;
1234     //
1235     MEDLOADER_EXPORT void resize(int newSize);
1236     MEDLOADER_EXPORT void pushField(MEDFileAnyTypeFieldMultiTS *field);
1237     MEDLOADER_EXPORT void pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields);
1238     MEDLOADER_EXPORT void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
1239     MEDLOADER_EXPORT int getPosFromFieldName(const std::string& fieldName) const;
1240     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
1241     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
1242     MEDLOADER_EXPORT MEDFileFields *buildSubPart(const int *startIds, const int *endIds) const;
1243     MEDLOADER_EXPORT bool removeFieldsWithoutAnyTimeStep();
1244     MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
1245     MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
1246     MEDLOADER_EXPORT MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
1247     MEDLOADER_EXPORT bool presenceOfStructureElements() const;
1248     MEDLOADER_EXPORT void killStructureElements();
1249     MEDLOADER_EXPORT MCAuto<MEDFileFields> partOfThisOnStructureElements() const;
1250     MEDLOADER_EXPORT MEDFileFieldsIterator *iterator();
1251     MEDLOADER_EXPORT void destroyFieldAtPos(int i);
1252     MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds);
1253     MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step);
1254     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
1255     MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N);
1256   public:
1257     MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
1258   public:
1259     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
1260     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
1261     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsedMulti() const;
1262     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti() const;
1263     MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
1264     MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
1265   private:
1266     ~MEDFileFields() { }
1267     MEDFileFields();
1268     MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
1269   private:
1270     std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > _fields;
1271   };
1272
1273   class MEDFileFieldsIterator
1274   {
1275   public:
1276     MEDLOADER_EXPORT MEDFileFieldsIterator(MEDFileFields *fs);
1277     MEDLOADER_EXPORT ~MEDFileFieldsIterator();
1278     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *nextt();
1279   private:
1280     MCAuto<MEDFileFields> _fs;
1281     int _iter_id;
1282     int _nb_iter;
1283   };
1284 }
1285
1286 #endif