Salome HOME
Merge V8_4_BR branch.
[tools/medcoupling.git] / src / MEDLoader / MEDFileFieldInternal.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __MEDFILEFIELDINTERNAL_HXX__
22 #define __MEDFILEFIELDINTERNAL_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileUtilities.hxx"
26 #include "NormalizedGeometricTypes"
27 #include "InterpKernelAutoPtr.hxx"
28 #include "MCAuto.hxx"
29
30 #include "med.h"
31
32 #include <string>
33 #include <list>
34
35 namespace MEDCoupling
36 {
37   class MEDFileGTKeeper
38   {
39   public:
40     virtual MEDFileGTKeeper *deepCopy() const = 0;
41     virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0;
42     virtual std::string getRepr() const = 0;
43     virtual bool isEqual(const MEDFileGTKeeper *other) const = 0;
44     virtual ~MEDFileGTKeeper();
45   };
46
47   class MEDFileGTKeeperSta : public MEDFileGTKeeper
48   {
49   public:
50     MEDFileGTKeeperSta(INTERP_KERNEL::NormalizedCellType gt):_geo_type(gt) { }
51     MEDFileGTKeeper *deepCopy() const;
52     INTERP_KERNEL::NormalizedCellType getGeoType() const;
53     std::string getRepr() const;
54     bool isEqual(const MEDFileGTKeeper *other) const;
55   private:
56     INTERP_KERNEL::NormalizedCellType _geo_type;
57   };
58
59   
60   class MEDFileStructureElement;
61   class MEDFileUMesh;
62   
63   class MEDFileGTKeeperDyn : public MEDFileGTKeeper
64   {
65   public:
66     MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se);
67     MEDFileGTKeeper *deepCopy() const;
68     INTERP_KERNEL::NormalizedCellType getGeoType() const;
69     std::string getRepr() const;
70     bool isEqual(const MEDFileGTKeeper *other) const;
71     const MEDFileUMesh *getMesh() const { return _mesh; }
72     const MEDFileUMesh *getSection() const { return _section; }
73     const MEDFileStructureElement *getSE() const { return _se; }
74   private:
75     MCConstAuto<MEDFileUMesh> _mesh;
76     MCConstAuto<MEDFileUMesh> _section;
77     MCConstAuto<MEDFileStructureElement> _se;
78   };
79
80   class MEDFileEntities;
81   
82   class MEDFileFieldLoc : public RefCountObject
83   {
84   public:
85     MEDLOADER_EXPORT void simpleRepr(std::ostream& oss) const;
86     MEDLOADER_EXPORT std::string getName() const { return _name; }
87     MEDLOADER_EXPORT void setName(const std::string& name);
88     static MEDFileFieldLoc *New(med_idt fid, const std::string& locName);
89     static MEDFileFieldLoc *New(med_idt fid, int i, const MEDFileEntities *entities);
90     static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
91     std::size_t getHeapMemorySizeWithoutChildren() const;
92     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
93     MEDFileFieldLoc *deepCopy() const;
94     bool isOnStructureElement() const;
95     const MEDFileGTKeeper *getUndergroundGTKeeper() const { return _gt; }
96     MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
97     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
98     MEDLOADER_EXPORT std::string repr() const;
99     MEDLOADER_EXPORT bool isName(const std::string& name) const { return _name==name; }
100     MEDLOADER_EXPORT int getDimension() const { return _dim; }
101     MEDLOADER_EXPORT int getNumberOfGaussPoints() const { return _nb_gauss_pt; }
102     MEDLOADER_EXPORT int getNumberOfPointsInCells() const { return _nb_node_per_cell; }
103     MEDLOADER_EXPORT const std::vector<double>& getRefCoords() const { return _ref_coo; }
104     MEDLOADER_EXPORT const std::vector<double>& getGaussCoords() const { return _gs_coo; }
105     MEDLOADER_EXPORT const std::vector<double>& getGaussWeights() const { return _w; }
106     MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _gt->getGeoType(); }
107     MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const;
108   private:
109     MEDFileFieldLoc(const MEDFileFieldLoc& other);
110     MEDFileFieldLoc(med_idt fid, const std::string& locName);
111     MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *entities);
112     MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
113   private:
114     int _dim;
115     int _nb_gauss_pt;
116     INTERP_KERNEL::AutoCppPtr<MEDFileGTKeeper> _gt;
117     int _nb_node_per_cell;
118     std::string _name;
119     std::vector<double> _ref_coo;
120     std::vector<double> _gs_coo;
121     std::vector<double> _w;
122   };
123
124   /// @cond INTERNAL
125   class MEDFileFieldPerMeshPerTypeCommon;
126   class MEDFileFieldPerMeshPerType;
127   class MEDCouplingFieldTemplate;
128   class MEDFileFieldNameScope;
129   class MEDFileFieldGlobsReal;
130   class MEDCouplingMesh;
131   
132   class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
133   {
134   public:
135     static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
136     static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId);
137     static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
138     std::size_t getHeapMemorySizeWithoutChildren() const;
139     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
140     MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
141     void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
142     void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
143     void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
144     void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const;
145     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
146     const MEDFileFieldPerMeshPerTypeCommon *getFather() const;
147     void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc);
148     void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc);
149     void setNewStart(int newValueOfStart);
150     int getIteration() const;
151     int getOrder() const;
152     double getTime() const;
153     std::string getMeshName() const;
154     TypeOfField getType() const;
155     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
156     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
157     void setType(TypeOfField newType);
158     INTERP_KERNEL::NormalizedCellType getGeoType() const;
159     int getNumberOfComponents() const;
160     int getNumberOfTuples() const;
161     int getStart() const { return _start; }
162     int getEnd() const { return _end; }
163     void setEnd(int endd) { _end=endd; }
164     int getNumberOfVals() const { return _nval; }
165     DataArray *getOrCreateAndGetArray();
166     const DataArray *getOrCreateAndGetArray() const;
167     const std::vector<std::string>& getInfo() const;
168     std::string getProfile() const;
169     void setProfile(const std::string& newPflName);
170     std::string getLocalization() const;
171     void setLocalization(const std::string& newLocName);
172     int getLocId() const { return _loc_id; }
173     void setLocId(int newId) const { _loc_id=newId; }
174     void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; }
175     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
176     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
177     void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
178                          std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
179     void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
180     int fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const;
181     int fillTupleIds(int *ptToFill) const;
182     static int ConvertType(TypeOfField type, int locId);
183     static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
184     static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
185                                const DataArrayInt *explicitIdsInMesh, const std::vector<int>& newCode,
186                                MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result);
187     static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
188                                                                           bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
189                                                                           MEDFileFieldGlobsReal& glob, bool &notInExisting);
190     static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(int &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
191     MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { }
192   private:
193     MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
194     MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy);
195     MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
196     MEDFileFieldPerMeshPerTypePerDisc();
197   private:
198     void goReadZeValuesInFile(med_idt fid, const std::string& fieldName, int nbOfCompo, int iteration, int order, med_entity_type menti, med_geometry_type mgeoti, unsigned char *startFeedingPtr);
199   private:
200     TypeOfField _type;
201     MEDFileFieldPerMeshPerTypeCommon *_father;
202     int _start;
203     int _end;
204     //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
205     int _nval;
206     std::string _profile;
207     std::string _localization;
208     //! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
209     mutable int _loc_id;
210     mutable int _profile_it;
211     MCAuto<PartDefinition> _pd;
212   public:
213     mutable int _tmp_work1;
214   };
215
216   class MEDFileFieldVisitor;
217   class MEDFileFieldPerMesh;
218   
219   class MEDFileFieldPerMeshPerTypeCommon : public RefCountObject, public MEDFileWritable
220   {
221   public:
222     std::size_t getHeapMemorySizeWithoutChildren() const;
223     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
224     void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
225     void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
226     void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
227     void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
228     const MEDFileFieldPerMesh *getFather() const;
229     void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
230     void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
231     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
232     bool isUniqueLevel(int& dim) const;
233     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
234     void fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
235     int getIteration() const;
236     int getOrder() const;
237     double getTime() const;
238     std::string getMeshName() const;
239     void getSizes(int& globalSz, int& nbOfEntries) const;
240     int getNumberOfComponents() const;
241     bool presenceOfMultiDiscPerGeoType() const;
242     void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc);
243     DataArray *getOrCreateAndGetArray();
244     const DataArray *getOrCreateAndGetArray() const;
245     const std::vector<std::string>& getInfo() const;
246     std::vector<std::string> getPflsReallyUsed() const;
247     std::vector<std::string> getLocsReallyUsed() const;
248     std::vector<std::string> getPflsReallyUsedMulti() const;
249     std::vector<std::string> getLocsReallyUsedMulti() const;
250     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
251     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
252     MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId);
253     const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const;
254     int getNumberOfLoc() const { return _field_pm_pt_pd.size(); }
255     void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
256     void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
257     bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
258     bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
259     static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
260     MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { }
261     void setFather(MEDFileFieldPerMesh *father);
262     void accept(MEDFileFieldVisitor& visitor) const;
263   public:
264     virtual ~MEDFileFieldPerMeshPerTypeCommon();
265     virtual void getDimension(int& dim) const = 0;
266     virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0;
267     virtual void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const = 0;
268     virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0;
269     virtual std::string getGeoTypeRepr() const = 0;
270     virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0;
271     virtual 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 = 0;
272   protected:
273     void deepCopyElements();
274     std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
275     std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
276     std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
277     std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
278   private:
279     MEDFileFieldPerMesh *_father;
280   protected:
281     std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
282   };
283
284   class MEDFileFieldPerMeshPerType : public MEDFileFieldPerMeshPerTypeCommon
285   {
286   public:
287     static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType);
288     static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
289     static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(int &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
290   public:// overload of abstract methods
291     void getDimension(int& dim) const;
292     INTERP_KERNEL::NormalizedCellType getGeoType() const;
293     void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
294     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
295     std::string getGeoTypeRepr() const;
296     MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
297     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;
298   private:
299     MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
300     MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt);
301   private:
302     INTERP_KERNEL::NormalizedCellType _geo_type;
303   };
304
305   class MEDFileFieldPerMeshPerTypeDyn : public MEDFileFieldPerMeshPerTypeCommon
306   {
307   public:
308     static MEDFileFieldPerMeshPerTypeDyn *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileEntities *entities, int idGT, const MEDFileFieldNameScope& nasc);
309     int getDynGT() const;
310     std::string getModelName() const;
311   public:
312     void getDimension(int& dim) const;
313     INTERP_KERNEL::NormalizedCellType getGeoType() const;
314     void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
315     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
316     std::string getGeoTypeRepr() const;
317     MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const;
318     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;
319   private:
320     MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc);
321   private:
322     MCConstAuto<MEDFileStructureElement> _se;
323   };
324   
325   class MEDFileMesh;
326   class MEDFileAnyTypeField1TSWithoutSDA;
327   class MEDFileField1TSWithoutSDA;
328   
329   class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
330   {
331   public:
332     static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
333     static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
334     std::size_t getHeapMemorySizeWithoutChildren() const;
335     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
336     MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
337     void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
338     void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
339     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 MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
340     void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
341     void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
342     void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
343     void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
344     void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
345     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
346     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
347     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;
348     void accept(MEDFileFieldVisitor& visitor) const;
349     void getDimension(int& dim) const;
350     bool isUniqueLevel(int& dim) const;
351     double getTime() const;
352     int getIteration() const;
353     int getOrder() const;
354     int getMeshIteration() const { return _mesh_iteration; }
355     int getMeshOrder() const { return _mesh_order; }
356     std::string getMeshName() const;
357     void setMeshName(const std::string& meshName);
358     int getNumberOfComponents() const;
359     bool presenceOfMultiDiscPerGeoType() const;
360     bool presenceOfStructureElements() const;
361     bool onlyStructureElements() const;
362     void killStructureElements();
363     void keepOnlyStructureElements();
364     void keepOnlyOnSE(const std::string& seName);
365     void getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const;
366     DataArray *getOrCreateAndGetArray();
367     const DataArray *getOrCreateAndGetArray() const;
368     const std::vector<std::string>& getInfo() const;
369     std::vector<std::string> getPflsReallyUsed() const;
370     std::vector<std::string> getLocsReallyUsed() const;
371     std::vector<std::string> getPflsReallyUsedMulti() const;
372     std::vector<std::string> getLocsReallyUsedMulti() const;
373     void convertMedBallIntoClassic();
374     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
375     bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
376     void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
377     void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
378     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
379     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
380     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
381     DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
382     void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
383     MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId);
384     const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const;
385     static MCAuto<MEDFileFieldPerMesh> Aggregate(int &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
386   private:
387     int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
388     MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
389                                         const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
390     MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
391                                          const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
392                                          const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
393                                          const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
394     MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
395                                              const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
396                                              const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
397     DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const;
398     void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
399     static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, 
400                                   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,
401                                   std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
402     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);
403     MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
404     MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
405     MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_iteration(meshIt),_mesh_order(meshOrd) { }
406   private:
407     int _mesh_iteration;
408     int _mesh_order;
409     MEDFileAnyTypeField1TSWithoutSDA *_father;
410     std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > _field_pm_pt;
411   };
412 }
413
414 #endif