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