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