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