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