Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
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
20 %module MEDLoader
21
22 #define MEDCOUPLING_EXPORT
23 #define MEDLOADER_EXPORT
24
25 %include "MEDCouplingCommon.i"
26
27 %{
28 #include "MEDLoader.hxx"
29 #include "MEDFileMesh.hxx"
30 #include "MEDFileField.hxx"
31 #include "MEDFileData.hxx"
32 #include "MEDLoaderTypemaps.i"
33 #include "SauvReader.hxx"
34 #include "SauvWriter.hxx"
35
36 using namespace ParaMEDMEM;
37 %}
38
39 #if SWIG_VERSION >= 0x010329
40 %template()  std::vector<std::string>;
41 #endif
42
43 %typemap(out) ParaMEDMEM::MEDFileMesh*
44 {
45   $result=convertMEDFileMesh($1,$owner);
46 }
47
48 %newobject MEDLoader::ReadUMeshFromFamilies;
49 %newobject MEDLoader::ReadUMeshFromGroups;
50 %newobject MEDLoader::ReadUMeshFromFile;
51 %newobject MEDLoader::ReadField;
52 %newobject MEDLoader::ReadFieldCell;
53 %newobject MEDLoader::ReadFieldNode;
54 %newobject MEDLoader::ReadFieldGauss;
55 %newobject MEDLoader::ReadFieldGaussNE;
56 %newobject ParaMEDMEM::MEDFileMesh::New;
57 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
58 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
59 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
60 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
61 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
62 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
63 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
64 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
65 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
66 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
67 %newobject ParaMEDMEM::MEDFileUMesh::New;
68 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
69 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
70 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
71 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
72 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
73 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
74 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
75 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
76 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
77 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
78 %newobject ParaMEDMEM::MEDFileCMesh::New;
79 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
80 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
81 %newobject ParaMEDMEM::MEDFileMeshes::New;
82 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
83 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
84 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
85 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
86
87 %newobject ParaMEDMEM::MEDFileFields::New;
88 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
89 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
90 %newobject ParaMEDMEM::MEDFileFields::__getitem__;
91 %newobject ParaMEDMEM::MEDFileFields::__iter__;
92 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
93 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
94 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
95 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
96 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
97 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
98 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
99 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
100 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
101 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
102 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
103 %newobject ParaMEDMEM::MEDFileField1TS::New;
104 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
105 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
106 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
107 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
108 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
109
110 %newobject ParaMEDMEM::MEDFileData::New;
111 %newobject ParaMEDMEM::MEDFileData::getMeshes;
112 %newobject ParaMEDMEM::MEDFileData::getFields;
113
114 %newobject ParaMEDMEM::SauvWriter::New;
115 %newobject ParaMEDMEM::SauvReader::New;
116 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
117
118 %feature("unref") MEDFileMesh "$this->decrRef();"
119 %feature("unref") MEDFileUMesh "$this->decrRef();"
120 %feature("unref") MEDFileCMesh "$this->decrRef();"
121 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
122 %feature("unref") MEDFileMeshes "$this->decrRef();"
123 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
124 %feature("unref") MEDFileField1TS "$this->decrRef();"
125 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
126 %feature("unref") MEDFileFields "$this->decrRef();"
127 %feature("unref") MEDFileData "$this->decrRef();"
128 %feature("unref") SauvReader "$this->decrRef();"
129 %feature("unref") SauvWriter "$this->decrRef();"
130
131 class MEDLoader
132 {
133 public:
134   static void setEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
135   static void setCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
136   static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
137   static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
138   static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
139   static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
140   static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
141   static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
142   static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
143   static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
144   static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
145   static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
146   static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
147   static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
148   static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
149   static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
150   %extend
151      {
152        static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
153        {
154          std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
155          PyObject *ret=PyList_New(res.size());
156          int rk=0;
157          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
158            {
159              PyObject *elt=PyTuple_New(2);
160              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
161              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
162              PyList_SetItem(ret,rk,elt);
163            }
164          return ret;
165        }
166
167        static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
168        {
169          std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
170          PyObject *ret=PyList_New(res.size());
171          int rk=0;
172          for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
173            {
174              PyObject *elt=PyTuple_New(3);
175              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
176              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
177              PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
178              PyList_SetItem(ret,rk,elt);
179            }
180          return ret;
181        }
182
183        static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
184        {
185          std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
186          PyObject *ret=PyList_New(res.size());
187          int rk=0;
188          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
189            {
190              PyObject *elt=PyTuple_New(2);
191              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
192              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
193              PyList_SetItem(ret,rk,elt);
194            }
195          return ret;
196        }
197        static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
198        {
199          std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
200          PyObject *ret=PyList_New(res.size());
201          int rk=0;
202          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
203            {
204              PyObject *elt=PyTuple_New(2);
205              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
206              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
207              PyList_SetItem(ret,rk,elt);
208            }
209          return ret;
210        }
211        static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
212        {
213          std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
214          PyObject *ret=PyList_New(res.size());
215          int rk=0;
216          for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
217            {
218              PyObject *elt=PyTuple_New(2);
219              PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
220              PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
221              PyList_SetItem(ret,rk,elt);
222            }
223          return ret;
224        }
225        static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
226        {
227          int meshDim,spaceDim,numberOfNodes;
228          std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
229          PyObject *ret=PyTuple_New(4);
230          PyObject *elt0=PyList_New(res.size());
231          int i=0;
232          for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
233            {
234              const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
235              int j=0;
236              PyObject *elt1=PyList_New(obj2.size());
237              for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
238                {
239                  PyObject *elt2=PyTuple_New(2);
240                  PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
241                  PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
242                  PyList_SetItem(elt1,j,elt2);
243                }
244              PyList_SetItem(elt0,i,elt1);
245            }
246          PyTuple_SetItem(ret,0,elt0);
247          PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
248          PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
249          PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
250          return ret;
251        }
252        static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
253                                              const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
254        {
255          std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
256          std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
257          return convertFieldDoubleVecToPy(res);
258        }
259        static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
260        {
261          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
262          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
263          MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
264        }
265        static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
266        {
267          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
268          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
269          MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
270        }
271        static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
272        {
273          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
274          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
275          MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
276        }
277        static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
278        {
279          std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
280          int size=v.size();
281          PyObject *ret=PyList_New(size);
282          for(int i=0;i<size;i++)
283            PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
284          return ret;
285        }
286        static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
287        {
288          std::vector<std::string> grps;
289          converPyListToVecString(li,grps);
290          return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
291        }
292        static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
293        {
294          std::vector<std::string> fams;
295          converPyListToVecString(li,fams);
296          return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
297        }
298      }
299   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
300   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
301   static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
302   static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
303   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
304   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
305   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
306   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
307   static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
308   static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
309   static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
310   static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
311   static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
312 };
313
314 namespace ParaMEDMEM
315 {
316   class MEDFileWritable
317   {
318   public:
319     void copyOptionsFrom(const MEDFileWritable& other) const;
320     int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
321     void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
322     int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
323     void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
324   };
325
326   class MEDFileMesh : public RefCountObject, public MEDFileWritable
327   {
328   public:
329     static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
330     static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1);
331     virtual void clearNonDiscrAttributes() const;
332     void setName(const char *name);
333     const char *getName();
334     void setUnivName(const char *name);
335     const char *getUnivName() const;
336     void setDescription(const char *name);
337     const char *getDescription() const;
338     void setOrder(int order);
339     int getOrder() const;
340     void setIteration(int it);
341     int getIteration();
342     void setTimeValue(double time);
343     void setTime(int dt, int it, double time);
344     double getTimeValue() const;
345     void setTimeUnit(const char *unit);
346     const char *getTimeUnit() const;
347     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
348     std::vector<int> getNonEmptyLevels() const;
349     std::vector<int> getNonEmptyLevelsExt() const;
350     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
351     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
352     //
353     bool existsGroup(const char *groupName) const;
354     bool existsFamily(int famId) const;
355     bool existsFamily(const char *familyName) const;
356     void setFamilyId(const char *familyName, int id);
357     void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
358     void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
359     void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
360     virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
361     virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
362     void copyFamGrpMapsFrom(const MEDFileMesh& other);
363     const std::map<std::string,int>& getFamilyInfo() const;
364     const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
365     std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
366     std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
367     std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
368     void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
369     void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
370     std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
371     void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
372     std::vector<std::string> getGroupsNames() const;
373     std::vector<std::string> getFamiliesNames() const;
374     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
375     void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
376     void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
377     void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
378     void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
379     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
380     void setFamilyInfo(const std::map<std::string,int>& info);
381     void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
382     int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
383     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
384     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
385     DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
386     std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
387     std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
388     bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
389     void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
390     void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
391     virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
392     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
393     virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
394     //
395     virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
396     virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
397     virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
398     virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
399     virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
400     virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
401     virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
402     virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
403     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
404     virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
405     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
406     %extend
407        {
408          MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
409          {
410            return MEDFileMesh::New(fileName);
411          }
412
413          MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1)
414          {
415            return MEDFileMesh::New(fileName,mName,dt,it);
416          }
417          
418          std::string __str__() const throw(INTERP_KERNEL::Exception)
419          {
420            return self->simpleRepr();
421          }
422
423          PyObject *getTime() throw(INTERP_KERNEL::Exception)
424          {
425            int tmp1,tmp2;
426            double tmp0=self->getTime(tmp1,tmp2);
427            PyObject *res = PyList_New(3);
428            PyList_SetItem(res,0,SWIG_From_int(tmp1));
429            PyList_SetItem(res,1,SWIG_From_int(tmp2));
430            PyList_SetItem(res,2,SWIG_From_double(tmp0));
431            return res;
432          }
433
434          virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
435          {
436            std::string what;
437            bool ret0=self->isEqual(other,eps,what);
438            PyObject *res=PyList_New(2);
439            PyObject *ret0Py=ret0?Py_True:Py_False;
440            Py_XINCREF(ret0Py);
441            PyList_SetItem(res,0,ret0Py);
442            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
443            return res;
444          }
445          
446          PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
447          {
448            std::string what;
449            bool ret0=self->areFamsEqual(other,what);
450            PyObject *res=PyList_New(2);
451            PyObject *ret0Py=ret0?Py_True:Py_False;
452            Py_XINCREF(ret0Py);
453            PyList_SetItem(res,0,ret0Py);
454            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
455            return res;
456          }
457
458          PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
459          {
460            std::string what;
461            bool ret0=self->areGrpsEqual(other,what);
462            PyObject *res=PyList_New(2);
463            PyObject *ret0Py=ret0?Py_True:Py_False;
464            Py_XINCREF(ret0Py);
465            PyList_SetItem(res,0,ret0Py);
466            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
467            return res;
468          }
469
470          PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
471          {
472            const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
473            if(tmp)
474              tmp->incrRef();
475            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
476          }
477
478          PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
479          {
480            const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
481            if(tmp)
482              tmp->incrRef();
483            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
484          }
485
486          PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
487          {
488            bool ret1;
489            std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
490            PyObject *ret=PyTuple_New(2);
491            PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
492            PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
493            return ret;
494          }
495          
496          PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
497          {
498            DataArrayInt *ret3=0;
499            std::vector<int> ret1,ret2;
500            bool ret0=self->unPolyze(ret1,ret2,ret3);
501            PyObject *ret=PyTuple_New(4);
502            PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
503            //
504            PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
505            for(int j=0;j<(int)ret1.size()/3;j++)
506              {
507                PyObject *retLev2=PyList_New(3);
508                PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
509                PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
510                PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
511                PyList_SetItem(retLev1_0,j,retLev2);
512              }
513            PyTuple_SetItem(ret,1,retLev1_0);
514            //
515            PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
516            for(int j=0;j<(int)ret2.size()/3;j++)
517              {
518                PyObject *retLev2=PyList_New(3);
519                PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
520                PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
521                PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
522                PyList_SetItem(retLev1_1,j,retLev2);
523              }
524            PyTuple_SetItem(ret,2,retLev1_1);
525            //
526            PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
527            return ret;
528          }
529        }
530   };
531
532   class MEDFileUMesh : public MEDFileMesh
533   {
534   public:
535     static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
536     static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
537     static MEDFileUMesh *New();
538     ~MEDFileUMesh();
539     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
540     //
541     std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
542     std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
543     std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
544     std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
545     std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
546     std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
547     std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
548     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
549     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
550     MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
551     DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
552     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
553     DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
554     MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
555     DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
556     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
557     DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
558     DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
559     DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
560     DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
561     DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
562     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
563     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
564     MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
565     MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
566     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
567     //
568     void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
569     void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
570     void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
571     void addNodeGroup(const std::string& name, const std::vector<int>& ids) throw(INTERP_KERNEL::Exception);
572     void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
573     void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
574     void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
575     void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
576     void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
577     void optimizeFamilies() throw(INTERP_KERNEL::Exception);
578     %extend
579        { 
580          MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
581          {
582            return MEDFileUMesh::New(fileName,mName,dt,it);
583          }
584
585          MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
586          {
587            return MEDFileUMesh::New(fileName);
588          }
589
590          MEDFileUMesh()
591          {
592            return MEDFileUMesh::New();
593          }
594          
595          PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
596          {
597            const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
598            if(tmp)
599              tmp->incrRef();
600            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
601          }
602          
603          void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
604          {
605            std::vector<const DataArrayInt *> grps;
606            convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
607            self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
608          }
609
610          DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
611          {
612            DataArrayDouble *ret=self->getCoords();
613            if(ret)
614              ret->incrRef();
615            return ret;
616          }
617
618          PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
619          {
620            DataArrayInt *ret0=0,*ret1=0,*ret2=0;
621            self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
622            PyObject *ret=PyTuple_New(3);
623            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
624            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
625            PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
626            return ret;
627          }
628        }
629   };
630
631   class MEDFileCMesh : public MEDFileMesh
632   {
633   public:
634     static MEDFileCMesh *New();
635     static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
636     static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
637     void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
638     %extend
639        {
640          MEDFileCMesh()
641          {
642            return MEDFileCMesh::New();
643          }
644
645          MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
646          {
647            return MEDFileCMesh::New(fileName);
648          }
649
650          MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
651          {
652            return MEDFileCMesh::New(fileName,mName,dt,it);
653          }
654          
655          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
656          {
657            const MEDCouplingCMesh *tmp=self->getMesh();
658            if(tmp)
659              tmp->incrRef();
660            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
661          }
662        }
663   };
664
665   class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
666   {
667   public:
668     static MEDFileMeshMultiTS *New();
669     static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
670     static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
671     const char *getName() const throw(INTERP_KERNEL::Exception);
672     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
673     void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
674     %extend
675        { 
676          MEDFileMeshMultiTS()
677          {
678            return MEDFileMeshMultiTS::New();
679          }
680
681          MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
682          {
683            return MEDFileMeshMultiTS::New(fileName);
684          }
685
686          MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
687          {
688            return MEDFileMeshMultiTS::New(fileName,mName);
689          }
690
691          MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
692            {
693              MEDFileMesh *ret=self->getOneTimeStep();
694              if(ret)
695                ret->incrRef();
696              return ret;
697            }
698        }
699   };
700
701   class MEDFileMeshesIterator
702   {
703   public:
704     %extend
705     {
706       PyObject *next() throw(INTERP_KERNEL::Exception)
707       {
708         MEDFileMesh *ret=self->nextt();
709         if(ret)
710           {
711             ret->incrRef();
712             return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
713           }
714         else
715           {
716             PyErr_SetString(PyExc_StopIteration,"No more data.");
717             return 0;
718           }
719       }
720     }
721   };
722
723   class MEDFileMeshes : public RefCountObject, public MEDFileWritable
724   {
725   public:
726     static MEDFileMeshes *New();
727     static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
728     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
729     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
730     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
731     //
732     void resize(int newSize) throw(INTERP_KERNEL::Exception);
733     void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
734     void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
735     void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
736     %extend
737        {
738          MEDFileMeshes()
739          {
740            return MEDFileMeshes::New();
741          }
742
743          MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
744          {
745            return MEDFileMeshes::New(fileName);
746          }
747
748          std::string __str__() const
749            {
750              return self->simpleRepr();
751            }
752
753          MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
754          {
755            if(PyInt_Check(obj))
756              {
757                MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
758                if(ret)
759                  ret->incrRef();
760                return ret;
761              }
762            else if(PyString_Check(obj))
763              {
764                MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
765                if(ret)
766                  ret->incrRef();
767                return ret;
768              }
769            else
770              throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
771          }
772
773          MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
774          {
775            self->setMeshAtPos(obj,mesh);
776            return self;
777          }
778
779          MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
780          {
781            return self->iterator();
782          }
783          
784          MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
785            {
786              MEDFileMesh *ret=self->getMeshAtPos(i);
787              if(ret)
788                ret->incrRef();
789              return ret;
790            }
791          MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
792            {
793              MEDFileMesh *ret=self->getMeshWithName(mname);
794              if(ret)
795                ret->incrRef();
796              return ret;
797            }
798        }
799   };
800
801   class MEDFileFieldLoc : public RefCountObject
802   {
803   public:
804     const std::string& getName() const;
805     int getDimension() const;
806     int getNumberOfGaussPoints() const;
807     int getNumberOfPointsInCells() const;
808     const std::vector<double>& getRefCoords() const;
809     const std::vector<double>& getGaussCoords() const;
810     const std::vector<double>& getGaussWeights() const;
811     bool isEqual(const MEDFileFieldLoc& other, double eps) const;
812   %extend
813     {
814       std::string __str__() const throw(INTERP_KERNEL::Exception)
815       {
816         return self->repr();
817       }
818     }
819   };
820
821   class MEDFileFieldGlobsReal
822   {
823   public:
824     void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
825     std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
826     std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
827     bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
828     bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
829     std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
830     std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
831     std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
832     std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
833     virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
834     virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
835     virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
836     virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
837     void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
838     void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
839     void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
840     void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
841     int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
842     int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
843   %extend
844      {
845        PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
846        {
847          const DataArrayInt *ret=self->getProfile(pflName);
848          if(ret)
849            ret->incrRef();
850          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
851        }
852
853        PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
854        {
855          const DataArrayInt *ret=self->getProfileFromId(pflId);
856          if(ret)
857            ret->incrRef();
858          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
859        }
860
861        PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
862        {
863          const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
864          loc->incrRef();
865          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
866        }
867        
868        PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
869        {
870          const MEDFileFieldLoc *loc=&self->getLocalization(locName);
871          loc->incrRef();
872          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
873        }
874        
875        PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
876        {
877          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
878          return convertVecPairVecStToPy(ret);
879        }
880
881        PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
882        {
883          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
884          return convertVecPairVecStToPy(ret);
885        }
886
887        void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
888        {
889          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
890          self->changePflsNames(v);
891        }
892
893        void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
894        {
895          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
896          self->changePflsRefsNamesGen(v);
897        }
898
899        void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
900        {
901          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
902          self->changePflsNamesInStruct(v);
903        }
904
905        void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
906        {
907          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
908          self->changeLocsNames(v);
909        }
910
911        void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
912        {
913          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
914          self->changeLocsRefsNamesGen(v);
915        }
916        
917        void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
918        {
919          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
920          self->changeLocsNamesInStruct(v);
921        }
922      }
923   };
924
925   class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
926   {
927   public:
928     static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
929     static MEDFileField1TS *New();
930     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
931     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
932     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
933     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
934     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
935     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
936     //
937     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
938     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
939     void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
940     void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
941     void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
942     //
943     int getDimension() const throw(INTERP_KERNEL::Exception);
944     int getIteration() const throw(INTERP_KERNEL::Exception);
945     int getOrder() const throw(INTERP_KERNEL::Exception);
946     std::string getName() throw(INTERP_KERNEL::Exception);
947     void setName(const char *name) throw(INTERP_KERNEL::Exception);
948     std::string getMeshName() throw(INTERP_KERNEL::Exception);
949     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
950     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
951     bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
952     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
953     void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
954     %extend
955        {
956          MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
957          {
958            return MEDFileField1TS::New(fileName,fieldName,iteration,order);
959          }
960
961          MEDFileField1TS()
962          {
963            return MEDFileField1TS::New();
964          }
965          
966          std::string __str__() const throw(INTERP_KERNEL::Exception)
967            {
968              return self->simpleRepr();
969            }
970
971          PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
972            {
973              DataArrayInt *ret1=0;
974              DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
975              PyObject *ret=PyTuple_New(2);
976              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
977              PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
978              return ret;
979            }
980
981          void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
982            {
983              self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
984            }
985          
986          void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
987            {
988              self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
989            }
990
991          PyObject *getTime() throw(INTERP_KERNEL::Exception)
992          {
993            int tmp1,tmp2;
994            double tmp0=self->getTime(tmp1,tmp2);
995            PyObject *res = PyList_New(3);
996            PyList_SetItem(res,0,SWIG_From_int(tmp1));
997            PyList_SetItem(res,1,SWIG_From_int(tmp2));
998            PyList_SetItem(res,2,SWIG_From_double(tmp0));
999            return res;
1000          }
1001          
1002          PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1003          {
1004            std::pair<int,int> res=self->getDtIt();
1005            PyObject *elt=PyTuple_New(2);
1006            PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1007            PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1008            return elt;
1009          }
1010          
1011          PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1012          {
1013            std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1014            PyObject *ret2=PyList_New(ret.size());
1015            for(int i=0;i<(int)ret.size();i++)
1016              PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1017            return ret2;
1018          }
1019          
1020          PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1021          {
1022            std::vector<int> ret1;
1023            int ret0=self->getNonEmptyLevels(mname,ret1);
1024            PyObject *elt=PyTuple_New(2);
1025            PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1026            PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1027            return elt;
1028          }
1029          
1030          PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1031          {
1032            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1033            std::vector< std::vector<TypeOfField> > typesF;
1034            std::vector< std::vector<std::string> > pfls;
1035            std::vector< std::vector<std::string> > locs;
1036            std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1037            int sz=ret.size();
1038            PyObject *ret2=PyList_New(sz);
1039            for(int i=0;i<sz;i++)
1040              {
1041                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1042                const std::vector<TypeOfField>& typesFI=typesF[i];
1043                const std::vector<std::string>& pflsI=pfls[i];
1044                const std::vector<std::string>& locsI=locs[i];
1045                PyObject *elt=PyTuple_New(2);
1046                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1047                int sz2=ret[i].size();
1048                PyObject *elt2=PyList_New(sz2);
1049                for(int j=0;j<sz2;j++)
1050                  {
1051                    PyObject *elt3=PyTuple_New(4);
1052                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1053                    PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
1054                    PyTuple_SetItem(elt3,1,elt4);
1055                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1056                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1057                    PyList_SetItem(elt2,j,elt3);
1058                  }
1059                PyTuple_SetItem(elt,1,elt2);
1060                PyList_SetItem(ret2,i,elt);
1061              }
1062            return ret2;
1063          }
1064
1065          PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1066          {
1067            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1068            std::vector< std::vector<TypeOfField> > typesF;
1069            std::vector< std::vector<std::string> > pfls;
1070            std::vector< std::vector<std::string> > locs;
1071            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1072            int sz=ret.size();
1073            PyObject *ret2=PyList_New(sz);
1074            for(int i=0;i<sz;i++)
1075              {
1076                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1077                const std::vector<TypeOfField>& typesFI=typesF[i];
1078                const std::vector<std::string>& pflsI=pfls[i];
1079                const std::vector<std::string>& locsI=locs[i];
1080                PyObject *elt=PyTuple_New(2);
1081                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1082                int sz2=ret[i].size();
1083                PyObject *elt2=PyList_New(sz2);
1084                for(int j=0;j<sz2;j++)
1085                  {
1086                    PyObject *elt3=PyTuple_New(4);
1087                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1088                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1089                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1090                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1091                    PyList_SetItem(elt2,j,elt3);
1092                  }
1093                PyTuple_SetItem(elt,1,elt2);
1094                PyList_SetItem(ret2,i,elt);
1095              }
1096            return ret2;
1097          }
1098
1099          DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1100          {
1101            DataArrayDouble *ret=self->getUndergroundDataArray();
1102            if(ret)
1103              ret->incrRef();
1104            return ret;
1105          }
1106
1107          PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1108          {
1109            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1110            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1111            if(elt0)
1112              elt0->incrRef();
1113            PyObject *ret=PyTuple_New(2);
1114            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1115            std::size_t sz=elt1Cpp.size();
1116            PyObject *elt=PyList_New(sz);
1117            for(std::size_t i=0;i<sz;i++)
1118              {
1119                PyObject *elt1=PyTuple_New(2);
1120                PyObject *elt2=PyTuple_New(2);
1121                PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1122                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1123                PyObject *elt3=PyTuple_New(2);
1124                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1125                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1126                PyTuple_SetItem(elt1,0,elt2);
1127                PyTuple_SetItem(elt1,1,elt3);
1128                PyList_SetItem(elt,i,elt1);
1129              }
1130            PyTuple_SetItem(ret,1,elt);
1131            return ret;
1132          }
1133          
1134          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1135          {
1136            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1137            return self->changeMeshNames(modifTab);
1138          }
1139        }
1140   };
1141
1142   class MEDFileFieldMultiTSIterator
1143   {
1144   public:
1145     %extend
1146     {
1147       PyObject *next() throw(INTERP_KERNEL::Exception)
1148       {
1149         MEDFileField1TS *ret=self->nextt();
1150         if(ret)
1151           return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1152         else
1153           {
1154             PyErr_SetString(PyExc_StopIteration,"No more data.");
1155             return 0;
1156           }
1157       }
1158     }
1159   };
1160
1161   class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1162   {
1163   public:
1164     static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1165     static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1166     static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1167     //
1168     MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1169     MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1170     MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1171     //
1172     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1173     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1174     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1175     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1176     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1177     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1178     //
1179     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1180     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1181     //
1182     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1183     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1184     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1185     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1186     std::string getName() const throw(INTERP_KERNEL::Exception);
1187     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1188     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1189     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1190     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1191     %extend
1192        {
1193          MEDFileFieldMultiTS()
1194          {
1195            return MEDFileFieldMultiTS::New();
1196          }
1197
1198          MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1199          {
1200            return MEDFileFieldMultiTS::New(fileName);
1201          }
1202
1203          MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1204          {
1205            return MEDFileFieldMultiTS::New(fileName,fieldName);
1206          }
1207          
1208          std::string __str__() const throw(INTERP_KERNEL::Exception)
1209            {
1210              return self->simpleRepr();
1211            }
1212
1213          MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1214          {
1215            if(elt0 && PyInt_Check(elt0))
1216              {//fmts[3]
1217                int pos=PyInt_AS_LONG(elt0);
1218                return self->getTimeStepAtPos(pos);
1219              }
1220            else if(elt0 && PyTuple_Check(elt0))
1221              {
1222                if(PyTuple_Size(elt0)==2)
1223                  {
1224                    PyObject *o0=PyTuple_GetItem(elt0,0);
1225                    PyObject *o1=PyTuple_GetItem(elt0,1);
1226                    if(PyInt_Check(o0) && PyInt_Check(o1))
1227                      {//fmts(1,-1)
1228                        int iter=PyInt_AS_LONG(o0);
1229                        int order=PyInt_AS_LONG(o1);
1230                        return self->getTimeStep(iter,order);
1231                      }
1232                    else
1233                      throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1234                  }
1235                else
1236                  throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1237              }
1238            else if(elt0 && PyFloat_Check(elt0))
1239              {
1240                double val=PyFloat_AS_DOUBLE(elt0);
1241                return self->getTimeStepGivenTime(val);
1242              }
1243            else
1244              throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1245          }
1246
1247          MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1248          {
1249            return self->iterator();
1250          }
1251
1252          PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1253            {
1254              DataArrayInt *ret1=0;
1255              DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1256              PyObject *ret=PyTuple_New(2);
1257              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1258              PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1259              return ret;
1260            }
1261
1262          PyObject *getIterations() const
1263          {
1264            std::vector< std::pair<int,int> > res=self->getIterations();
1265            PyObject *ret=PyList_New(res.size());
1266            int rk=0;
1267            for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1268              {
1269                PyObject *elt=PyTuple_New(2);
1270                PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1271                PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1272                PyList_SetItem(ret,rk,elt);
1273              }
1274            return ret;
1275          }
1276
1277          PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1278            {
1279              std::vector<double> ret1;
1280              std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1281              std::size_t sz=ret.size();
1282              PyObject *ret2=PyList_New(sz);
1283              for(std::size_t i=0;i<sz;i++)
1284                {
1285                  PyObject *elt=PyTuple_New(3);
1286                  PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1287                  PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1288                  PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1289                  PyList_SetItem(ret2,i,elt);
1290                }
1291              return ret2;
1292            }
1293
1294          PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1295          {
1296            std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1297            PyObject *ret2=PyList_New(ret.size());
1298            for(int i=0;i<(int)ret.size();i++)
1299              {
1300                const std::vector<TypeOfField>& rett=ret[i];
1301                PyObject *ret3=PyList_New(rett.size());
1302                for(int j=0;j<(int)rett.size();j++)
1303                  PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1304                PyList_SetItem(ret2,i,ret3);
1305              }
1306            return ret2;
1307          }
1308
1309          PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1310          {
1311            std::vector<int> ret1;
1312            int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1313            PyObject *elt=PyTuple_New(2);
1314            PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1315            PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1316            return elt;
1317          }
1318
1319          PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1320          {
1321            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1322            std::vector< std::vector<TypeOfField> > typesF;
1323            std::vector< std::vector<std::string> > pfls;
1324            std::vector< std::vector<std::string> > locs;
1325            std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1326            int sz=ret.size();
1327            PyObject *ret2=PyList_New(sz);
1328            for(int i=0;i<sz;i++)
1329              {
1330                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1331                const std::vector<TypeOfField>& typesFI=typesF[i];
1332                const std::vector<std::string>& pflsI=pfls[i];
1333                const std::vector<std::string>& locsI=locs[i];
1334                PyObject *elt=PyTuple_New(2);
1335                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1336                int sz2=ret[i].size();
1337                PyObject *elt2=PyList_New(sz2);
1338                for(int j=0;j<sz2;j++)
1339                  {
1340                    PyObject *elt3=PyTuple_New(4);
1341                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1342                    PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
1343                    PyTuple_SetItem(elt3,1,elt4);
1344                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1345                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1346                    PyList_SetItem(elt2,j,elt3);
1347                  }
1348                PyTuple_SetItem(elt,1,elt2);
1349                PyList_SetItem(ret2,i,elt);
1350              }
1351            return ret2;
1352          }
1353
1354          PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1355          {
1356            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1357            std::vector< std::vector<TypeOfField> > typesF;
1358            std::vector< std::vector<std::string> > pfls;
1359            std::vector< std::vector<std::string> > locs;
1360            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1361            int sz=ret.size();
1362            PyObject *ret2=PyList_New(sz);
1363            for(int i=0;i<sz;i++)
1364              {
1365                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1366                const std::vector<TypeOfField>& typesFI=typesF[i];
1367                const std::vector<std::string>& pflsI=pfls[i];
1368                const std::vector<std::string>& locsI=locs[i];
1369                PyObject *elt=PyTuple_New(2);
1370                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1371                int sz2=ret[i].size();
1372                PyObject *elt2=PyList_New(sz2);
1373                for(int j=0;j<sz2;j++)
1374                  {
1375                    PyObject *elt3=PyTuple_New(4);
1376                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1377                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1378                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1379                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1380                    PyList_SetItem(elt2,j,elt3);
1381                  }
1382                PyTuple_SetItem(elt,1,elt2);
1383                PyList_SetItem(ret2,i,elt);
1384              }
1385            return ret2;
1386          }
1387          DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1388          {
1389            DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1390            if(ret)
1391              ret->incrRef();
1392            return ret;
1393          }
1394          PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1395          {
1396            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1397            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1398            if(elt0)
1399              elt0->incrRef();
1400            PyObject *ret=PyTuple_New(2);
1401            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1402            std::size_t sz=elt1Cpp.size();
1403            PyObject *elt=PyList_New(sz);
1404            for(std::size_t i=0;i<sz;i++)
1405              {
1406                PyObject *elt1=PyTuple_New(2);
1407                PyObject *elt2=PyTuple_New(2);
1408                PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1409                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1410                PyObject *elt3=PyTuple_New(2);
1411                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1412                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1413                PyTuple_SetItem(elt1,0,elt2);
1414                PyTuple_SetItem(elt1,1,elt3);
1415                PyList_SetItem(elt,i,elt1);
1416              }
1417            PyTuple_SetItem(ret,1,elt);
1418            return ret;
1419          }
1420
1421          int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1422          {
1423            if(elt0 && PyInt_Check(elt0))
1424              {//fmts[3]
1425                int pos=PyInt_AS_LONG(elt0);
1426                return pos;
1427              }
1428            else if(elt0 && PyTuple_Check(elt0))
1429              {
1430                if(PyTuple_Size(elt0)==2)
1431                  {
1432                    PyObject *o0=PyTuple_GetItem(elt0,0);
1433                    PyObject *o1=PyTuple_GetItem(elt0,1);
1434                    if(PyInt_Check(o0) && PyInt_Check(o1))
1435                      {//fmts(1,-1)
1436                        int iter=PyInt_AS_LONG(o0);
1437                        int order=PyInt_AS_LONG(o1);
1438                        return self->getPosOfTimeStep(iter,order);
1439                      }
1440                    else
1441                      throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1442                  }
1443                else
1444                  throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1445              }
1446            else if(elt0 && PyFloat_Check(elt0))
1447              {
1448                double val=PyFloat_AS_DOUBLE(elt0);
1449                return self->getPosGivenTime(val);
1450              }
1451            else
1452              throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1453          }
1454
1455          std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1456          {
1457            if(PyList_Check(elts))
1458              {
1459                int sz=PyList_Size(elts);
1460                std::vector<int> ret(sz);
1461                for(int i=0;i<sz;i++)
1462                  {
1463                    PyObject *elt=PyList_GetItem(elts,i);
1464                    ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1465                  }
1466                return ret;
1467              }
1468            else
1469              {
1470                std::vector<int> ret(1);
1471                ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1472                return ret;
1473              }
1474          }
1475
1476          void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1477          {
1478            std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1479            if(!idsToRemove.empty())
1480              self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1481          }
1482
1483          void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1484          {
1485            int sw;
1486            int pos1;
1487            std::vector<int> pos2;
1488            DataArrayInt *pos3=0;
1489            DataArrayIntTuple *pos4=0;
1490            convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1491            switch(sw)
1492              {
1493              case 1:
1494                {
1495                  self->eraseTimeStepIds(&pos1,&pos1+1);
1496                  return;
1497                }
1498              case 2:
1499                {
1500                  if(pos2.empty())
1501                    return;
1502                  self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1503                  return ;
1504                }
1505              case 3:
1506                {
1507                  self->eraseTimeStepIds(pos3->begin(),pos3->end());
1508                  return ;
1509                }
1510              default:
1511                throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1512              }
1513          }
1514
1515          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1516          {
1517            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1518            return self->changeMeshNames(modifTab);
1519          }
1520        }
1521   };
1522
1523   class MEDFileFieldsIterator
1524   {
1525   public:
1526     %extend
1527     {
1528       PyObject *next() throw(INTERP_KERNEL::Exception)
1529       {
1530         MEDFileFieldMultiTS *ret=self->nextt();
1531         if(ret)
1532           return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1533         else
1534           {
1535             PyErr_SetString(PyExc_StopIteration,"No more data.");
1536             return 0;
1537           }
1538       }
1539     }
1540   };
1541
1542   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1543   {
1544   public:
1545     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1546     static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1547     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1548     int getNumberOfFields() const;
1549     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1550     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1551     //
1552     void resize(int newSize) throw(INTERP_KERNEL::Exception);
1553     void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1554     void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1555     MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1556     MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1557     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1558     %extend
1559        {
1560          MEDFileFields()
1561          {
1562            return MEDFileFields::New();
1563          }
1564
1565          MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1566          {
1567            return MEDFileFields::New(fileName);
1568          }
1569          
1570          std::string __str__() const throw(INTERP_KERNEL::Exception)
1571          {
1572            return self->simpleRepr();
1573          }
1574          
1575          MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1576          {
1577            if(PyInt_Check(obj))
1578              {
1579                return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1580              }
1581            else if(PyString_Check(obj))
1582              {
1583                return self->getFieldWithName(PyString_AsString(obj));
1584              }
1585            else
1586              throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1587          }
1588
1589          MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1590          {
1591            self->setFieldAtPos(obj,field);
1592            return self;
1593          }
1594
1595          MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1596          {
1597            return self->iterator();
1598          }
1599          
1600          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1601          {
1602            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1603            return self->changeMeshNames(modifTab);
1604          }
1605        }
1606   };
1607
1608   class MEDFileData : public RefCountObject, public MEDFileWritable
1609   {
1610   public:
1611     static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1612     static MEDFileData *New();
1613     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
1614     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
1615     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
1616     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
1617     //
1618     bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
1619     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
1620     //
1621     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1622     %extend
1623        {
1624          MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
1625          {
1626            return MEDFileData::New(fileName);
1627          }
1628
1629          MEDFileData()
1630          {
1631            return MEDFileData::New();
1632          }
1633
1634          std::string __str__() const throw(INTERP_KERNEL::Exception)
1635          {
1636            return self->simpleRepr();
1637          }
1638
1639          MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
1640          {
1641            MEDFileMeshes *ret=self->getMeshes();
1642            if(ret)
1643              ret->incrRef();
1644            return ret;
1645          }
1646
1647          MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
1648          {
1649            MEDFileFields *ret=self->getFields();
1650            if(ret)
1651              ret->incrRef();
1652            return ret;
1653          }
1654
1655          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1656          {
1657            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1658            return self->changeMeshNames(modifTab);
1659          }
1660        }
1661   };
1662
1663   class SauvReader : public RefCountObject
1664   {
1665   public:
1666     static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
1667     MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
1668   };
1669
1670   class SauvWriter : public RefCountObject
1671   {
1672   public:
1673     static SauvWriter * New();
1674     void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
1675     void write(const char* fileName) throw(INTERP_KERNEL::Exception);
1676   };
1677
1678 }