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