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