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