Salome HOME
updated copyright message
[tools/medcoupling.git] / src / MEDLoader / MEDFileMeshLL.hxx
1 // Copyright (C) 2007-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __MEDFILEMESHLL_HXX__
22 #define __MEDFILEMESHLL_HXX__
23
24 #include "MEDFileBasis.hxx"
25 #include "MEDFileMeshElt.hxx"
26
27 #include "MEDCouplingUMesh.hxx"
28 #include "MEDCouplingCMesh.hxx"
29 #include "MEDCoupling1GTUMesh.hxx"
30 #include "MEDCouplingPartDefinition.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MCAuto.hxx"
33
34 #include "InterpKernelAutoPtr.hxx"
35
36 #include "med.h"
37
38 #include <map>
39
40 namespace MEDCoupling
41 {
42   class MEDFileMeshReadSelector;
43
44   class MeshOrStructMeshCls
45   {
46   protected:
47     MeshOrStructMeshCls(int mid):_mid(mid) { }
48   public:
49     virtual ~MeshOrStructMeshCls() {}
50     int getID() const { return _mid; }
51     virtual std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const = 0;
52     virtual double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const = 0;
53   private:
54     int _mid;
55   };
56
57   class MeshCls : public MeshOrStructMeshCls
58   {
59   public:
60     MeshCls(int mid):MeshOrStructMeshCls(mid) { }
61     std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const;
62     double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const;
63   };
64
65   class StructMeshCls : public MeshOrStructMeshCls
66   {
67   public:
68     StructMeshCls(int mid):MeshOrStructMeshCls(mid) { }
69     std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim, MEDFileString& description, MEDFileString& dtunit, MEDFileString& univName) const;
70     double checkMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) const;
71   };
72   
73   class MEDFileMeshL2 : public RefCountObject
74   {
75   public:
76     MEDFileMeshL2();
77     std::size_t getHeapMemorySizeWithoutChildren() const;
78     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
79     const char *getName() const { return _name.getReprForWrite(); }
80     const char *getDescription() const { return _description.getReprForWrite(); }
81     const char *getUnivName() const { return _univ_name.getReprForWrite(); }
82     const char *getTimeUnit() const { return _dt_unit.getReprForWrite(); }
83     int getIteration() const { return _iteration; }
84     int getOrder() const { return _order; }
85     double getTime() const { return _time; }
86     MCAuto<PartDefinition> getPartDefOfCoo() const { return _part_coords; }
87     std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim);
88     static INTERP_KERNEL::AutoCppPtr<MeshOrStructMeshCls> GetMeshIdFromName(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& dt, int& it, std::string& dtunit1);
89     static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map<std::string,mcIdType>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
90     static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,mcIdType>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
91     static bool RenameFamiliesFromFileToMem(std::vector< std::string >& famNames);
92     static bool RenameFamiliesFromMemToFile(std::vector< std::string >& famNames);
93     static MEDCoupling::MEDCouplingAxisType TraduceAxisType(med_axis_type at);
94     static MEDCoupling::MEDCouplingAxisType TraduceAxisTypeStruct(med_grid_type gt);
95     static med_axis_type TraduceAxisTypeRev(MEDCoupling::MEDCouplingAxisType at);
96     static med_grid_type TraduceAxisTypeRevStruct(MEDCoupling::MEDCouplingAxisType at);
97   private:
98     typedef bool (*RenameFamiliesPatternFunc)(std::vector< std::string >&);
99     static void RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func);
100     static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams);
101     static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams);
102   public:
103     static const char ZE_SEP_FOR_FAMILY_KILLERS[];
104     static int ZE_SEP2_FOR_FAMILY_KILLERS;
105   protected:
106     MEDFileString _name;
107     MEDFileString _description;
108     MEDFileString _univ_name;
109     MEDFileString _dt_unit;
110     int _iteration;
111     int _order;
112     double _time;
113     MCAuto<PartDefinition> _part_coords;
114   };
115
116   class MEDFileUMeshL2 : public MEDFileMeshL2
117   {
118   public:
119     MEDFileUMeshL2();
120     std::string getClassName() const override { return std::string("MEDFileUMeshL2"); }
121     std::vector<std::string> loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim);
122     void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
123     void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
124     void loadPartFromUserDistrib(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, int dt, int it, MEDFileMeshReadSelector *mrs);
125     void dealWithCoordsInLoadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<std::string>& infosOnComp, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
126     std::vector<std::string> loadPartConnectivityOnly(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs, int& Mdim);
127     void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
128     void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
129     void loadPartOfConnectivityFromUserDistrib(med_idt fid, int mdim, const std::string& mName, const std::map<INTERP_KERNEL::NormalizedCellType,std::vector<mcIdType>>& distrib, int dt, int it, MEDFileMeshReadSelector *mrs);
130
131     void loadCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it);
132     void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax);
133     void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, const std::vector<mcIdType>& distribNodes);
134     void loadPartCoordsSlice(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, const DataArrayIdType *nodeIds, mcIdType nbOfCoordLS);
135     int getNumberOfLevels() const { return (int)_per_type_mesh.size(); }
136     bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); }
137     const std::vector< MCAuto<MEDFileUMeshPerType> >& getLev(int levId) const { return _per_type_mesh[levId]; }
138     bool isFamDefinedOnLev(int levId) const;
139     bool isNumDefinedOnLev(int levId) const;
140     bool isNamesDefinedOnLev(int levId) const;
141     MCAuto<DataArrayDouble> getCoords() const { return _coords; }
142     MCAuto<DataArrayIdType> getCoordsFamily() const { return _fam_coords; }
143     MCAuto<DataArrayIdType> getCoordsNum() const { return _num_coords; }
144     MCAuto<DataArrayIdType> getCoordsGlobalNum() const { return _global_num_coords; }
145     MCAuto<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
146     static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords);
147     static void LoadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, const std::vector<mcIdType>& distribNodes,
148     MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords);
149     static void LoadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax,
150     MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords);
151     static void LoadPartCoordsArray(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, const DataArrayIdType *nodeIds,
152 MCAuto<DataArrayDouble>& _coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords);
153     static void allocCoordsPartCoords(mcIdType spaceDim, mcIdType nMin, mcIdType nMax, MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords);
154     static void allocCoordsPartCoords(mcIdType spaceDim, const std::vector<mcIdType>& nodeIds, MCAuto<DataArrayDouble>& _coords, MCAuto<PartDefinition>& _part_coords);
155     static void fillPartCoords(med_idt fid, mcIdType spaceDim, const std::string& mName, int dt, int it, const PartDefinition *partCoords, MCAuto<DataArrayDouble>& _coords, MCAuto<DataArrayIdType>& _fam_coords, MCAuto<DataArrayIdType>& _num_coords, MCAuto<DataArrayAsciiChar>& _name_coords);
156   private:
157     void sortTypes();
158   private:
159     std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > > _per_type_mesh;
160     MCAuto<DataArrayDouble> _coords;
161     MCAuto<DataArrayIdType> _fam_coords;
162     MCAuto<DataArrayIdType> _num_coords;
163     MCAuto<DataArrayIdType> _global_num_coords;
164     MCAuto<DataArrayAsciiChar> _name_coords;
165   };
166
167   class MEDFileStrMeshL2 : public MEDFileMeshL2
168   {
169   };
170
171   class MEDFileCMeshL2 : public MEDFileStrMeshL2
172   {
173   public:
174     MEDFileCMeshL2();
175     std::string getClassName() const override { return std::string("MEDFileCMeshL2"); }
176     void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it);
177     MEDCouplingCMesh *getMesh() { return _cmesh; }
178     MEDCoupling::MEDCouplingAxisType getAxisType() const { return _ax_type; }
179   private:
180     static med_data_type GetDataTypeCorrespondingToSpaceId(int id);
181   private:
182     MCAuto<MEDCouplingCMesh> _cmesh;
183     MEDCoupling::MEDCouplingAxisType _ax_type;
184   };
185
186   class MEDFileCLMeshL2 : public MEDFileStrMeshL2
187   {
188   public:
189     MEDFileCLMeshL2();
190     std::string getClassName() const override { return std::string("MEDFileCLMeshL2"); }
191     void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it);
192     MEDCouplingCurveLinearMesh *getMesh() { return _clmesh; }
193   private:
194     MCAuto<MEDCouplingCurveLinearMesh> _clmesh;
195   };
196
197   class MEDFileMesh;
198   class MEDFileUMeshSplitL1;
199
200   class MEDFileUMeshPermCompute : public BigMemoryObject
201   {
202   public:
203     MEDFileUMeshPermCompute(const MEDFileUMeshSplitL1* st);
204     std::string getClassName() const override { return std::string("MEDFileUMeshPermCompute"); }
205     operator MEDCouplingUMesh *() const;
206     void operator=(MEDCouplingUMesh *m);
207     void updateTime() const;
208     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
209     std::size_t getHeapMemorySizeWithoutChildren() const;
210   private:
211     const MEDFileUMeshSplitL1 *_st;
212     mutable std::size_t _mpt_time;
213     mutable std::size_t _num_time;
214     mutable MCAuto<MEDCouplingUMesh> _m;
215   };
216
217   class MEDFileUMeshAggregateCompute : public BigMemoryObject
218   {
219   public:
220     MEDFileUMeshAggregateCompute();
221     std::string getClassName() const override { return std::string("MEDFileUMeshAggregateCompute"); }
222     void setName(const std::string& name);
223     void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
224     void assignDefParts(const std::vector<const PartDefinition *>& partDefs);
225     void assignUMesh(MEDCouplingUMesh *m);
226     MEDCouplingUMesh *getUmesh() const;
227     mcIdType getNumberOfCells() const;
228     void highlightUsedNodes(std::vector<bool>& nodesToBeHighlighted) const;
229     std::vector<MEDCoupling1GTUMesh *> getParts() const;
230     std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
231     mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
232     std::vector<MEDCoupling1GTUMesh *> retrievePartsWithoutComputation() const;
233     MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
234     void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const;
235     void renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N);
236     bool isStoredSplitByType() const;
237     std::size_t getTimeOfThis() const;
238     std::size_t getHeapMemorySizeWithoutChildren() const;
239     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
240     MEDFileUMeshAggregateCompute deepCopy(DataArrayDouble *coords) const;
241     void shallowCpyMeshes();
242     bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const;
243     void checkConsistency() const;
244     void clearNonDiscrAttributes() const;
245     void synchronizeTinyInfo(const MEDFileMesh& master) const;
246     bool empty() const;
247     int getMeshDimension() const;
248     std::vector<mcIdType> getDistributionOfTypes() const;
249     mcIdType getSize() const;
250     void setCoords(DataArrayDouble *coords);
251     void forceComputationOfPartsFromUMesh() const;
252     const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
253     void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
254     void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
255   private:
256     std::size_t getTimeOfParts() const;
257     std::size_t getTimeOfUMesh() const;
258   private:
259     mutable std::vector< MCAuto<MEDCoupling1GTUMesh> > _m_parts;
260     mutable std::size_t _mp_time;
261     mutable std::size_t _m_time;
262     mutable MCAuto<MEDCouplingUMesh> _m;
263     mutable std::vector< MCAuto<PartDefinition> > _part_def;
264   };
265
266   class MEDFileUMeshSplitL1 : public RefCountObject
267   {
268     friend class MEDFileUMeshPermCompute;
269     friend class MEDFileUMesh;
270   public:
271     MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other);
272     MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id);
273     MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m);
274     MEDFileUMeshSplitL1(MEDCouplingUMesh *m);
275     MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld);
276     std::string getClassName() const override { return std::string("MEDFileUMeshSplitL1"); }
277     void setName(const std::string& name);
278     std::size_t getHeapMemorySizeWithoutChildren() const;
279     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
280     MEDFileUMeshSplitL1 *shallowCpyUsingCoords(DataArrayDouble *coords) const;
281     MEDFileUMeshSplitL1 *deepCopy(DataArrayDouble *coords) const;
282     void checkConsistency() const;
283     void setCoords(DataArrayDouble *coords);
284     bool isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const;
285     void clearNonDiscrAttributes() const;
286     void synchronizeTinyInfo(const MEDFileMesh& master) const;
287     void assignMesh(MEDCouplingUMesh *m, bool newOrOld);
288     void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
289     void forceComputationOfParts() const;
290     bool empty() const;
291     bool presenceOfOneFams(const std::vector<mcIdType>& ids) const;
292     int getMeshDimension() const;
293     void simpleRepr(std::ostream& oss) const;
294     mcIdType getSize() const;
295     MEDCouplingUMesh *getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const;
296     DataArrayIdType *getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const;
297     MEDCouplingUMesh *getWholeMesh(bool renum) const;
298     mcIdType getNumberOfCells() const;
299     bool isMeshStoredSplitByType() const { return _m_by_types.isStoredSplitByType(); }
300     std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
301     mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
302     std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); }
303     MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); }
304     DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
305     DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
306     std::vector<mcIdType> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
307     DataArrayIdType *getOrCreateAndGetFamilyField();
308     const DataArrayIdType *getFamilyField() const;
309     const DataArrayIdType *getNumberField() const;
310     const DataArrayAsciiChar *getNameField() const;
311     const DataArrayIdType *getRevNumberField() const;
312     void highlightUsedNodes(std::vector<bool>& nodesToBeHighlighted) const { _m_by_types.highlightUsedNodes(nodesToBeHighlighted); }
313     const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const;
314     void eraseFamilyField();
315     void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
316                               std::map<std::string, std::vector<std::string> >& groups);
317     void checkCoordsConsistency(const DataArrayDouble *coords) const;
318     void write(med_idt fid, const std::string& mName, int mdim) const;
319     //
320     void setFamilyArr(DataArrayIdType *famArr);
321     DataArrayIdType *getFamilyField();
322     void setRenumArr(DataArrayIdType *renumArr);
323     void setNameArr(DataArrayAsciiChar *nameArr);
324     void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
325     //
326     void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
327     //
328     void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
329     void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
330     //
331     static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp);
332     static std::vector<mcIdType> GetNewFamiliesNumber(mcIdType nb, const std::map<std::string,mcIdType>& families);
333     static void TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& fidsGrps, std::map<std::string,mcIdType>& familyIds,
334                                     std::map<mcIdType,mcIdType>& famIdTrad, std::map<mcIdType,std::string>& newfams);
335     static DataArrayIdType *Renumber(const DataArrayIdType *renum, const DataArrayIdType *da);
336     static MEDCouplingUMesh *Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds);
337     static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
338   private:
339     MEDFileUMeshSplitL1();
340     void assignCommonPart();
341     MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const;
342     DataArrayIdType *renumIfNeededArr(const DataArrayIdType *da) const;
343     void computeRevNum() const;
344   private:
345     MEDFileUMeshAggregateCompute _m_by_types;
346     MCAuto<DataArrayIdType> _fam;
347     MCAuto<DataArrayIdType> _num;
348     MCAuto<DataArrayIdType> _global_num;
349     MCAuto<DataArrayAsciiChar> _names;
350     mutable MCAuto<DataArrayIdType> _rev_num;
351     MEDFileUMeshPermCompute _m;
352   };
353
354   class MEDFileEltStruct4Mesh : public RefCountObject
355   {
356   public:
357     static MEDFileEltStruct4Mesh *New(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs);
358     std::string getClassName() const override { return std::string("MEDFileEltStruct4Mesh"); }
359     std::string getGeoTypeName() const { return _geo_type_name; }
360     MCAuto<DataArrayIdType> getConn() const { return _conn; }
361     MCAuto<MEDFileUMeshPerTypeCommon> getMeshDef() const { return _common; }
362     const std::vector< MCAuto<DataArray> >& getVars() const { return _vars; }
363   private:
364     std::size_t getHeapMemorySizeWithoutChildren() const;
365     std::vector<const MEDCoupling::BigMemoryObject*> getDirectChildrenWithNull() const;
366   private:
367     ~MEDFileEltStruct4Mesh() { }
368   private:
369     MEDFileEltStruct4Mesh(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs);
370   private:
371     std::string _geo_type_name;
372     int _geo_type;
373     MCAuto<DataArrayIdType> _conn;
374     MCAuto<MEDFileUMeshPerTypeCommon> _common;
375     std::vector< MCAuto<DataArray> > _vars;
376   };
377 }
378
379 #endif