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