Salome HOME
Merge from V6_main 13/12/2012
[tools/medcoupling.git] / src / MEDLoader / MEDFileMesh.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __MEDFILEMESH_HXX__
22 #define __MEDFILEMESH_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileMeshLL.hxx"
26 #include "MEDFileUtilities.hxx"
27
28 #include <map>
29
30 namespace ParaMEDMEM
31 {
32   class MEDLOADER_EXPORT MEDFileMesh : public RefCountObject, public MEDFileWritable
33   {
34   public:
35     static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
36     static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
37     virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
38     virtual void clearNonDiscrAttributes() const;
39     void setName(const char *name) { _name=name; }
40     bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
41     const char *getName() const { return _name.c_str(); }
42     void setUnivName(const char *name) { _univ_name=name; }
43     const char *getUnivName() const { return _univ_name.c_str(); }
44     void setDescription(const char *name) { _desc_name=name; }
45     const char *getDescription() const { return _desc_name.c_str(); }
46     void setOrder(int order) { _order=order; }
47     int getOrder() const { return _order; }
48     void setIteration(int it) { _iteration=it; }
49     int getIteration() const { return _iteration; }
50     void setTimeValue(double time) { _time=time; }
51     void setTime(int dt, int it, double time) { _time=time; _iteration=dt; _order=it; }
52     double getTime(int& dt, int& it) { dt=_iteration; it=_order; return _time; }
53     double getTimeValue() const { return _time; }
54     void setTimeUnit(const char *unit) { _dt_unit=unit; }
55     const char *getTimeUnit() const { return _dt_unit.c_str(); }
56     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception) = 0;
57     virtual std::vector<int> getNonEmptyLevels() const = 0;
58     virtual std::vector<int> getNonEmptyLevelsExt() const = 0;
59     virtual void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
60     virtual void write(med_idt fid) const throw(INTERP_KERNEL::Exception);
61     virtual int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
62     virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception) = 0;
63     //
64     bool areFamsEqual(const MEDFileMesh *other, std::string& what) const;
65     bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const;
66     bool existsGroup(const char *groupName) const;
67     bool existsFamily(int famId) const;
68     bool existsFamily(const char *familyName) const;
69     void setFamilyId(const char *familyName, int id);
70     void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
71     virtual void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
72     virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
73     virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
74     void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
75     std::string findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception);
76     void setFamilyInfo(const std::map<std::string,int>& info);
77     void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
78     void copyFamGrpMapsFrom(const MEDFileMesh& other);
79     const std::map<std::string,int>& getFamilyInfo() const { return _families; }
80     const std::map<std::string, std::vector<std::string> >& getGroupInfo() const { return _groups; }
81     std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
82     std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
83     std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
84     void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
85     void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
86     std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
87     void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
88     std::vector<std::string> getGroupsNames() const;
89     std::vector<std::string> getFamiliesNames() const;
90     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
91     void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
92     void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
93     void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
94     void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
95     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
96     int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
97     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
98     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
99     DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
100     std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
101     std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
102     bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
103     void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
104     void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
105     virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception) = 0;
106     virtual std::string simpleRepr() const;
107     virtual std::string advancedRepr() const = 0;
108     //
109     virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum=false) throw(INTERP_KERNEL::Exception);
110     virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) = 0;
111     virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception) = 0;
112     virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
113     virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
114     virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
115     virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception) = 0;
116     virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
117     virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
118     virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
119     virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
120     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
121     virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
122     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
123     // tools
124     virtual bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception) = 0;
125   protected:
126     MEDFileMesh();
127     void addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName) throw(INTERP_KERNEL::Exception);
128     virtual void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) = 0;
129     void dealWithTinyInfo(const MEDCouplingMesh *m) throw(INTERP_KERNEL::Exception);
130     virtual void synchronizeTinyInfoOnLeaves() const = 0;
131     void getFamilyRepr(std::ostream& oss) const;
132     virtual void appendFamilyEntries(const std::set<int>& famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames);
133     virtual void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception) = 0;
134     static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp);
135     static std::string CreateNameNotIn(const std::string& nameTry, const std::vector<std::string>& namesToAvoid) throw(INTERP_KERNEL::Exception);
136     static int PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt) throw(INTERP_KERNEL::Exception);
137   protected:
138     int _order;
139     int _iteration;
140     double _time;
141     std::string _dt_unit;
142     std::string _name;
143     std::string _univ_name;
144     std::string _desc_name;
145   protected:
146     std::map<std::string, std::vector<std::string> > _groups;
147     std::map<std::string,int> _families;
148   public:
149     static const char DFT_FAM_NAME[];
150   };
151
152   class MEDLOADER_EXPORT MEDFileUMesh : public MEDFileMesh
153   {
154     friend class MEDFileMesh;
155   public:
156     static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
157     static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
158     static MEDFileUMesh *New();
159     bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
160     void clearNonDiscrAttributes() const;
161     ~MEDFileUMesh();
162     //
163     int getMeshDimension() const throw(INTERP_KERNEL::Exception);
164     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
165     std::string simpleRepr() const;
166     std::string advancedRepr() const;
167     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
168     const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
169     const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
170     const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
171     int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
172     std::vector<int> getNonEmptyLevels() const;
173     std::vector<int> getNonEmptyLevelsExt() const;
174     std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
175     std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
176     std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
177     std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
178     std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
179     std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
180     std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
181     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
182     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
183     DataArrayDouble *getCoords() const;
184     MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
185     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
186     MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
187     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
188     DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
189     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
190     MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
191     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
192     MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
193     MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
194     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
195     //
196     void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
197     void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
198     void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
199     void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
200     void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
201     void addNodeGroup(const std::string& name, const std::vector<int>& ids) throw(INTERP_KERNEL::Exception);
202     void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
203     void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
204     void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
205     void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
206     void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
207     void optimizeFamilies() throw(INTERP_KERNEL::Exception);
208     void duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) throw(INTERP_KERNEL::Exception);
209     // tools
210     bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception);
211   private:
212     void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
213     MEDFileUMesh();
214     MEDFileUMesh(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception);
215     void loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception);
216     const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
217     MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
218     void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const throw(INTERP_KERNEL::Exception);
219     DataArrayDouble *checkMultiMesh(const std::vector<const MEDCouplingUMesh *>& ms) const throw(INTERP_KERNEL::Exception);
220     void computeRevNum() const;
221     void synchronizeTinyInfoOnLeaves() const;
222     void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception);
223   private:
224     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> > _ms;
225     MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
226     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_coords;
227     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_coords;
228     mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_coords;
229   };
230
231   class MEDLOADER_EXPORT MEDFileCMesh : public MEDFileMesh
232   {
233     friend class MEDFileMesh;
234   public:
235     static MEDFileCMesh *New();
236     static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
237     static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
238     bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
239     int getMeshDimension() const throw(INTERP_KERNEL::Exception);
240     std::string simpleRepr() const;
241     std::string advancedRepr() const;
242     void clearNonDiscrAttributes() const;
243     const MEDCouplingCMesh *getMesh() const;
244     MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
245     void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
246     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
247     DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
248     void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
249     void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
250     int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
251     std::vector<int> getNonEmptyLevels() const;
252     std::vector<int> getNonEmptyLevelsExt() const;
253     const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
254     const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
255     const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
256     // tools
257     bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception);
258   private:
259     void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
260     MEDFileCMesh();
261     void synchronizeTinyInfoOnLeaves() const;
262     MEDFileCMesh(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception);
263     void loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception);
264     void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception);
265   private:
266     MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> _cmesh;
267     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_nodes;
268     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_nodes;
269     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_cells;
270     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_cells;
271     mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_nodes;
272     mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_cells;
273   };
274
275   class MEDLOADER_EXPORT MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
276   {
277   public:
278     static MEDFileMeshMultiTS *New();
279     static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
280     static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
281     const char *getName() const throw(INTERP_KERNEL::Exception);
282     void setName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
283     bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
284     MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception);
285     void write(med_idt fid) const throw(INTERP_KERNEL::Exception);
286     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
287     void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
288   private:
289     void loadFromFile(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
290     MEDFileMeshMultiTS();
291     MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
292     MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
293   private:
294     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> > _mesh_one_ts;
295   };
296
297   class MEDFileMeshesIterator;
298
299   class MEDLOADER_EXPORT MEDFileMeshes : public RefCountObject, public MEDFileWritable
300   {
301   public:
302     static MEDFileMeshes *New();
303     static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
304     std::string simpleRepr() const;
305     void simpleReprWithoutHeader(std::ostream& oss) const;
306     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
307     void write(med_idt fid) const throw(INTERP_KERNEL::Exception);
308     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
309     MEDFileMeshesIterator *iterator() throw(INTERP_KERNEL::Exception);
310     MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception);
311     MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception);
312     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
313     bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
314     //
315     void resize(int newSize) throw(INTERP_KERNEL::Exception);
316     void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
317     void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
318     void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
319   private:
320     void checkCoherency() const throw(INTERP_KERNEL::Exception);
321     void loadFromFile(const char *fileName) throw(INTERP_KERNEL::Exception);
322     MEDFileMeshes();
323     MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception);
324   private:
325     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> > _meshes;
326   };
327
328   class MEDCOUPLING_EXPORT MEDFileMeshesIterator
329   {
330   public:
331     MEDFileMeshesIterator(MEDFileMeshes *ms);
332     ~MEDFileMeshesIterator();
333     MEDFileMesh *nextt();
334   private:
335     MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _ms;
336      int _iter_id;
337      int _nb_iter;
338   };
339 }
340
341 #endif