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