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