Salome HOME
Minor doc: isIota()
[tools/medcoupling.git] / src / MEDLoader / MEDFileMesh.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __MEDFILEMESH_HXX__
22 #define __MEDFILEMESH_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileMeshLL.hxx"
26 #include "MEDFileUtilities.txx"
27 #include "MEDCouplingPartDefinition.hxx"
28 #include "MEDFileMeshReadSelector.hxx"
29 #include "MEDFileJoint.hxx"
30 #include "MEDFileEquivalence.hxx"
31
32 #include <map>
33 #include <list>
34
35 namespace MEDCoupling
36 {
37   class MEDFileFieldGlobsReal;
38   class MEDFileField1TSStructItem;
39
40   class MEDFileMesh : public RefCountObject, public MEDFileWritableStandAlone
41   {
42   public:
43     MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
44     MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
45     MEDLOADER_EXPORT static MEDFileMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileMesh>(db); }
46     MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0, MEDFileJoints* joints=0);
47     MEDLOADER_EXPORT static MEDFileMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0, MEDFileJoints* joints=0);
48     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
49     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
50     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
51     MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0;
52     MEDLOADER_EXPORT virtual MEDFileMesh *deepCopy() const = 0;
53     MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0;
54     MEDLOADER_EXPORT virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
55     MEDLOADER_EXPORT virtual void clearNonDiscrAttributes() const;
56     MEDLOADER_EXPORT virtual void setName(const std::string& name);
57     MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
58     MEDLOADER_EXPORT std::string getName() const { return _name; }
59     MEDLOADER_EXPORT std::string getUnivName() const { return _univ_name; }
60     MEDLOADER_EXPORT bool getUnivNameWrStatus() const { return _univ_wr_status; }
61     MEDLOADER_EXPORT void setUnivNameWrStatus(bool newStatus) { _univ_wr_status=newStatus; }
62     MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; }
63     MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; }
64     MEDLOADER_EXPORT void setOrder(int order) { _order=order; }
65     MEDLOADER_EXPORT int getOrder() const { return _order; }
66     MEDLOADER_EXPORT void setIteration(int it) { _iteration=it; }
67     MEDLOADER_EXPORT int getIteration() const { return _iteration; }
68     MEDLOADER_EXPORT void setTimeValue(double time) { _time=time; }
69     MEDLOADER_EXPORT void setTime(int dt, int it, double time) { _time=time; _iteration=dt; _order=it; }
70     MEDLOADER_EXPORT double getTime(int& dt, int& it) const { dt=_iteration; it=_order; return _time; }
71     MEDLOADER_EXPORT double getTimeValue() const { return _time; }
72     MEDLOADER_EXPORT void setTimeUnit(const std::string& unit) { _dt_unit=unit; }
73     MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; }
74     MEDLOADER_EXPORT void setAxisType(MEDCouplingAxisType at) { _axis_type=at; }
75     MEDLOADER_EXPORT MEDCouplingAxisType getAxisType() const { return _axis_type; }
76     MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
77     MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0;
78     MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0;
79     MEDLOADER_EXPORT virtual bool hasImplicitPart() const = 0;
80     MEDLOADER_EXPORT virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0;
81     MEDLOADER_EXPORT virtual void releaseImplicitPartIfAny() const = 0;
82     MEDLOADER_EXPORT virtual std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const = 0;
83     MEDLOADER_EXPORT virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0;
84     MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevels() const = 0;
85     MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevelsExt() const = 0;
86     MEDLOADER_EXPORT virtual std::vector<int> getFamArrNonEmptyLevelsExt() const = 0;
87     MEDLOADER_EXPORT virtual std::vector<int> getNumArrNonEmptyLevelsExt() const = 0;
88     MEDLOADER_EXPORT virtual std::vector<int> getNameArrNonEmptyLevelsExt() const = 0;
89     MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0;
90     MEDLOADER_EXPORT virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0;
91     MEDLOADER_EXPORT virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
92     MEDLOADER_EXPORT virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const = 0;
93     MEDLOADER_EXPORT virtual MEDFileMesh *cartesianize() const = 0;
94     //
95     MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const;
96     MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const;
97     MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const;
98     MEDLOADER_EXPORT bool existsFamily(int famId) const;
99     MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const;
100     MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id);
101     MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id);
102     MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id);
103     MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
104     MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
105     MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
106     MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created);
107     MEDLOADER_EXPORT void setFamilyInfo(const std::map<std::string,int>& info);
108     MEDLOADER_EXPORT void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
109     MEDLOADER_EXPORT void copyFamGrpMapsFrom(const MEDFileMesh& other);
110     MEDLOADER_EXPORT void clearGrpMap();
111     MEDLOADER_EXPORT void clearFamMap();
112     MEDLOADER_EXPORT void clearFamGrpMaps();
113     MEDLOADER_EXPORT const std::map<std::string,int>& getFamilyInfo() const { return _families; }
114     MEDLOADER_EXPORT const std::map<std::string, std::vector<std::string> >& getGroupInfo() const { return _groups; }
115     MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
116     MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
117     MEDLOADER_EXPORT std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
118     MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
119     MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
120     MEDLOADER_EXPORT std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
121     MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
122     MEDLOADER_EXPORT std::vector<std::string> getGroupsNames() const;
123     MEDLOADER_EXPORT std::vector<std::string> getFamiliesNames() const;
124     MEDLOADER_EXPORT std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
125     MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
126     MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
127     MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
128     MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
129     MEDLOADER_EXPORT virtual std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const = 0;
130     MEDLOADER_EXPORT virtual std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const = 0;
131     MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
132     MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
133     MEDLOADER_EXPORT std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
134     MEDLOADER_EXPORT static std::string GetMagicFamilyStr();
135     MEDLOADER_EXPORT void assignFamilyNameWithGroupName();
136     MEDLOADER_EXPORT std::vector<std::string> removeEmptyGroups();
137     MEDLOADER_EXPORT void removeGroup(const std::string& name);
138     MEDLOADER_EXPORT void removeFamily(const std::string& name);
139     MEDLOADER_EXPORT std::vector<std::string> removeOrphanGroups();
140     MEDLOADER_EXPORT std::vector<std::string> removeOrphanFamilies();
141     MEDLOADER_EXPORT void removeFamiliesReferedByNoGroups();
142     MEDLOADER_EXPORT void rearrangeFamilies();
143     MEDLOADER_EXPORT void checkOrphanFamilyZero() const;
144     MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName);
145     MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName);
146     MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId);
147     MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
148     MEDLOADER_EXPORT int getFamilyId(const std::string& name) const;
149     MEDLOADER_EXPORT int getMaxAbsFamilyId() const;
150     MEDLOADER_EXPORT int getMaxFamilyId() const;
151     MEDLOADER_EXPORT int getMinFamilyId() const;
152     MEDLOADER_EXPORT int getTheMaxAbsFamilyId() const;
153     MEDLOADER_EXPORT int getTheMaxFamilyId() const;
154     MEDLOADER_EXPORT int getTheMinFamilyId() const;
155     MEDLOADER_EXPORT virtual int getMaxAbsFamilyIdInArrays() const = 0;
156     MEDLOADER_EXPORT virtual int getMaxFamilyIdInArrays() const = 0;
157     MEDLOADER_EXPORT virtual int getMinFamilyIdInArrays() const = 0;
158     MEDLOADER_EXPORT DataArrayInt *getAllFamiliesIdsReferenced() const;
159     MEDLOADER_EXPORT DataArrayInt *computeAllFamilyIdsInUse() const;
160     MEDLOADER_EXPORT std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const;
161     MEDLOADER_EXPORT std::string getFamilyNameGivenId(int id) const;
162     MEDLOADER_EXPORT bool ensureDifferentFamIdsPerLevel();
163     MEDLOADER_EXPORT void normalizeFamIdsTrio();
164     MEDLOADER_EXPORT void normalizeFamIdsMEDFile();
165     MEDLOADER_EXPORT virtual int getMeshDimension() const = 0;
166     MEDLOADER_EXPORT virtual std::string simpleRepr() const;
167     MEDLOADER_EXPORT virtual std::string advancedRepr() const = 0;
168     //
169     MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum=false);
170     MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) = 0;
171     MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) = 0;
172     MEDLOADER_EXPORT virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) = 0;
173     MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayInt *ids) = 0;
174     MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) = 0;
175     MEDLOADER_EXPORT virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0;
176     MEDLOADER_EXPORT virtual DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0;
177     MEDLOADER_EXPORT DataArrayInt *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt);
178     MEDLOADER_EXPORT virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
179     MEDLOADER_EXPORT virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
180     MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0;
181     MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
182     MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
183     MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
184     MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
185     MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
186     MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
187     MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
188     MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
189     // tools
190     MEDLOADER_EXPORT virtual bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) = 0;
191     MEDLOADER_EXPORT int getNumberOfJoints() const;
192     MEDLOADER_EXPORT MEDFileJoints *getJoints() const;
193     MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints );
194     MEDFileEquivalences *getEquivalences() { return _equiv; }
195     const MEDFileEquivalences *getEquivalences() const { return _equiv; }
196     void killEquivalences() { _equiv=(MEDFileEquivalences *)0; }
197     void initializeEquivalences() { _equiv=MEDFileEquivalences::New(this); }
198   protected:
199     MEDFileMesh();
200     //! protected because no way in MED file API to specify this name
201     void setUnivName(const std::string& name) { _univ_name=name; }
202     void addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName);
203     void dealWithTinyInfo(const MEDCouplingMesh *m);
204     virtual void synchronizeTinyInfoOnLeaves() const = 0;
205     void getFamilyRepr(std::ostream& oss) const;
206     virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames);
207     virtual void changeFamilyIdArr(int oldId, int newId) = 0;
208     virtual std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const = 0;
209     virtual void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) = 0;
210     void loadLLWithAdditionalItems(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
211     void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr);
212     static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp);
213     static void ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
214     static std::string FindOrCreateAndGiveFamilyWithId(std::map<std::string,int>& families, int id, bool& created);
215     static std::string CreateNameNotIn(const std::string& nameTry, const std::vector<std::string>& namesToAvoid);
216     static int PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt);
217     void writeJoints(med_idt fid) const;
218     void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0);
219     void loadEquivalences(med_idt fid);
220     void deepCpyEquivalences(const MEDFileMesh& other);
221     bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const;
222     void getEquivalencesRepr(std::ostream& oss) const;
223     void checkCartesian() const;
224   private:
225     virtual void writeMeshLL(med_idt fid) const = 0;
226   protected:
227     int _order;
228     int _iteration;
229     double _time;
230     std::string _dt_unit;
231     std::string _name;
232     //! this attribute do not impact the state of instance -> mutable
233     mutable std::string _univ_name;
234     bool _univ_wr_status;
235     std::string _desc_name;
236     MEDCouplingAxisType _axis_type;
237     MCAuto<MEDFileJoints> _joints;
238     MCAuto<MEDFileEquivalences> _equiv;
239   protected:
240     std::map<std::string, std::vector<std::string> > _groups;
241     std::map<std::string,int> _families;
242   public:
243     MEDLOADER_EXPORT static const char DFT_FAM_NAME[];
244   };
245
246   class MEDCouplingMappedExtrudedMesh;
247   
248   class MEDFileUMesh : public MEDFileMesh
249   {
250     friend class MEDFileMesh;
251   public:
252     MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
253     MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
254     MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
255     MEDLOADER_EXPORT static MEDFileUMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
256     MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileUMesh>(db); }
257     MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
258     MEDLOADER_EXPORT static MEDFileUMesh *New();
259     MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
260     MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
261     MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; }
262     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
263     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
264     MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
265     MEDLOADER_EXPORT MEDFileUMesh *deepCopy() const;
266     MEDLOADER_EXPORT MEDFileUMesh *shallowCpy() const;
267     MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
268     MEDLOADER_EXPORT void checkConsistency() const;
269     MEDLOADER_EXPORT void checkSMESHConsistency() const;
270     MEDLOADER_EXPORT void clearNodeAndCellNumbers();
271     MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
272     MEDLOADER_EXPORT void setName(const std::string& name);
273     //
274     MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
275     MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const;
276     MEDLOADER_EXPORT int getMinFamilyIdInArrays() const;
277     MEDLOADER_EXPORT int getMeshDimension() const;
278     MEDLOADER_EXPORT int getSpaceDimension() const;
279     MEDLOADER_EXPORT std::string simpleRepr() const;
280     MEDLOADER_EXPORT std::string advancedRepr() const;
281     MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
282     MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
283     MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
284     MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
285     MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
286     MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
287     MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const;
288     MEDLOADER_EXPORT int getNumberOfNodes() const;
289     MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
290     MEDLOADER_EXPORT bool hasImplicitPart() const;
291     MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
292     MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
293     MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
294     MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
295     MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
296     MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
297     MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
298     MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
299     MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
300     MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
301     MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
302     MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
303     MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
304     MEDLOADER_EXPORT DataArrayDouble *getCoords() const;
305     MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
306     MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
307     MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
308     MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
309     MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
310     MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
311     MEDLOADER_EXPORT std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
312     MEDLOADER_EXPORT std::vector< std::pair<int,int> > getAllDistributionOfTypes() const;
313     MEDLOADER_EXPORT MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
314     MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
315     MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
316     MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
317     MEDLOADER_EXPORT void forceComputationOfParts() const;
318     MEDLOADER_EXPORT std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const;
319     MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const;
320     MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
321     MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
322     MEDLOADER_EXPORT int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
323     //
324     MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
325     MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords);
326     MEDLOADER_EXPORT void setCoordsForced(DataArrayDouble *coords);
327     MEDLOADER_EXPORT void eraseGroupsAtLevel(int meshDimRelToMaxExt);
328     MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
329     MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
330     MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
331     MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
332     MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
333     MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax);
334     MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
335     MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
336     MEDLOADER_EXPORT void setMeshes(const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
337     MEDLOADER_EXPORT void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
338     MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
339     MEDLOADER_EXPORT void optimizeFamilies();
340     // tools
341     MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
342     MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
343     MEDLOADER_EXPORT DataArrayInt *zipCoords();
344     MEDLOADER_EXPORT DataArrayInt *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const;
345     MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const;
346     MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
347     MEDLOADER_EXPORT MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
348     MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
349     MEDLOADER_EXPORT MCAuto<MEDFileUMesh> symmetry3DPlane(const double point[3], const double normalVector[3]) const;
350     MEDLOADER_EXPORT static MCAuto<MEDFileUMesh> Aggregate(const std::vector<const MEDFileUMesh *>& meshes);
351     MEDLOADER_EXPORT MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
352     // serialization
353     MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
354                                     std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
355     MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
356                                       std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
357   private:
358     MEDLOADER_EXPORT ~MEDFileUMesh();
359     void writeMeshLL(med_idt fid) const;
360     MEDFileUMesh();
361     MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
362     void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
363     void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
364     void dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs);
365     const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const;
366     MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt);
367     void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const;
368     DataArrayDouble *checkMultiMesh(const std::vector<const MEDCouplingUMesh *>& ms) const;
369     void computeRevNum() const;
370     void synchronizeTinyInfoOnLeaves() const;
371     void changeFamilyIdArr(int oldId, int newId);
372     std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
373     MCAuto<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
374   private:
375     static const char SPE_FAM_STR_EXTRUDED_MESH[];
376   private:
377     std::vector< MCAuto<MEDFileUMeshSplitL1> > _ms;
378     MCAuto<DataArrayDouble> _coords;
379     MCAuto<DataArrayInt> _fam_coords;
380     MCAuto<DataArrayInt> _num_coords;
381     MCAuto<DataArrayAsciiChar> _name_coords;
382     mutable MCAuto<DataArrayInt> _rev_num_coords;
383     MCAuto<PartDefinition> _part_coords;
384   };
385
386   class MEDFileStructuredMesh : public MEDFileMesh
387   {
388     friend class MEDFileMesh;
389   public:
390     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
391     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
392     MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
393     MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const;
394     MEDLOADER_EXPORT int getMinFamilyIdInArrays() const;
395     MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
396     MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
397     MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
398     MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
399     MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
400     MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
401     MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
402     MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
403     MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
404     MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
405     MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
406     MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
407     MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
408     MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
409     MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
410     MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
411     MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
412     MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
413     MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
414     MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
415     MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
416     MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
417     MEDLOADER_EXPORT int getNumberOfNodes() const;
418     MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
419     MEDLOADER_EXPORT bool hasImplicitPart() const;
420     MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
421     MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
422     MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const;
423     MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
424     MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
425     MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
426     MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0;
427     // tools
428     MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
429   protected:
430     ~MEDFileStructuredMesh() { }
431     void changeFamilyIdArr(int oldId, int newId);
432     std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
433     void deepCpyAttributes();
434     void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
435     void writeStructuredLL(med_idt fid, const std::string& maa) const;
436     void buildImplicitPart() const;
437     void buildMinusOneImplicitPartIfNeeded() const;
438     static med_geometry_type GetGeoTypeFromMeshDim(int meshDim);
439   private:
440     static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
441                                       MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells);
442   private:
443     MCAuto<DataArrayInt> _fam_nodes;
444     MCAuto<DataArrayInt> _num_nodes;
445     MCAuto<DataArrayAsciiChar> _names_nodes;
446     MCAuto<DataArrayInt> _fam_cells;
447     MCAuto<DataArrayInt> _num_cells;
448     MCAuto<DataArrayAsciiChar> _names_cells;
449     MCAuto<DataArrayInt> _fam_faces;
450     MCAuto<DataArrayInt> _num_faces;
451     MCAuto<DataArrayAsciiChar> _names_faces;
452     mutable MCAuto<DataArrayInt> _rev_num_nodes;
453     mutable MCAuto<DataArrayInt> _rev_num_cells;
454     mutable MCAuto<MEDCoupling1SGTUMesh> _faces_if_necessary;
455   };
456
457   class MEDFileCMesh : public MEDFileStructuredMesh
458   {
459     friend class MEDFileMesh;
460   public:
461     MEDLOADER_EXPORT static MEDFileCMesh *New();
462     MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
463     MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
464     MEDLOADER_EXPORT static MEDFileCMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileCMesh>(db); }
465     MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
466     MEDLOADER_EXPORT static MEDFileCMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
467     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
468     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
469     MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
470     MEDLOADER_EXPORT MEDFileCMesh *deepCopy() const;
471     MEDLOADER_EXPORT MEDFileCMesh *shallowCpy() const;
472     MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
473     MEDLOADER_EXPORT int getMeshDimension() const;
474     MEDLOADER_EXPORT int getSpaceDimension() const;
475     MEDLOADER_EXPORT std::string simpleRepr() const;
476     MEDLOADER_EXPORT std::string advancedRepr() const;
477     MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
478     MEDLOADER_EXPORT const MEDCouplingCMesh *getMesh() const;
479     MEDLOADER_EXPORT void setMesh(MEDCouplingCMesh *m);
480     MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
481   private:
482     ~MEDFileCMesh() { }
483     const MEDCouplingStructuredMesh *getStructuredMesh() const;
484     void writeMeshLL(med_idt fid) const;
485     MEDFileCMesh();
486     void synchronizeTinyInfoOnLeaves() const;
487     MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
488     void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
489   private:
490     MCAuto<MEDCouplingCMesh> _cmesh;
491   };
492
493   class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
494   {
495     friend class MEDFileMesh;
496   public:
497     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New();
498     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
499     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, MEDFileMeshReadSelector *mrs=0);
500     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileCurveLinearMesh>(db); }
501     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
502     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(med_idt fid, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
503     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
504     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
505     MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
506     MEDLOADER_EXPORT MEDFileCurveLinearMesh *deepCopy() const;
507     MEDLOADER_EXPORT MEDFileCurveLinearMesh *shallowCpy() const;
508     MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
509     MEDLOADER_EXPORT int getMeshDimension() const;
510     MEDLOADER_EXPORT std::string simpleRepr() const;
511     MEDLOADER_EXPORT std::string advancedRepr() const;
512     MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
513     MEDLOADER_EXPORT const MEDCouplingCurveLinearMesh *getMesh() const;
514     MEDLOADER_EXPORT void setMesh(MEDCouplingCurveLinearMesh *m);
515     MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
516   private:
517     ~MEDFileCurveLinearMesh() { }
518     MEDFileCurveLinearMesh();
519     MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
520     const MEDCouplingStructuredMesh *getStructuredMesh() const;
521     void synchronizeTinyInfoOnLeaves() const;
522     void writeMeshLL(med_idt fid) const;
523     void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp
524   private:
525     MCAuto<MEDCouplingCurveLinearMesh> _clmesh;
526   };
527
528   class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
529   {
530   public:
531     MEDLOADER_EXPORT static MEDFileMeshMultiTS *New();
532     MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(med_idt fid);
533     MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName);
534     MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(med_idt fid, const std::string& mName);
535     MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
536     MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCopy() const;
537     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
538     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
539     MEDLOADER_EXPORT std::string getName() const;
540     MEDLOADER_EXPORT void setName(const std::string& newMeshName);
541     MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
542     MEDLOADER_EXPORT void cartesianizeMe();
543     MEDLOADER_EXPORT MEDFileMesh *getOneTimeStep() const;
544     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
545     MEDLOADER_EXPORT void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
546     MEDLOADER_EXPORT MEDFileJoints *getJoints() const;
547     MEDLOADER_EXPORT void setJoints(MEDFileJoints* joints);
548   private:
549     ~MEDFileMeshMultiTS() { }
550     void loadFromFile(med_idt fid, const std::string& mName);
551     MEDFileMeshMultiTS();
552     MEDFileMeshMultiTS(med_idt fid);
553     MEDFileMeshMultiTS(med_idt fid, const std::string& mName);
554   private:
555     std::vector< MCAuto<MEDFileMesh> > _mesh_one_ts;
556   };
557
558   class MEDFileMeshesIterator;
559
560   class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
561   {
562   public:
563     MEDLOADER_EXPORT static MEDFileMeshes *New();
564     MEDLOADER_EXPORT static MEDFileMeshes *New(med_idt fid);
565     MEDLOADER_EXPORT static MEDFileMeshes *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileMeshes>(db); }
566     MEDLOADER_EXPORT static MEDFileMeshes *New(const std::string& fileName);
567     MEDLOADER_EXPORT MEDFileMeshes *deepCopy() const;
568     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
569     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
570     MEDLOADER_EXPORT std::string simpleRepr() const;
571     MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
572     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
573     MEDLOADER_EXPORT int getNumberOfMeshes() const;
574     MEDLOADER_EXPORT MEDFileMeshesIterator *iterator();
575     MEDLOADER_EXPORT MEDFileMesh *getMeshAtPos(int i) const;
576     MEDLOADER_EXPORT MEDFileMesh *getMeshWithName(const std::string& mname) const;
577     MEDLOADER_EXPORT std::vector<std::string> getMeshesNames() const;
578     MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
579     MEDLOADER_EXPORT void cartesianizeMe();
580     //
581     MEDLOADER_EXPORT void resize(int newSize);
582     MEDLOADER_EXPORT void pushMesh(MEDFileMesh *mesh);
583     MEDLOADER_EXPORT void setMeshAtPos(int i, MEDFileMesh *mesh);
584     MEDLOADER_EXPORT void destroyMeshAtPos(int i);
585   private:
586     ~MEDFileMeshes() { }
587     void checkConsistencyLight() const;
588     void loadFromFile(med_idt fid);
589     MEDFileMeshes();
590     MEDFileMeshes(med_idt fid);
591   private:
592     std::vector< MCAuto<MEDFileMeshMultiTS> > _meshes;
593   };
594
595   class MEDFileMeshesIterator
596   {
597   public:
598     MEDLOADER_EXPORT MEDFileMeshesIterator(MEDFileMeshes *ms);
599     MEDLOADER_EXPORT ~MEDFileMeshesIterator();
600     MEDLOADER_EXPORT MEDFileMesh *nextt();
601   private:
602     MCAuto<MEDFileMeshes> _ms;
603     int _iter_id;
604     int _nb_iter;
605   };
606 }
607
608 #endif