Salome HOME
tests on convertTo
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
1 // Copyright (C) 2007-2013  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 %module MEDLoader
22
23 #define MEDCOUPLING_EXPORT
24 #define MEDLOADER_EXPORT
25
26 %include "MEDCouplingCommon.i"
27
28 %{
29 #include "MEDLoader.hxx"
30 #include "MEDFileMesh.hxx"
31 #include "MEDFileField.hxx"
32 #include "MEDFileParameter.hxx"
33 #include "MEDFileData.hxx"
34 #include "MEDLoaderTypemaps.i"
35 #include "SauvReader.hxx"
36 #include "SauvWriter.hxx"
37
38 using namespace ParaMEDMEM;
39 %}
40
41 #if SWIG_VERSION >= 0x010329
42 %template()  std::vector<std::string>;
43 #endif
44
45 %typemap(out) ParaMEDMEM::MEDFileMesh*
46 {
47   $result=convertMEDFileMesh($1,$owner);
48 }
49
50 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
51 {
52   $result=convertMEDFileParameter1TS($1,$owner);
53 }
54
55 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
56 {
57   $result=convertMEDFileFieldMultiTS($1,$owner);
58 }
59
60 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
61 {
62   $result=convertMEDFileField1TS($1,$owner);
63 }
64
65 %newobject MEDLoader::ReadUMeshFromFamilies;
66 %newobject MEDLoader::ReadUMeshFromGroups;
67 %newobject MEDLoader::ReadUMeshFromFile;
68 %newobject MEDLoader::ReadField;
69 %newobject MEDLoader::ReadFieldCell;
70 %newobject MEDLoader::ReadFieldNode;
71 %newobject MEDLoader::ReadFieldGauss;
72 %newobject MEDLoader::ReadFieldGaussNE;
73 %newobject ParaMEDMEM::MEDFileMesh::New;
74 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
75 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
76 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
77 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
78 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
79 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
80 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
81 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
82 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
83 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
84 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
85 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
86 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
87 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
88 %newobject ParaMEDMEM::MEDFileUMesh::New;
89 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
90 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
91 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
92 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
93 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
94 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
95 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
96 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
98 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
99 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
100 %newobject ParaMEDMEM::MEDFileCMesh::New;
101 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
102 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
103 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
104 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
105 %newobject ParaMEDMEM::MEDFileMeshes::New;
106 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
107 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
108 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
109 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
110 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
111
112 %newobject ParaMEDMEM::MEDFileFields::New;
113 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
114 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
115 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
116 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
117 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
118 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
119 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
120 %newobject ParaMEDMEM::MEDFileFields::__iter__;
121
122 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
123 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
124 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
125 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
126 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
127 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
128 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
129 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
130 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
131 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
132 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
133 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
134 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
135 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
136 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
137 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
138 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
139
140 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
141 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
142 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
143 %newobject ParaMEDMEM::MEDFileField1TS::New;
144 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
145 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
146 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
147 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
148 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
149 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
150 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
151 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
152 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
153
154 %newobject ParaMEDMEM::MEDFileData::New;
155 %newobject ParaMEDMEM::MEDFileData::deepCpy;
156 %newobject ParaMEDMEM::MEDFileData::getMeshes;
157 %newobject ParaMEDMEM::MEDFileData::getFields;
158 %newobject ParaMEDMEM::MEDFileData::getParams;
159
160 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
161 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
162 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
163 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
164 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
165 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
166 %newobject ParaMEDMEM::MEDFileParameters::New;
167 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
168 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
169 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
170 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
171
172 %newobject ParaMEDMEM::SauvWriter::New;
173 %newobject ParaMEDMEM::SauvReader::New;
174 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
175
176 %feature("unref") MEDFileMesh "$this->decrRef();"
177 %feature("unref") MEDFileUMesh "$this->decrRef();"
178 %feature("unref") MEDFileCMesh "$this->decrRef();"
179 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
180 %feature("unref") MEDFileMeshes "$this->decrRef();"
181 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
182 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
183 %feature("unref") MEDFileField1TS "$this->decrRef();"
184 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
185 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
186 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
187 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
188 %feature("unref") MEDFileFields "$this->decrRef();"
189 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
190 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
191 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
192 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
193 %feature("unref") MEDFileParameters "$this->decrRef();"
194 %feature("unref") MEDFileData "$this->decrRef();"
195 %feature("unref") SauvReader "$this->decrRef();"
196 %feature("unref") SauvWriter "$this->decrRef();"
197
198 class MEDLoader
199 {
200 public:
201   static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
202   static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
203   static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
204   static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
205   static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
206   static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
207   static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
208   static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
209   static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
210   static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
211   static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
212   static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
213   static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
214   static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
215   static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
216   static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
217   %extend
218      {
219        static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
220        {
221          std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
222          PyObject *ret=PyList_New(res.size());
223          int rk=0;
224          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
225            {
226              PyObject *elt=PyTuple_New(2);
227              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
228              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
229              PyList_SetItem(ret,rk,elt);
230            }
231          return ret;
232        }
233
234        static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
235        {
236          std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
237          PyObject *ret=PyList_New(res.size());
238          int rk=0;
239          for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
240            {
241              PyObject *elt=PyTuple_New(3);
242              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
243              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
244              PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
245              PyList_SetItem(ret,rk,elt);
246            }
247          return ret;
248        }
249
250        static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
251        {
252          std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
253          PyObject *ret=PyList_New(res.size());
254          int rk=0;
255          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
256            {
257              PyObject *elt=PyTuple_New(2);
258              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
259              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
260              PyList_SetItem(ret,rk,elt);
261            }
262          return ret;
263        }
264        static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
265        {
266          std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
267          PyObject *ret=PyList_New(res.size());
268          int rk=0;
269          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
270            {
271              PyObject *elt=PyTuple_New(2);
272              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
273              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
274              PyList_SetItem(ret,rk,elt);
275            }
276          return ret;
277        }
278        static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
279        {
280          std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
281          PyObject *ret=PyList_New(res.size());
282          int rk=0;
283          for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
284            {
285              PyObject *elt=PyTuple_New(2);
286              PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
287              PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
288              PyList_SetItem(ret,rk,elt);
289            }
290          return ret;
291        }
292        static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
293        {
294          int meshDim,spaceDim,numberOfNodes;
295          std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
296          PyObject *ret=PyTuple_New(4);
297          PyObject *elt0=PyList_New(res.size());
298          int i=0;
299          for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
300            {
301              const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
302              int j=0;
303              PyObject *elt1=PyList_New(obj2.size());
304              for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
305                {
306                  PyObject *elt2=PyTuple_New(2);
307                  PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
308                  PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
309                  PyList_SetItem(elt1,j,elt2);
310                }
311              PyList_SetItem(elt0,i,elt1);
312            }
313          PyTuple_SetItem(ret,0,elt0);
314          PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
315          PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
316          PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
317          return ret;
318        }
319        static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
320                                              const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
321        {
322          std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
323          std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
324          return convertFieldDoubleVecToPy(res);
325        }
326        static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
327        {
328          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
329          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
330          MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
331        }
332        static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
333        {
334          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
335          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
336          MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
337        }
338        static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
339        {
340          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
341          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
342          MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
343        }
344        static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
345        {
346          std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
347          int size=v.size();
348          PyObject *ret=PyList_New(size);
349          for(int i=0;i<size;i++)
350            PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
351          return ret;
352        }
353        static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
354        {
355          std::vector<std::string> grps;
356          converPyListToVecString(li,grps);
357          return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
358        }
359        static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
360        {
361          std::vector<std::string> fams;
362          converPyListToVecString(li,fams);
363          return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
364        }
365      }
366   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
367   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
368   static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
369   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);
370   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
371   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
372   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
373   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
374   static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
375   static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
376   static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
377   static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
378   static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
379 };
380
381 namespace ParaMEDMEM
382 {
383   class MEDFileWritable
384   {
385   public:
386     void copyOptionsFrom(const MEDFileWritable& other) const;
387     int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
388     void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
389     int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
390     void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
391   };
392
393   class MEDFileMesh : public RefCountObject, public MEDFileWritable
394   {
395   public:
396     static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
397     static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
398     virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
399     virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
400     virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
401     virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
402     void setName(const char *name);
403     const char *getName();
404     const char *getUnivName() const;
405     bool getUnivNameWrStatus() const;
406     void setUnivNameWrStatus(bool newStatus);
407     void setDescription(const char *name);
408     const char *getDescription() const;
409     void setOrder(int order);
410     int getOrder() const;
411     void setIteration(int it);
412     int getIteration();
413     void setTimeValue(double time);
414     void setTime(int dt, int it, double time);
415     double getTimeValue() const;
416     void setTimeUnit(const char *unit);
417     const char *getTimeUnit() const;
418     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
419     virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
420     virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
421     virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
422     std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
423     std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
424     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
425     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
426     //
427     bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
428     bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
429     bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
430     void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
431     void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
432     void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
433     void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
434     virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
435     virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
436     void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
437     const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
438     const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
439     std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
440     std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
441     std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
442     void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
443     void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
444     std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
445     void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
446     std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
447     std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
448     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
449     std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
450     void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
451     void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
452     std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
453     std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
454     void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
455     void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
456     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
457     void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
458     void setFamilyInfo(const std::map<std::string,int>& info);
459     void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
460     int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
461     int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
462     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
463     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
464     int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
465     int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
466     int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
467     virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
468     virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
469     virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
470     DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
471     DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
472     std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
473     std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
474     bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
475     void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
476     void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
477     virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
478     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
479     virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
480     //
481     virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
482     virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
483     virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
484     virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
485     virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
486     virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
487     virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
488     virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
489     virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
490     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
491     virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
492     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
493     %extend
494        {
495          MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
496          {
497            return MEDFileMesh::New(fileName);
498          }
499
500          MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
501          {
502            return MEDFileMesh::New(fileName,mName,dt,it);
503          }
504          
505          std::string __str__() const throw(INTERP_KERNEL::Exception)
506          {
507            return self->simpleRepr();
508          }
509
510          PyObject *getTime() throw(INTERP_KERNEL::Exception)
511          {
512            int tmp1,tmp2;
513            double tmp0=self->getTime(tmp1,tmp2);
514            PyObject *res = PyList_New(3);
515            PyList_SetItem(res,0,SWIG_From_int(tmp1));
516            PyList_SetItem(res,1,SWIG_From_int(tmp2));
517            PyList_SetItem(res,2,SWIG_From_double(tmp0));
518            return res;
519          }
520
521          virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
522          {
523            std::string what;
524            bool ret0=self->isEqual(other,eps,what);
525            PyObject *res=PyList_New(2);
526            PyObject *ret0Py=ret0?Py_True:Py_False;
527            Py_XINCREF(ret0Py);
528            PyList_SetItem(res,0,ret0Py);
529            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
530            return res;
531          }
532          
533          PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
534          {
535            std::string what;
536            bool ret0=self->areFamsEqual(other,what);
537            PyObject *res=PyList_New(2);
538            PyObject *ret0Py=ret0?Py_True:Py_False;
539            Py_XINCREF(ret0Py);
540            PyList_SetItem(res,0,ret0Py);
541            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
542            return res;
543          }
544
545          PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
546          {
547            std::string what;
548            bool ret0=self->areGrpsEqual(other,what);
549            PyObject *res=PyList_New(2);
550            PyObject *ret0Py=ret0?Py_True:Py_False;
551            Py_XINCREF(ret0Py);
552            PyList_SetItem(res,0,ret0Py);
553            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
554            return res;
555          }
556
557          PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
558          {
559            const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
560            if(tmp)
561              tmp->incrRef();
562            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
563          }
564
565          PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
566          {
567            const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
568            if(tmp)
569              tmp->incrRef();
570            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
571          }
572          
573          PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
574          {
575            const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
576            if(tmp)
577              tmp->incrRef();
578            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
579          }
580
581          PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
582          {
583            bool ret1;
584            std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
585            PyObject *ret=PyTuple_New(2);
586            PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
587            PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
588            return ret;
589          }
590          
591          PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
592          {
593            DataArrayInt *ret3=0;
594            std::vector<int> ret1,ret2;
595            bool ret0=self->unPolyze(ret1,ret2,ret3);
596            PyObject *ret=PyTuple_New(4);
597            PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
598            //
599            PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
600            for(int j=0;j<(int)ret1.size()/3;j++)
601              {
602                PyObject *retLev2=PyList_New(3);
603                PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
604                PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
605                PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
606                PyList_SetItem(retLev1_0,j,retLev2);
607              }
608            PyTuple_SetItem(ret,1,retLev1_0);
609            //
610            PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
611            for(int j=0;j<(int)ret2.size()/3;j++)
612              {
613                PyObject *retLev2=PyList_New(3);
614                PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
615                PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
616                PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
617                PyList_SetItem(retLev1_1,j,retLev2);
618              }
619            PyTuple_SetItem(ret,2,retLev1_1);
620            //
621            PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
622            return ret;
623          }
624        }
625   };
626
627   class MEDFileUMesh : public MEDFileMesh
628   {
629   public:
630     static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
631     static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
632     static MEDFileUMesh *New();
633     ~MEDFileUMesh();
634     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
635     //
636     std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
637     std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
638     std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
639     std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
640     std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
641     std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
642     std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
643     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
644     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
645     MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
646     DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
647     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
648     DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
649     MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
650     DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
651     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
652     DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
653     DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
654     DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
655     DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
656     DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
657     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
658     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
659     MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
660     MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
661     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
662     //
663     void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
664     void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
665     void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
666     void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
667     void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
668     void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
669     void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
670     void optimizeFamilies() throw(INTERP_KERNEL::Exception);
671     DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
672     %extend
673        { 
674          MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
675          {
676            return MEDFileUMesh::New(fileName,mName,dt,it);
677          }
678
679          MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
680          {
681            return MEDFileUMesh::New(fileName);
682          }
683
684          MEDFileUMesh()
685          {
686            return MEDFileUMesh::New();
687          }
688          
689          PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
690          {
691            const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
692            if(tmp)
693              tmp->incrRef();
694            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
695          }
696          
697          void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
698          {
699            std::vector<const DataArrayInt *> grps;
700            convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
701            self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
702          }
703
704          void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
705          {
706            std::vector<const MEDCouplingUMesh *> ms;
707            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
708            self->setMeshes(ms,renum);
709          }
710
711          void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
712          {
713            std::vector<const MEDCouplingUMesh *> ms;
714            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
715            self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
716          }
717          
718          void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
719          {
720            std::vector<const MEDCouplingUMesh *> ms;
721            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
722            self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
723          }
724
725          DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
726          {
727            DataArrayDouble *ret=self->getCoords();
728            if(ret)
729              ret->incrRef();
730            return ret;
731          }
732
733          PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
734          {
735            DataArrayInt *ret0=0,*ret1=0,*ret2=0;
736            self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
737            PyObject *ret=PyTuple_New(3);
738            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
739            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
740            PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
741            return ret;
742          }
743        }
744   };
745
746   class MEDFileStructuredMesh : public MEDFileMesh
747   {
748   };
749
750   class MEDFileCMesh : public MEDFileStructuredMesh
751   {
752   public:
753     static MEDFileCMesh *New();
754     static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
755     static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
756     void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
757     %extend
758        {
759          MEDFileCMesh()
760          {
761            return MEDFileCMesh::New();
762          }
763
764          MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
765          {
766            return MEDFileCMesh::New(fileName);
767          }
768
769          MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
770          {
771            return MEDFileCMesh::New(fileName,mName,dt,it);
772          }
773          
774          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
775          {
776            const MEDCouplingCMesh *tmp=self->getMesh();
777            if(tmp)
778              tmp->incrRef();
779            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
780          }
781        }
782   };
783
784   class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
785   {
786   public:
787     static MEDFileCurveLinearMesh *New();
788     static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
789     static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
790     void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
791     %extend
792        {
793          MEDFileCurveLinearMesh()
794          {
795            return MEDFileCurveLinearMesh::New();
796          }
797
798          MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
799          {
800            return MEDFileCurveLinearMesh::New(fileName);
801          }
802
803          MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
804          {
805            return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
806          }
807          
808          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
809          {
810            const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
811            if(tmp)
812              tmp->incrRef();
813            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
814          }
815        }
816   };
817
818   class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
819   {
820   public:
821     static MEDFileMeshMultiTS *New();
822     static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
823     static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
824     MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
825     const char *getName() const throw(INTERP_KERNEL::Exception);
826     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
827     void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
828     %extend
829        { 
830          MEDFileMeshMultiTS()
831          {
832            return MEDFileMeshMultiTS::New();
833          }
834
835          MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
836          {
837            return MEDFileMeshMultiTS::New(fileName);
838          }
839
840          MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
841          {
842            return MEDFileMeshMultiTS::New(fileName,mName);
843          }
844
845          MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
846            {
847              MEDFileMesh *ret=self->getOneTimeStep();
848              if(ret)
849                ret->incrRef();
850              return ret;
851            }
852        }
853   };
854
855   class MEDFileMeshesIterator
856   {
857   public:
858     %extend
859     {
860       PyObject *next() throw(INTERP_KERNEL::Exception)
861       {
862         MEDFileMesh *ret=self->nextt();
863         if(ret)
864           {
865             ret->incrRef();
866             return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
867           }
868         else
869           {
870             PyErr_SetString(PyExc_StopIteration,"No more data.");
871             return 0;
872           }
873       }
874     }
875   };
876
877   class MEDFileMeshes : public RefCountObject, public MEDFileWritable
878   {
879   public:
880     static MEDFileMeshes *New();
881     static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
882     MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
883     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
884     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
885     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
886     //
887     void resize(int newSize) throw(INTERP_KERNEL::Exception);
888     void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
889     void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
890     void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
891     %extend
892        {
893          MEDFileMeshes()
894          {
895            return MEDFileMeshes::New();
896          }
897
898          MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
899          {
900            return MEDFileMeshes::New(fileName);
901          }
902
903          std::string __str__() const throw(INTERP_KERNEL::Exception)
904            {
905              return self->simpleRepr();
906            }
907
908          MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
909          {
910            if(PyInt_Check(obj))
911              {
912                MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
913                if(ret)
914                  ret->incrRef();
915                return ret;
916              }
917            else if(PyString_Check(obj))
918              {
919                MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
920                if(ret)
921                  ret->incrRef();
922                return ret;
923              }
924            else
925              throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
926          }
927
928          MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
929          {
930            self->setMeshAtPos(obj,mesh);
931            return self;
932          }
933
934          MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
935          {
936            return self->iterator();
937          }
938
939          int __len__() const throw(INTERP_KERNEL::Exception)
940          {
941            return self->getNumberOfMeshes();
942          }
943          
944          MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
945            {
946              MEDFileMesh *ret=self->getMeshAtPos(i);
947              if(ret)
948                ret->incrRef();
949              return ret;
950            }
951          MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
952            {
953              MEDFileMesh *ret=self->getMeshWithName(mname);
954              if(ret)
955                ret->incrRef();
956              return ret;
957            }
958        }
959   };
960
961   class MEDFileFieldLoc : public RefCountObject
962   {
963   public:
964     const std::string& getName() const;
965     int getDimension() const;
966     int getNumberOfGaussPoints() const;
967     int getNumberOfPointsInCells() const;
968     const std::vector<double>& getRefCoords() const;
969     const std::vector<double>& getGaussCoords() const;
970     const std::vector<double>& getGaussWeights() const;
971     bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
972   %extend
973     {
974       std::string __str__() const throw(INTERP_KERNEL::Exception)
975       {
976         return self->repr();
977       }
978     }
979   };
980
981   class MEDFileFieldGlobsReal
982   {
983   public:
984     void resetContent();
985     void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
986     void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
987     void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
988     void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
989     void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
990     void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
991     void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
992     void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
993     std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
994     std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
995     bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
996     bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
997     std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
998     std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
999     std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
1000     std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
1001     virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1002     virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1003     virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1004     virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1005     void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1006     void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1007     void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1008     void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1009     int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1010     int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
1011   %extend
1012      {
1013        PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
1014        {
1015          const DataArrayInt *ret=self->getProfile(pflName);
1016          if(ret)
1017            ret->incrRef();
1018          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1019        }
1020
1021        PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1022        {
1023          const DataArrayInt *ret=self->getProfileFromId(pflId);
1024          if(ret)
1025            ret->incrRef();
1026          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1027        }
1028
1029        PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1030        {
1031          const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1032          if(loc)
1033            loc->incrRef();
1034          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1035        }
1036        
1037        PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1038        {
1039          const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1040          if(loc)
1041            loc->incrRef();
1042          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1043        }
1044        
1045        PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1046        {
1047          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1048          return convertVecPairVecStToPy(ret);
1049        }
1050
1051        PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1052        {
1053          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1054          return convertVecPairVecStToPy(ret);
1055        }
1056
1057        void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1058        {
1059          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1060          self->changePflsNames(v);
1061        }
1062
1063        void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1064        {
1065          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1066          self->changePflsRefsNamesGen(v);
1067        }
1068
1069        void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1070        {
1071          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1072          self->changePflsNamesInStruct(v);
1073        }
1074
1075        void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1076        {
1077          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1078          self->changeLocsNames(v);
1079        }
1080
1081        void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1082        {
1083          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1084          self->changeLocsRefsNamesGen(v);
1085        }
1086        
1087        void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1088        {
1089          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1090          self->changeLocsNamesInStruct(v);
1091        }
1092
1093        std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1094        {
1095          std::ostringstream oss;
1096          self->simpleReprGlobs(oss);
1097          return oss.str();
1098        }
1099      }
1100   };
1101
1102   class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1103   {
1104   public:
1105     static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1106     static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1107     static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1108     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1109     int getDimension() const throw(INTERP_KERNEL::Exception);
1110     int getIteration() const throw(INTERP_KERNEL::Exception);
1111     int getOrder() const throw(INTERP_KERNEL::Exception);
1112     std::string getName() throw(INTERP_KERNEL::Exception);
1113     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1114     std::string getMeshName() throw(INTERP_KERNEL::Exception);
1115     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1116     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1117     bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1118     void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1119     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1120     void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1121     virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1122     MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1123     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1124     void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1125     %extend
1126     {
1127       PyObject *getTime() throw(INTERP_KERNEL::Exception)
1128       {
1129         int tmp1,tmp2;
1130         double tmp0=self->getTime(tmp1,tmp2);
1131         PyObject *res = PyList_New(3);
1132         PyList_SetItem(res,0,SWIG_From_int(tmp1));
1133         PyList_SetItem(res,1,SWIG_From_int(tmp2));
1134         PyList_SetItem(res,2,SWIG_From_double(tmp0));
1135         return res;
1136       }
1137
1138       PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1139       {
1140         std::pair<int,int> res=self->getDtIt();
1141         PyObject *elt=PyTuple_New(2);
1142         PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1143         PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1144         return elt;
1145       }
1146
1147       void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1148       {
1149         self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1150       }
1151       
1152       void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1153       {
1154         self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1155       }
1156
1157       bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1158       {
1159         std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1160         return self->changeMeshNames(modifTab);
1161       }
1162       
1163       PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1164       {
1165         std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1166         PyObject *ret2=PyList_New(ret.size());
1167         for(int i=0;i<(int)ret.size();i++)
1168           PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1169         return ret2;
1170       }
1171
1172       PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1173       {
1174         std::vector<int> ret1;
1175         int ret0=self->getNonEmptyLevels(mname,ret1);
1176         PyObject *elt=PyTuple_New(2);
1177         PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1178         PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1179         return elt;
1180       }
1181
1182       PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1183       {
1184         std::vector<INTERP_KERNEL::NormalizedCellType> types;
1185         std::vector< std::vector<TypeOfField> > typesF;
1186         std::vector< std::vector<std::string> > pfls;
1187         std::vector< std::vector<std::string> > locs;
1188         std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1189         int sz=ret.size();
1190         PyObject *ret2=PyList_New(sz);
1191            for(int i=0;i<sz;i++)
1192              {
1193                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1194                const std::vector<TypeOfField>& typesFI=typesF[i];
1195                const std::vector<std::string>& pflsI=pfls[i];
1196                const std::vector<std::string>& locsI=locs[i];
1197                PyObject *elt=PyTuple_New(2);
1198                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1199                int sz2=ret[i].size();
1200                PyObject *elt2=PyList_New(sz2);
1201                for(int j=0;j<sz2;j++)
1202                  {
1203                    PyObject *elt3=PyTuple_New(4);
1204                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1205                    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));
1206                    PyTuple_SetItem(elt3,1,elt4);
1207                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1208                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1209                    PyList_SetItem(elt2,j,elt3);
1210                  }
1211                PyTuple_SetItem(elt,1,elt2);
1212                PyList_SetItem(ret2,i,elt);
1213              }
1214            return ret2;
1215       }
1216
1217       PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1218       {
1219         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1220         std::size_t sz=ret.size();
1221         PyObject *retPy=PyList_New(sz);
1222         for(std::size_t i=0;i<sz;i++)
1223           PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1224         return retPy;
1225       }
1226     }
1227   };
1228
1229   class MEDFileField1TS : public MEDFileAnyTypeField1TS
1230   {
1231   public:
1232     static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1233     static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1234     static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1235     static MEDFileField1TS *New();
1236     ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1237     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1238     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1239     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1240     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1241     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1242     //
1243     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1244     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1245     void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1246     void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1247     %extend
1248        {
1249          MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1250          {
1251            return MEDFileField1TS::New(fileName);
1252          }
1253          
1254          MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1255          {
1256            return MEDFileField1TS::New(fileName,fieldName);
1257          }
1258
1259          MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1260          {
1261            return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1262          }
1263
1264          MEDFileField1TS()
1265          {
1266            return MEDFileField1TS::New();
1267          }
1268
1269          void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1270          {
1271            const DataArrayDouble *arr=0;
1272            if(field)
1273              arr=field->getArray();
1274            self->copyTinyInfoFrom(field,arr);
1275          }
1276          
1277          std::string __str__() const throw(INTERP_KERNEL::Exception)
1278          {
1279            return self->simpleRepr();
1280          }
1281          
1282          PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1283          {
1284            DataArrayInt *ret1=0;
1285            DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1286            PyObject *ret=PyTuple_New(2);
1287            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1288            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1289            return ret;
1290          }
1291
1292          PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1293          {
1294            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1295            std::vector< std::vector<TypeOfField> > typesF;
1296            std::vector< std::vector<std::string> > pfls;
1297            std::vector< std::vector<std::string> > locs;
1298            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1299            int sz=ret.size();
1300            PyObject *ret2=PyList_New(sz);
1301            for(int i=0;i<sz;i++)
1302              {
1303                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1304                const std::vector<TypeOfField>& typesFI=typesF[i];
1305                const std::vector<std::string>& pflsI=pfls[i];
1306                const std::vector<std::string>& locsI=locs[i];
1307                PyObject *elt=PyTuple_New(2);
1308                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1309                int sz2=ret[i].size();
1310                PyObject *elt2=PyList_New(sz2);
1311                for(int j=0;j<sz2;j++)
1312                  {
1313                    PyObject *elt3=PyTuple_New(4);
1314                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1315                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1316                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1317                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1318                    PyList_SetItem(elt2,j,elt3);
1319                  }
1320                PyTuple_SetItem(elt,1,elt2);
1321                PyList_SetItem(ret2,i,elt);
1322              }
1323            return ret2;
1324          }
1325
1326          DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1327          {
1328            DataArrayDouble *ret=self->getUndergroundDataArray();
1329            if(ret)
1330              ret->incrRef();
1331            return ret;
1332          }
1333
1334          PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1335          {
1336            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1337            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1338            if(elt0)
1339              elt0->incrRef();
1340            PyObject *ret=PyTuple_New(2);
1341            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1342            std::size_t sz=elt1Cpp.size();
1343            PyObject *elt=PyList_New(sz);
1344            for(std::size_t i=0;i<sz;i++)
1345              {
1346                PyObject *elt1=PyTuple_New(2);
1347                PyObject *elt2=PyTuple_New(2);
1348                PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1349                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1350                PyObject *elt3=PyTuple_New(2);
1351                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1352                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1353                PyTuple_SetItem(elt1,0,elt2);
1354                PyTuple_SetItem(elt1,1,elt3);
1355                PyList_SetItem(elt,i,elt1);
1356              }
1357            PyTuple_SetItem(ret,1,elt);
1358            return ret;
1359          }
1360        }
1361   };
1362
1363   class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1364   {
1365   public:
1366     static MEDFileIntField1TS *New();
1367     static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1368     static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1369     static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1370     ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1371     //
1372     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1373     void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1374     %extend
1375     {
1376       MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1377       {
1378         return MEDFileIntField1TS::New();
1379       }
1380
1381       MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1382       {
1383         return MEDFileIntField1TS::New(fileName);
1384       }
1385
1386       MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1387       {
1388         return MEDFileIntField1TS::New(fileName,fieldName);
1389       }
1390
1391       MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1392       {
1393         return MEDFileIntField1TS::New(fileName,fieldName,iteration,order);
1394       }
1395
1396       std::string __str__() const throw(INTERP_KERNEL::Exception)
1397       {
1398         return self->simpleRepr();
1399       }
1400
1401       PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1402       {
1403         DataArrayInt *ret1=0;
1404         MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1405         PyObject *ret=PyTuple_New(2);
1406         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1407         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1408         return ret;
1409       }
1410
1411       PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1412       {
1413         DataArrayInt *ret1=0;
1414         MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1415         PyObject *ret=PyTuple_New(2);
1416         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1417         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1418         return ret;
1419       }
1420
1421       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1422       {
1423         DataArrayInt *ret1=0;
1424         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1425         PyObject *ret=PyTuple_New(2);
1426         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1427         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1428         return ret;
1429       }
1430       
1431       PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1432       {
1433         DataArrayInt *ret1=0;
1434         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1435         PyObject *ret=PyTuple_New(2);
1436         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1437         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1438         return ret;
1439       }
1440       
1441       PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1442       {
1443         DataArrayInt *ret1=0;
1444         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1445         PyObject *ret=PyTuple_New(2);
1446         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1447         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1448         return ret;
1449       }
1450
1451       PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1452       {
1453          DataArrayInt *ret1=0;
1454          DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1455          PyObject *ret=PyTuple_New(2);
1456          PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1457          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1458          return ret;
1459       }
1460       
1461       DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1462       {
1463         DataArrayInt *ret=self->getUndergroundDataArray();
1464         if(ret)
1465           ret->incrRef();
1466         return ret;
1467       }
1468     }
1469   };
1470
1471   class MEDFileAnyTypeFieldMultiTSIterator
1472   {
1473   public:
1474     %extend
1475     {
1476       PyObject *next() throw(INTERP_KERNEL::Exception)
1477       {
1478         MEDFileAnyTypeField1TS *ret=self->nextt();
1479         if(ret)
1480           return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1481         else
1482           {
1483             PyErr_SetString(PyExc_StopIteration,"No more data.");
1484             return 0;
1485           }
1486       }
1487     }
1488   };
1489
1490   class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1491   {
1492   public:
1493     static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1494     static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1495     MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1496     virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1497     std::string getName() const throw(INTERP_KERNEL::Exception);
1498     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1499     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1500     void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1501     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1502     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1503     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1504     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1505     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1506     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1507     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1508     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1509     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1510     //
1511     virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1512     MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1513     MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1514     void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1515     void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1516     %extend
1517     {
1518       int __len__() const throw(INTERP_KERNEL::Exception)
1519       {
1520         return self->getNumberOfTS();
1521       }
1522
1523       int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1524       {
1525         if(elt0 && PyInt_Check(elt0))
1526           {//fmts[3]
1527             int pos=PyInt_AS_LONG(elt0);
1528             return pos;
1529           }
1530         else if(elt0 && PyTuple_Check(elt0))
1531           {
1532             if(PyTuple_Size(elt0)==2)
1533               {
1534                 PyObject *o0=PyTuple_GetItem(elt0,0);
1535                 PyObject *o1=PyTuple_GetItem(elt0,1);
1536                 if(PyInt_Check(o0) && PyInt_Check(o1))
1537                   {//fmts(1,-1)
1538                     int iter=PyInt_AS_LONG(o0);
1539                     int order=PyInt_AS_LONG(o1);
1540                     return self->getPosOfTimeStep(iter,order);
1541                   }
1542                 else
1543                   throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1544               }
1545             else
1546               throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1547           }
1548         else if(elt0 && PyFloat_Check(elt0))
1549           {
1550             double val=PyFloat_AS_DOUBLE(elt0);
1551             return self->getPosGivenTime(val);
1552           }
1553         else
1554           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1555       }
1556       
1557       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1558       {
1559         std::vector< std::pair<int,int> > res=self->getIterations();
1560         PyObject *ret=PyList_New(res.size());
1561         int rk=0;
1562         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1563           {
1564             PyObject *elt=PyTuple_New(2);
1565             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1566             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1567             PyList_SetItem(ret,rk,elt);
1568           }
1569         return ret;
1570       }
1571       
1572       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1573       {
1574         std::vector<double> ret1;
1575         std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1576         std::size_t sz=ret.size();
1577         PyObject *ret2=PyList_New(sz);
1578         for(std::size_t i=0;i<sz;i++)
1579           {
1580             PyObject *elt=PyTuple_New(3);
1581             PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1582             PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1583             PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1584             PyList_SetItem(ret2,i,elt);
1585           }
1586         return ret2;
1587       }
1588       
1589       PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1590       {
1591         std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1592         PyObject *ret2=PyList_New(ret.size());
1593         for(int i=0;i<(int)ret.size();i++)
1594           {
1595             const std::vector<TypeOfField>& rett=ret[i];
1596             PyObject *ret3=PyList_New(rett.size());
1597             for(int j=0;j<(int)rett.size();j++)
1598               PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1599             PyList_SetItem(ret2,i,ret3);
1600           }
1601         return ret2;
1602       }
1603       
1604       PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1605       {
1606         std::vector<int> ret1;
1607         int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1608         PyObject *elt=PyTuple_New(2);
1609         PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1610         PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1611         return elt;
1612       }
1613       
1614       PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1615       {
1616         std::vector<INTERP_KERNEL::NormalizedCellType> types;
1617         std::vector< std::vector<TypeOfField> > typesF;
1618         std::vector< std::vector<std::string> > pfls;
1619         std::vector< std::vector<std::string> > locs;
1620         std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1621         int sz=ret.size();
1622         PyObject *ret2=PyList_New(sz);
1623         for(int i=0;i<sz;i++)
1624           {
1625             const std::vector< std::pair<int,int> >& dadsI=ret[i];
1626             const std::vector<TypeOfField>& typesFI=typesF[i];
1627             const std::vector<std::string>& pflsI=pfls[i];
1628             const std::vector<std::string>& locsI=locs[i];
1629             PyObject *elt=PyTuple_New(2);
1630             PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1631             int sz2=ret[i].size();
1632             PyObject *elt2=PyList_New(sz2);
1633             for(int j=0;j<sz2;j++)
1634               {
1635                 PyObject *elt3=PyTuple_New(4);
1636                 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1637                 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));
1638                 PyTuple_SetItem(elt3,1,elt4);
1639                 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1640                 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1641                 PyList_SetItem(elt2,j,elt3);
1642               }
1643             PyTuple_SetItem(elt,1,elt2);
1644             PyList_SetItem(ret2,i,elt);
1645           }
1646         return ret2;
1647       }
1648
1649       std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1650       {
1651         if(PyList_Check(elts))
1652           {
1653             int sz=PyList_Size(elts);
1654             std::vector<int> ret(sz);
1655             for(int i=0;i<sz;i++)
1656               {
1657                 PyObject *elt=PyList_GetItem(elts,i);
1658                 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1659               }
1660             return ret;
1661           }
1662         else
1663           {
1664             std::vector<int> ret(1);
1665             ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1666             return ret;
1667           }
1668       }
1669       
1670       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1671       {
1672         if(PySlice_Check(elts))
1673           {
1674             Py_ssize_t strt=2,stp=2,step=2;
1675             PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1676             if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1677               {
1678                 self->eraseTimeStepIds2(strt,stp,step);
1679               }
1680             else
1681               throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1682           }
1683         else
1684           {
1685             std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1686             if(!idsToRemove.empty())
1687               self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1688           }
1689       }
1690       
1691       void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1692       {
1693         int sw;
1694         int pos1;
1695         std::vector<int> pos2;
1696         DataArrayInt *pos3=0;
1697         DataArrayIntTuple *pos4=0;
1698         convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1699         switch(sw)
1700           {
1701           case 1:
1702             {
1703               self->eraseTimeStepIds(&pos1,&pos1+1);
1704               return;
1705             }
1706           case 2:
1707             {
1708               if(pos2.empty())
1709                 return;
1710               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1711               return ;
1712             }
1713           case 3:
1714             {
1715               self->eraseTimeStepIds(pos3->begin(),pos3->end());
1716               return ;
1717             }
1718           default:
1719             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1720           }
1721       }
1722
1723       MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1724       {
1725         return self->iterator();
1726       }
1727
1728       PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1729       {
1730         if(elt0 && PyList_Check(elt0))
1731           {
1732             int sz=PyList_Size(elt0);
1733             MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1734             int *pt=da->getPointer();
1735             for(int i=0;i<sz;i++,pt++)
1736               {
1737                 PyObject *elt1=PyList_GetItem(elt0,i);
1738                 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1739               }
1740             return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1741           }
1742         else if(elt0 && PySlice_Check(elt0))
1743           {
1744             Py_ssize_t strt=2,stp=2,step=2;
1745             PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1746             if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1747               return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1748             else
1749               throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1750           }
1751         else
1752           return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1753       }
1754
1755       bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1756       {
1757         std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1758         return self->changeMeshNames(modifTab);
1759       }
1760
1761       PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1762       {
1763         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1764         std::size_t sz=ret.size();
1765         PyObject *retPy=PyList_New(sz);
1766         for(std::size_t i=0;i<sz;i++)
1767           PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1768         return retPy;
1769       }
1770
1771       void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1772       {
1773         std::vector<MEDFileAnyTypeField1TS *> tmp;
1774         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1775         self->pushBackTimeSteps(tmp);
1776       }
1777     }
1778   };
1779
1780   class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1781   {
1782   public:
1783     static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1784     static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1785     static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1786     //
1787     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1788     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1789     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1790     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1791     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1792     //
1793     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1794     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1795     ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1796     %extend
1797        {
1798          MEDFileFieldMultiTS()
1799          {
1800            return MEDFileFieldMultiTS::New();
1801          }
1802
1803          MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1804          {
1805            return MEDFileFieldMultiTS::New(fileName);
1806          }
1807
1808          MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1809          {
1810            return MEDFileFieldMultiTS::New(fileName,fieldName);
1811          }
1812          
1813          std::string __str__() const throw(INTERP_KERNEL::Exception)
1814          {
1815            return self->simpleRepr();
1816          }
1817
1818          PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1819          {
1820            DataArrayInt *ret1=0;
1821            DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1822            PyObject *ret=PyTuple_New(2);
1823            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1824            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1825            return ret;
1826          }
1827
1828          PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1829          {
1830            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1831            std::vector< std::vector<TypeOfField> > typesF;
1832            std::vector< std::vector<std::string> > pfls;
1833            std::vector< std::vector<std::string> > locs;
1834            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1835            int sz=ret.size();
1836            PyObject *ret2=PyList_New(sz);
1837            for(int i=0;i<sz;i++)
1838              {
1839                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1840                const std::vector<TypeOfField>& typesFI=typesF[i];
1841                const std::vector<std::string>& pflsI=pfls[i];
1842                const std::vector<std::string>& locsI=locs[i];
1843                PyObject *elt=PyTuple_New(2);
1844                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1845                int sz2=ret[i].size();
1846                PyObject *elt2=PyList_New(sz2);
1847                for(int j=0;j<sz2;j++)
1848                  {
1849                    PyObject *elt3=PyTuple_New(4);
1850                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1851                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1852                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1853                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1854                    PyList_SetItem(elt2,j,elt3);
1855                  }
1856                PyTuple_SetItem(elt,1,elt2);
1857                PyList_SetItem(ret2,i,elt);
1858              }
1859            return ret2;
1860          }
1861          DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1862          {
1863            DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1864            if(ret)
1865              ret->incrRef();
1866            return ret;
1867          }
1868          
1869          PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1870          {
1871            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1872            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1873            if(elt0)
1874              elt0->incrRef();
1875            PyObject *ret=PyTuple_New(2);
1876            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1877            std::size_t sz=elt1Cpp.size();
1878            PyObject *elt=PyList_New(sz);
1879            for(std::size_t i=0;i<sz;i++)
1880              {
1881                PyObject *elt1=PyTuple_New(2);
1882                PyObject *elt2=PyTuple_New(2);
1883                PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1884                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1885                PyObject *elt3=PyTuple_New(2);
1886                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1887                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1888                PyTuple_SetItem(elt1,0,elt2);
1889                PyTuple_SetItem(elt1,1,elt3);
1890                PyList_SetItem(elt,i,elt1);
1891              }
1892            PyTuple_SetItem(ret,1,elt);
1893            return ret;
1894          }
1895        }
1896   };
1897
1898   class MEDFileFieldsIterator
1899   {
1900   public:
1901     %extend
1902     {
1903       PyObject *next() throw(INTERP_KERNEL::Exception)
1904       {
1905         MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1906         if(ret)
1907           return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1908         else
1909           {
1910             PyErr_SetString(PyExc_StopIteration,"No more data.");
1911             return 0;
1912           }
1913       }
1914     }
1915   };
1916
1917   class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1918   {
1919   public:
1920     static MEDFileIntFieldMultiTS *New();
1921     static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1922     static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1923     //
1924     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1925     void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1926     ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1927     %extend
1928     {
1929       MEDFileIntFieldMultiTS()
1930       {
1931         return MEDFileIntFieldMultiTS::New();
1932       }
1933       
1934       MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1935       {
1936         return MEDFileIntFieldMultiTS::New(fileName);
1937       }
1938       
1939       MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1940       {
1941         return MEDFileIntFieldMultiTS::New(fileName,fieldName);
1942       }
1943
1944       std::string __str__() const throw(INTERP_KERNEL::Exception)
1945       {
1946         return self->simpleRepr();
1947       }
1948
1949       PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1950       {
1951         DataArrayInt *ret1=0;
1952         MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1953         PyObject *ret=PyTuple_New(2);
1954         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1955         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1956         return ret;
1957       }
1958
1959       PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1960       {
1961         DataArrayInt *ret1=0;
1962         MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1963         PyObject *ret=PyTuple_New(2);
1964         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1965         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1966         return ret;
1967       }
1968
1969       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1970       {
1971         DataArrayInt *ret1=0;
1972         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1973         PyObject *ret=PyTuple_New(2);
1974         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1975         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1976         return ret;
1977       }
1978       
1979       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1980       {
1981         DataArrayInt *ret1=0;
1982         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1983         PyObject *ret=PyTuple_New(2);
1984         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1985         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1986         return ret;
1987       }
1988       
1989       PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1990       {
1991         DataArrayInt *ret1=0;
1992         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1993         PyObject *ret=PyTuple_New(2);
1994         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1995         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1996         return ret;
1997       }
1998
1999       PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2000       {
2001          DataArrayInt *ret1=0;
2002          DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2003          PyObject *ret=PyTuple_New(2);
2004          PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2005          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2006          return ret;
2007       }
2008
2009       DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2010       {
2011         DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2012         if(ret)
2013           ret->incrRef();
2014         return ret;
2015       }
2016     }
2017   };
2018
2019   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2020   {
2021   public:
2022     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2023     static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2024     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2025     MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2026     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2027     int getNumberOfFields() const;
2028     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2029     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2030     //
2031     void resize(int newSize) throw(INTERP_KERNEL::Exception);
2032     void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2033     void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2034     int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2035     MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2036     MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2037     MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2038     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2039     %extend
2040        {
2041          MEDFileFields()
2042          {
2043            return MEDFileFields::New();
2044          }
2045
2046          MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
2047          {
2048            return MEDFileFields::New(fileName);
2049          }
2050          
2051          std::string __str__() const throw(INTERP_KERNEL::Exception)
2052          {
2053            return self->simpleRepr();
2054          }
2055
2056          PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2057          {
2058            bool ret1;
2059            std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2060            PyObject *ret=PyTuple_New(2);
2061            PyObject *ret_0=PyList_New(ret0.size());
2062            int rk=0;
2063            for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2064              {
2065                PyObject *elt=PyTuple_New(2);
2066                PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2067                PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2068                PyList_SetItem(ret_0,rk,elt);
2069              }
2070            PyTuple_SetItem(ret,0,ret_0);
2071            PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2072            PyTuple_SetItem(ret,1,ret_1);
2073            return ret;
2074          }
2075
2076          MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2077          {
2078            std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2079            return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2080          }
2081
2082          MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2083          {
2084            std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2085            return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2086          }
2087          
2088          PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2089          {
2090            if(obj && PyList_Check(obj))
2091              {
2092                int sz=PyList_Size(obj);
2093                MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2094                int *pt=da->getPointer();
2095                for(int i=0;i<sz;i++,pt++)
2096                  {
2097                    PyObject *elt1=PyList_GetItem(obj,i);
2098                    *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2099                  }
2100                return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2101              }
2102            else
2103              return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2104          }
2105
2106          MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2107          {
2108            self->setFieldAtPos(obj,field);
2109            return self;
2110          }
2111
2112          int __len__() const throw(INTERP_KERNEL::Exception)
2113          {
2114            return self->getNumberOfFields();
2115          }
2116
2117          MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2118          {
2119            return self->iterator();
2120          }
2121          
2122          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2123          {
2124            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2125            return self->changeMeshNames(modifTab);
2126          }
2127
2128          int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2129          {
2130            if(elt0 && PyInt_Check(elt0))
2131              {//fmts[3]
2132                return PyInt_AS_LONG(elt0);
2133              }
2134            else if(elt0 && PyString_Check(elt0))
2135              return self->getPosFromFieldName(PyString_AsString(elt0));
2136            else
2137              throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2138          }
2139          
2140          std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2141          {
2142            if(PyList_Check(elts))
2143              {
2144                int sz=PyList_Size(elts);
2145                std::vector<int> ret(sz);
2146                for(int i=0;i<sz;i++)
2147                  {
2148                    PyObject *elt=PyList_GetItem(elts,i);
2149                    ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2150                  }
2151                return ret;
2152              }
2153            else
2154              {
2155                std::vector<int> ret(1);
2156                ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2157                return ret;
2158              }
2159          }
2160
2161          void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2162          {
2163            std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2164            convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2165            self->pushFields(tmp);
2166          }
2167          
2168          void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2169          {
2170            if(elts && PySlice_Check(elts))
2171              {
2172                Py_ssize_t strt=2,stp=2,step=2;
2173                PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2174                if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2175                  self->destroyFieldsAtPos2(strt,stp,step);
2176                else
2177                  throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2178              }
2179            else
2180              {
2181                std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2182                if(!idsToRemove.empty())
2183                  self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2184              }
2185          }
2186        }
2187   };
2188
2189   class MEDFileParameter1TS : public RefCountObject
2190   {
2191   public:
2192     void setIteration(int it);
2193     int getIteration() const;
2194     void setOrder(int order);
2195     int getOrder() const;
2196     void setTimeValue(double time);
2197     void setTime(int dt, int it, double time);
2198     double getTime(int& dt, int& it);
2199     double getTimeValue() const;
2200   };
2201
2202   class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2203   {
2204   public:
2205     void setValue(double val) throw(INTERP_KERNEL::Exception);
2206     double getValue() const throw(INTERP_KERNEL::Exception);
2207     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2208     %extend
2209     {
2210       std::string __str__() const throw(INTERP_KERNEL::Exception)
2211       {
2212         return self->simpleRepr();
2213       }
2214     }
2215   };
2216
2217   class MEDFileParameterTinyInfo : public MEDFileWritable
2218   {
2219   public:
2220     void setDescription(const char *name);
2221     const char *getDescription() const;
2222     void setTimeUnit(const char *unit);
2223     const char *getTimeUnit() const;
2224   };
2225
2226   class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2227   {
2228   public:
2229     static MEDFileParameterDouble1TS *New();
2230     static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2231     static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2232     static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2233     virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2234     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2235     void setName(const char *name) throw(INTERP_KERNEL::Exception);
2236     const char *getName() const throw(INTERP_KERNEL::Exception);
2237     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2238     %extend
2239     {
2240       MEDFileParameterDouble1TS()
2241       {
2242         return MEDFileParameterDouble1TS::New();
2243       }
2244       
2245       MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2246       {
2247         return MEDFileParameterDouble1TS::New(fileName);
2248       }
2249
2250       MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2251       {
2252         return MEDFileParameterDouble1TS::New(fileName,paramName);
2253       }
2254
2255       MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2256       {
2257         return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2258       }
2259
2260       std::string __str__() const throw(INTERP_KERNEL::Exception)
2261       {
2262         return self->simpleRepr();
2263       }
2264
2265       PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2266       {
2267         std::string what;
2268         bool ret0=self->isEqual(other,eps,what);
2269         PyObject *res=PyList_New(2);
2270         PyObject *ret0Py=ret0?Py_True:Py_False;
2271         Py_XINCREF(ret0Py);
2272         PyList_SetItem(res,0,ret0Py);
2273         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2274         return res;
2275       }
2276     }
2277   };
2278
2279   class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2280   {
2281   public:
2282     static MEDFileParameterMultiTS *New();
2283     static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2284     static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2285     const char *getName() const;
2286     void setName(const char *name);
2287     MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2288     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2289     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2290     void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2291     double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2292     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2293     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2294     %extend
2295     {
2296       MEDFileParameterMultiTS()
2297       {
2298         return MEDFileParameterMultiTS::New();
2299       }
2300       
2301       MEDFileParameterMultiTS(const char *fileName)
2302       {
2303         return MEDFileParameterMultiTS::New(fileName);
2304       }
2305
2306       MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2307       {
2308         return MEDFileParameterMultiTS::New(fileName,paramName);
2309       }
2310
2311       std::string __str__() const throw(INTERP_KERNEL::Exception)
2312       {
2313         return self->simpleRepr();
2314       }
2315       
2316       PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2317       {
2318         std::string what;
2319         bool ret0=self->isEqual(other,eps,what);
2320         PyObject *res=PyList_New(2);
2321         PyObject *ret0Py=ret0?Py_True:Py_False;
2322         Py_XINCREF(ret0Py);
2323         PyList_SetItem(res,0,ret0Py);
2324         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2325         return res;
2326       }
2327       
2328       void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2329       {
2330         int sw;
2331         int pos1;
2332         std::vector<int> pos2;
2333         DataArrayInt *pos3=0;
2334         DataArrayIntTuple *pos4=0;
2335         convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2336         switch(sw)
2337           {
2338           case 1:
2339             {
2340               self->eraseTimeStepIds(&pos1,&pos1+1);
2341               return;
2342             }
2343           case 2:
2344             {
2345               if(pos2.empty())
2346                 return;
2347               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2348               return ;
2349             }
2350           case 3:
2351             {
2352               self->eraseTimeStepIds(pos3->begin(),pos3->end());
2353               return ;
2354             }
2355           default:
2356             throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2357           }
2358       }
2359
2360       int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2361       {
2362         if(elt0 && PyInt_Check(elt0))
2363           {//fmts[3]
2364             int pos=PyInt_AS_LONG(elt0);
2365             return pos;
2366           }
2367         else if(elt0 && PyTuple_Check(elt0))
2368           {
2369             if(PyTuple_Size(elt0)==2)
2370               {
2371                 PyObject *o0=PyTuple_GetItem(elt0,0);
2372                 PyObject *o1=PyTuple_GetItem(elt0,1);
2373                 if(PyInt_Check(o0) && PyInt_Check(o1))
2374                   {//fmts(1,-1)
2375                     int iter=PyInt_AS_LONG(o0);
2376                     int order=PyInt_AS_LONG(o1);
2377                     return self->getPosOfTimeStep(iter,order);
2378                   }
2379                 else
2380                   throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
2381               }
2382             else
2383               throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
2384           }
2385         else if(elt0 && PyFloat_Check(elt0))
2386           {
2387             double val=PyFloat_AS_DOUBLE(elt0);
2388             return self->getPosGivenTime(val);
2389           }
2390         else
2391           throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2392       }
2393
2394       MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2395       {
2396         MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2397         if(ret)
2398           ret->incrRef();
2399         return ret;
2400       }
2401
2402       std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2403       {
2404         if(PyList_Check(elts))
2405           {
2406             int sz=PyList_Size(elts);
2407             std::vector<int> ret(sz);
2408             for(int i=0;i<sz;i++)
2409               {
2410                 PyObject *elt=PyList_GetItem(elts,i);
2411                 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2412               }
2413             return ret;
2414           }
2415         else
2416           {
2417             std::vector<int> ret(1);
2418             ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2419             return ret;
2420           }
2421       }
2422
2423       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2424       {
2425         std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2426         if(!idsToRemove.empty())
2427           self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2428       }
2429       
2430       MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2431       {
2432         MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2433         if(ret)
2434           ret->incrRef();
2435         return ret;
2436       }
2437
2438       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2439       {
2440         std::vector< std::pair<int,int> > res=self->getIterations();
2441         PyObject *ret=PyList_New(res.size());
2442         int rk=0;
2443         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2444           {
2445             PyObject *elt=PyTuple_New(2);
2446             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2447             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2448             PyList_SetItem(ret,rk,elt);
2449           }
2450         return ret;
2451       }
2452
2453       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2454       {
2455         std::vector<double> res2;
2456         std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2457         PyObject *ret=PyList_New(res.size());
2458         int rk=0;
2459         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2460           {
2461             PyObject *elt=PyTuple_New(3);
2462             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2463             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2464             PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2465             PyList_SetItem(ret,rk,elt);
2466           }
2467         return ret;
2468       }
2469     }
2470   };
2471
2472   class MEDFileParameters : public RefCountObject, public MEDFileWritable
2473   {
2474   public:
2475     static MEDFileParameters *New();
2476     static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2477     MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2478     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2479     std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2480     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2481     void resize(int newSize) throw(INTERP_KERNEL::Exception);
2482     void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2483     void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2484     void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2485     int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2486     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2487     %extend
2488     {
2489       MEDFileParameters()
2490       {
2491         return MEDFileParameters::New();
2492       }
2493       
2494       MEDFileParameters(const char *fileName)
2495       {
2496         return MEDFileParameters::New(fileName);
2497       }
2498
2499       std::string __str__() const throw(INTERP_KERNEL::Exception)
2500       {
2501         return self->simpleRepr();
2502       }
2503
2504       MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2505       {
2506         if(PyInt_Check(obj))
2507           {
2508             MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2509             if(ret)
2510               ret->incrRef();
2511             return ret;
2512           }
2513         else if(PyString_Check(obj))
2514           {
2515             MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2516             if(ret)
2517               ret->incrRef();
2518             return ret;
2519           }
2520         else
2521           throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2522       }
2523
2524       int __len__() const throw(INTERP_KERNEL::Exception)
2525       {
2526         return self->getNumberOfParams();
2527       }
2528       
2529       MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2530       {
2531         MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2532         if(ret)
2533           ret->incrRef();
2534         return ret;
2535       }
2536
2537       MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2538       {
2539         MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2540         if(ret)
2541           ret->incrRef();
2542         return ret;
2543       }
2544       
2545       PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2546       {
2547         std::string what;
2548         bool ret0=self->isEqual(other,eps,what);
2549         PyObject *res=PyList_New(2);
2550         PyObject *ret0Py=ret0?Py_True:Py_False;
2551         Py_XINCREF(ret0Py);
2552         PyList_SetItem(res,0,ret0Py);
2553         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2554         return res;
2555       }
2556     }
2557   };
2558
2559   class MEDFileData : public RefCountObject, public MEDFileWritable
2560   {
2561   public:
2562     static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2563     static MEDFileData *New();
2564     MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2565     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2566     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2567     void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2568     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2569     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2570     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2571     //
2572     bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2573     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2574     //
2575     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2576     %extend
2577        {
2578          MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2579          {
2580            return MEDFileData::New(fileName);
2581          }
2582
2583          MEDFileData()
2584          {
2585            return MEDFileData::New();
2586          }
2587
2588          std::string __str__() const throw(INTERP_KERNEL::Exception)
2589          {
2590            return self->simpleRepr();
2591          }
2592
2593          MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2594          {
2595            MEDFileMeshes *ret=self->getMeshes();
2596            if(ret)
2597              ret->incrRef();
2598            return ret;
2599          }
2600
2601          MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2602          {
2603            MEDFileParameters *ret=self->getParams();
2604            if(ret)
2605              ret->incrRef();
2606            return ret;
2607          }
2608
2609          MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2610          {
2611            MEDFileFields *ret=self->getFields();
2612            if(ret)
2613              ret->incrRef();
2614            return ret;
2615          }
2616
2617          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2618          {
2619            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2620            return self->changeMeshNames(modifTab);
2621          }
2622        }
2623   };
2624
2625   class SauvReader : public RefCountObject
2626   {
2627   public:
2628     static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2629     MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2630   };
2631
2632   class SauvWriter : public RefCountObject
2633   {
2634   public:
2635     static SauvWriter * New();
2636     void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2637     void write(const char* fileName) throw(INTERP_KERNEL::Exception);
2638   };
2639
2640 }