Salome HOME
MED file loading on demand.
[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, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1106     static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1107     static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1108     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1109     void loadArrays() throw(INTERP_KERNEL::Exception);
1110     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1111     void releaseArrays() throw(INTERP_KERNEL::Exception);
1112     int getDimension() const throw(INTERP_KERNEL::Exception);
1113     int getIteration() const throw(INTERP_KERNEL::Exception);
1114     int getOrder() const throw(INTERP_KERNEL::Exception);
1115     std::string getName() throw(INTERP_KERNEL::Exception);
1116     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1117     std::string getMeshName() throw(INTERP_KERNEL::Exception);
1118     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1119     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1120     bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1121     void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1122     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1123     void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1124     virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1125     MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1126     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1127     void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1128     %extend
1129     {
1130       PyObject *getTime() throw(INTERP_KERNEL::Exception)
1131       {
1132         int tmp1,tmp2;
1133         double tmp0=self->getTime(tmp1,tmp2);
1134         PyObject *res = PyList_New(3);
1135         PyList_SetItem(res,0,SWIG_From_int(tmp1));
1136         PyList_SetItem(res,1,SWIG_From_int(tmp2));
1137         PyList_SetItem(res,2,SWIG_From_double(tmp0));
1138         return res;
1139       }
1140
1141       PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1142       {
1143         std::pair<int,int> res=self->getDtIt();
1144         PyObject *elt=PyTuple_New(2);
1145         PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1146         PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1147         return elt;
1148       }
1149
1150       void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1151       {
1152         self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1153       }
1154       
1155       void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1156       {
1157         self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1158       }
1159
1160       bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1161       {
1162         std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1163         return self->changeMeshNames(modifTab);
1164       }
1165       
1166       PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1167       {
1168         std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1169         PyObject *ret2=PyList_New(ret.size());
1170         for(int i=0;i<(int)ret.size();i++)
1171           PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1172         return ret2;
1173       }
1174
1175       PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1176       {
1177         std::vector<int> ret1;
1178         int ret0=self->getNonEmptyLevels(mname,ret1);
1179         PyObject *elt=PyTuple_New(2);
1180         PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1181         PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1182         return elt;
1183       }
1184
1185       PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1186       {
1187         std::vector<INTERP_KERNEL::NormalizedCellType> types;
1188         std::vector< std::vector<TypeOfField> > typesF;
1189         std::vector< std::vector<std::string> > pfls;
1190         std::vector< std::vector<std::string> > locs;
1191         std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1192         int sz=ret.size();
1193         PyObject *ret2=PyList_New(sz);
1194            for(int i=0;i<sz;i++)
1195              {
1196                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1197                const std::vector<TypeOfField>& typesFI=typesF[i];
1198                const std::vector<std::string>& pflsI=pfls[i];
1199                const std::vector<std::string>& locsI=locs[i];
1200                PyObject *elt=PyTuple_New(2);
1201                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1202                int sz2=ret[i].size();
1203                PyObject *elt2=PyList_New(sz2);
1204                for(int j=0;j<sz2;j++)
1205                  {
1206                    PyObject *elt3=PyTuple_New(4);
1207                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1208                    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));
1209                    PyTuple_SetItem(elt3,1,elt4);
1210                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1211                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1212                    PyList_SetItem(elt2,j,elt3);
1213                  }
1214                PyTuple_SetItem(elt,1,elt2);
1215                PyList_SetItem(ret2,i,elt);
1216              }
1217            return ret2;
1218       }
1219
1220       PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1221       {
1222         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1223         std::size_t sz=ret.size();
1224         PyObject *retPy=PyList_New(sz);
1225         for(std::size_t i=0;i<sz;i++)
1226           PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1227         return retPy;
1228       }
1229     }
1230   };
1231
1232   class MEDFileField1TS : public MEDFileAnyTypeField1TS
1233   {
1234   public:
1235     static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1236     static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1237     static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1238     static MEDFileField1TS *New();
1239     ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1240     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1241     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1242     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1243     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1244     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1245     //
1246     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1247     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1248     void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1249     void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1250     %extend
1251        {
1252          MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1253          {
1254            return MEDFileField1TS::New(fileName,loadAll);
1255          }
1256          
1257          MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1258          {
1259            return MEDFileField1TS::New(fileName,fieldName,loadAll);
1260          }
1261
1262          MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1263          {
1264            return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1265          }
1266
1267          MEDFileField1TS()
1268          {
1269            return MEDFileField1TS::New();
1270          }
1271
1272          void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1273          {
1274            const DataArrayDouble *arr=0;
1275            if(field)
1276              arr=field->getArray();
1277            self->copyTinyInfoFrom(field,arr);
1278          }
1279          
1280          std::string __str__() const throw(INTERP_KERNEL::Exception)
1281          {
1282            return self->simpleRepr();
1283          }
1284          
1285          PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1286          {
1287            DataArrayInt *ret1=0;
1288            DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1289            PyObject *ret=PyTuple_New(2);
1290            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1291            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1292            return ret;
1293          }
1294
1295          PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1296          {
1297            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1298            std::vector< std::vector<TypeOfField> > typesF;
1299            std::vector< std::vector<std::string> > pfls;
1300            std::vector< std::vector<std::string> > locs;
1301            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1302            int sz=ret.size();
1303            PyObject *ret2=PyList_New(sz);
1304            for(int i=0;i<sz;i++)
1305              {
1306                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1307                const std::vector<TypeOfField>& typesFI=typesF[i];
1308                const std::vector<std::string>& pflsI=pfls[i];
1309                const std::vector<std::string>& locsI=locs[i];
1310                PyObject *elt=PyTuple_New(2);
1311                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1312                int sz2=ret[i].size();
1313                PyObject *elt2=PyList_New(sz2);
1314                for(int j=0;j<sz2;j++)
1315                  {
1316                    PyObject *elt3=PyTuple_New(4);
1317                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1318                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1319                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1320                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1321                    PyList_SetItem(elt2,j,elt3);
1322                  }
1323                PyTuple_SetItem(elt,1,elt2);
1324                PyList_SetItem(ret2,i,elt);
1325              }
1326            return ret2;
1327          }
1328
1329          DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1330          {
1331            DataArrayDouble *ret=self->getUndergroundDataArray();
1332            if(ret)
1333              ret->incrRef();
1334            return ret;
1335          }
1336
1337          PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1338          {
1339            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1340            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1341            if(elt0)
1342              elt0->incrRef();
1343            PyObject *ret=PyTuple_New(2);
1344            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1345            std::size_t sz=elt1Cpp.size();
1346            PyObject *elt=PyList_New(sz);
1347            for(std::size_t i=0;i<sz;i++)
1348              {
1349                PyObject *elt1=PyTuple_New(2);
1350                PyObject *elt2=PyTuple_New(2);
1351                PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1352                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1353                PyObject *elt3=PyTuple_New(2);
1354                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1355                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1356                PyTuple_SetItem(elt1,0,elt2);
1357                PyTuple_SetItem(elt1,1,elt3);
1358                PyList_SetItem(elt,i,elt1);
1359              }
1360            PyTuple_SetItem(ret,1,elt);
1361            return ret;
1362          }
1363        }
1364   };
1365
1366   class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1367   {
1368   public:
1369     static MEDFileIntField1TS *New();
1370     static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1371     static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1372     static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1373     ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1374     //
1375     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1376     void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1377     %extend
1378     {
1379       MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1380       {
1381         return MEDFileIntField1TS::New();
1382       }
1383
1384       MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1385       {
1386         return MEDFileIntField1TS::New(fileName,loadAll);
1387       }
1388
1389       MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1390       {
1391         return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1392       }
1393
1394       MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1395       {
1396         return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1397       }
1398
1399       std::string __str__() const throw(INTERP_KERNEL::Exception)
1400       {
1401         return self->simpleRepr();
1402       }
1403
1404       PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1405       {
1406         DataArrayInt *ret1=0;
1407         MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1408         PyObject *ret=PyTuple_New(2);
1409         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1410         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1411         return ret;
1412       }
1413
1414       PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1415       {
1416         DataArrayInt *ret1=0;
1417         MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1418         PyObject *ret=PyTuple_New(2);
1419         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1420         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1421         return ret;
1422       }
1423
1424       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1425       {
1426         DataArrayInt *ret1=0;
1427         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1428         PyObject *ret=PyTuple_New(2);
1429         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1430         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1431         return ret;
1432       }
1433       
1434       PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1435       {
1436         DataArrayInt *ret1=0;
1437         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1438         PyObject *ret=PyTuple_New(2);
1439         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1440         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1441         return ret;
1442       }
1443       
1444       PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1445       {
1446         DataArrayInt *ret1=0;
1447         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1448         PyObject *ret=PyTuple_New(2);
1449         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1450         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1451         return ret;
1452       }
1453
1454       PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1455       {
1456          DataArrayInt *ret1=0;
1457          DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1458          PyObject *ret=PyTuple_New(2);
1459          PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1460          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1461          return ret;
1462       }
1463       
1464       DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1465       {
1466         DataArrayInt *ret=self->getUndergroundDataArray();
1467         if(ret)
1468           ret->incrRef();
1469         return ret;
1470       }
1471     }
1472   };
1473
1474   class MEDFileAnyTypeFieldMultiTSIterator
1475   {
1476   public:
1477     %extend
1478     {
1479       PyObject *next() throw(INTERP_KERNEL::Exception)
1480       {
1481         MEDFileAnyTypeField1TS *ret=self->nextt();
1482         if(ret)
1483           return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1484         else
1485           {
1486             PyErr_SetString(PyExc_StopIteration,"No more data.");
1487             return 0;
1488           }
1489       }
1490     }
1491   };
1492
1493   class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1494   {
1495   public:
1496     static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1497     static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1498     MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1499     virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1500     std::string getName() const throw(INTERP_KERNEL::Exception);
1501     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1502     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1503     void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1504     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1505     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1506     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1507     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1508     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1509     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1510     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1511     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1512     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1513     void loadArrays() throw(INTERP_KERNEL::Exception);
1514     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1515     void releaseArrays() throw(INTERP_KERNEL::Exception);
1516     //
1517     virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1518     MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1519     MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1520     void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1521     void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1522     %extend
1523     {
1524       int __len__() const throw(INTERP_KERNEL::Exception)
1525       {
1526         return self->getNumberOfTS();
1527       }
1528
1529       int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1530       {
1531         if(elt0 && PyInt_Check(elt0))
1532           {//fmts[3]
1533             int pos=PyInt_AS_LONG(elt0);
1534             return pos;
1535           }
1536         else if(elt0 && PyTuple_Check(elt0))
1537           {
1538             if(PyTuple_Size(elt0)==2)
1539               {
1540                 PyObject *o0=PyTuple_GetItem(elt0,0);
1541                 PyObject *o1=PyTuple_GetItem(elt0,1);
1542                 if(PyInt_Check(o0) && PyInt_Check(o1))
1543                   {//fmts(1,-1)
1544                     int iter=PyInt_AS_LONG(o0);
1545                     int order=PyInt_AS_LONG(o1);
1546                     return self->getPosOfTimeStep(iter,order);
1547                   }
1548                 else
1549                   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 !");
1550               }
1551             else
1552               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 !");
1553           }
1554         else if(elt0 && PyFloat_Check(elt0))
1555           {
1556             double val=PyFloat_AS_DOUBLE(elt0);
1557             return self->getPosGivenTime(val);
1558           }
1559         else
1560           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1561       }
1562       
1563       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1564       {
1565         std::vector< std::pair<int,int> > res=self->getIterations();
1566         PyObject *ret=PyList_New(res.size());
1567         int rk=0;
1568         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1569           {
1570             PyObject *elt=PyTuple_New(2);
1571             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1572             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1573             PyList_SetItem(ret,rk,elt);
1574           }
1575         return ret;
1576       }
1577       
1578       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1579       {
1580         std::vector<double> ret1;
1581         std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1582         std::size_t sz=ret.size();
1583         PyObject *ret2=PyList_New(sz);
1584         for(std::size_t i=0;i<sz;i++)
1585           {
1586             PyObject *elt=PyTuple_New(3);
1587             PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1588             PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1589             PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1590             PyList_SetItem(ret2,i,elt);
1591           }
1592         return ret2;
1593       }
1594       
1595       PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1596       {
1597         std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1598         PyObject *ret2=PyList_New(ret.size());
1599         for(int i=0;i<(int)ret.size();i++)
1600           {
1601             const std::vector<TypeOfField>& rett=ret[i];
1602             PyObject *ret3=PyList_New(rett.size());
1603             for(int j=0;j<(int)rett.size();j++)
1604               PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1605             PyList_SetItem(ret2,i,ret3);
1606           }
1607         return ret2;
1608       }
1609       
1610       PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1611       {
1612         std::vector<int> ret1;
1613         int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1614         PyObject *elt=PyTuple_New(2);
1615         PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1616         PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1617         return elt;
1618       }
1619       
1620       PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1621       {
1622         std::vector<INTERP_KERNEL::NormalizedCellType> types;
1623         std::vector< std::vector<TypeOfField> > typesF;
1624         std::vector< std::vector<std::string> > pfls;
1625         std::vector< std::vector<std::string> > locs;
1626         std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1627         int sz=ret.size();
1628         PyObject *ret2=PyList_New(sz);
1629         for(int i=0;i<sz;i++)
1630           {
1631             const std::vector< std::pair<int,int> >& dadsI=ret[i];
1632             const std::vector<TypeOfField>& typesFI=typesF[i];
1633             const std::vector<std::string>& pflsI=pfls[i];
1634             const std::vector<std::string>& locsI=locs[i];
1635             PyObject *elt=PyTuple_New(2);
1636             PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1637             int sz2=ret[i].size();
1638             PyObject *elt2=PyList_New(sz2);
1639             for(int j=0;j<sz2;j++)
1640               {
1641                 PyObject *elt3=PyTuple_New(4);
1642                 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1643                 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));
1644                 PyTuple_SetItem(elt3,1,elt4);
1645                 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1646                 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1647                 PyList_SetItem(elt2,j,elt3);
1648               }
1649             PyTuple_SetItem(elt,1,elt2);
1650             PyList_SetItem(ret2,i,elt);
1651           }
1652         return ret2;
1653       }
1654
1655       std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1656       {
1657         if(PyList_Check(elts))
1658           {
1659             int sz=PyList_Size(elts);
1660             std::vector<int> ret(sz);
1661             for(int i=0;i<sz;i++)
1662               {
1663                 PyObject *elt=PyList_GetItem(elts,i);
1664                 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1665               }
1666             return ret;
1667           }
1668         else
1669           {
1670             std::vector<int> ret(1);
1671             ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1672             return ret;
1673           }
1674       }
1675       
1676       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1677       {
1678         if(PySlice_Check(elts))
1679           {
1680             Py_ssize_t strt=2,stp=2,step=2;
1681             PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1682             if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1683               {
1684                 self->eraseTimeStepIds2(strt,stp,step);
1685               }
1686             else
1687               throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1688           }
1689         else
1690           {
1691             std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1692             if(!idsToRemove.empty())
1693               self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1694           }
1695       }
1696       
1697       void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1698       {
1699         int sw;
1700         int pos1;
1701         std::vector<int> pos2;
1702         DataArrayInt *pos3=0;
1703         DataArrayIntTuple *pos4=0;
1704         convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1705         switch(sw)
1706           {
1707           case 1:
1708             {
1709               self->eraseTimeStepIds(&pos1,&pos1+1);
1710               return;
1711             }
1712           case 2:
1713             {
1714               if(pos2.empty())
1715                 return;
1716               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1717               return ;
1718             }
1719           case 3:
1720             {
1721               self->eraseTimeStepIds(pos3->begin(),pos3->end());
1722               return ;
1723             }
1724           default:
1725             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1726           }
1727       }
1728
1729       MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1730       {
1731         return self->iterator();
1732       }
1733
1734       PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1735       {
1736         if(elt0 && PyList_Check(elt0))
1737           {
1738             int sz=PyList_Size(elt0);
1739             MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1740             int *pt=da->getPointer();
1741             for(int i=0;i<sz;i++,pt++)
1742               {
1743                 PyObject *elt1=PyList_GetItem(elt0,i);
1744                 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1745               }
1746             return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1747           }
1748         else if(elt0 && PySlice_Check(elt0))
1749           {
1750             Py_ssize_t strt=2,stp=2,step=2;
1751             PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1752             if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1753               return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1754             else
1755               throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1756           }
1757         else
1758           return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1759       }
1760
1761       bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1762       {
1763         std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1764         return self->changeMeshNames(modifTab);
1765       }
1766
1767       PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1768       {
1769         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1770         std::size_t sz=ret.size();
1771         PyObject *retPy=PyList_New(sz);
1772         for(std::size_t i=0;i<sz;i++)
1773           PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1774         return retPy;
1775       }
1776
1777       void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1778       {
1779         std::vector<MEDFileAnyTypeField1TS *> tmp;
1780         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1781         self->pushBackTimeSteps(tmp);
1782       }
1783     }
1784   };
1785
1786   class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1787   {
1788   public:
1789     static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1790     static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1791     static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1792     //
1793     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1794     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1795     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1796     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1797     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1798     //
1799     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1800     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1801     ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1802     %extend
1803        {
1804          MEDFileFieldMultiTS()
1805          {
1806            return MEDFileFieldMultiTS::New();
1807          }
1808
1809          MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1810          {
1811            return MEDFileFieldMultiTS::New(fileName,loadAll);
1812          }
1813
1814          MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1815          {
1816            return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
1817          }
1818          
1819          std::string __str__() const throw(INTERP_KERNEL::Exception)
1820          {
1821            return self->simpleRepr();
1822          }
1823
1824          PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1825          {
1826            DataArrayInt *ret1=0;
1827            DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1828            PyObject *ret=PyTuple_New(2);
1829            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1830            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1831            return ret;
1832          }
1833
1834          PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1835          {
1836            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1837            std::vector< std::vector<TypeOfField> > typesF;
1838            std::vector< std::vector<std::string> > pfls;
1839            std::vector< std::vector<std::string> > locs;
1840            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1841            int sz=ret.size();
1842            PyObject *ret2=PyList_New(sz);
1843            for(int i=0;i<sz;i++)
1844              {
1845                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1846                const std::vector<TypeOfField>& typesFI=typesF[i];
1847                const std::vector<std::string>& pflsI=pfls[i];
1848                const std::vector<std::string>& locsI=locs[i];
1849                PyObject *elt=PyTuple_New(2);
1850                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1851                int sz2=ret[i].size();
1852                PyObject *elt2=PyList_New(sz2);
1853                for(int j=0;j<sz2;j++)
1854                  {
1855                    PyObject *elt3=PyTuple_New(4);
1856                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1857                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1858                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1859                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1860                    PyList_SetItem(elt2,j,elt3);
1861                  }
1862                PyTuple_SetItem(elt,1,elt2);
1863                PyList_SetItem(ret2,i,elt);
1864              }
1865            return ret2;
1866          }
1867          DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1868          {
1869            DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1870            if(ret)
1871              ret->incrRef();
1872            return ret;
1873          }
1874          
1875          PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1876          {
1877            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1878            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1879            if(elt0)
1880              elt0->incrRef();
1881            PyObject *ret=PyTuple_New(2);
1882            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1883            std::size_t sz=elt1Cpp.size();
1884            PyObject *elt=PyList_New(sz);
1885            for(std::size_t i=0;i<sz;i++)
1886              {
1887                PyObject *elt1=PyTuple_New(2);
1888                PyObject *elt2=PyTuple_New(2);
1889                PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1890                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1891                PyObject *elt3=PyTuple_New(2);
1892                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1893                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1894                PyTuple_SetItem(elt1,0,elt2);
1895                PyTuple_SetItem(elt1,1,elt3);
1896                PyList_SetItem(elt,i,elt1);
1897              }
1898            PyTuple_SetItem(ret,1,elt);
1899            return ret;
1900          }
1901        }
1902   };
1903
1904   class MEDFileFieldsIterator
1905   {
1906   public:
1907     %extend
1908     {
1909       PyObject *next() throw(INTERP_KERNEL::Exception)
1910       {
1911         MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1912         if(ret)
1913           return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1914         else
1915           {
1916             PyErr_SetString(PyExc_StopIteration,"No more data.");
1917             return 0;
1918           }
1919       }
1920     }
1921   };
1922
1923   class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1924   {
1925   public:
1926     static MEDFileIntFieldMultiTS *New();
1927     static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1928     static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1929     //
1930     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1931     void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1932     ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1933     %extend
1934     {
1935       MEDFileIntFieldMultiTS()
1936       {
1937         return MEDFileIntFieldMultiTS::New();
1938       }
1939       
1940       MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1941       {
1942         return MEDFileIntFieldMultiTS::New(fileName,loadAll);
1943       }
1944       
1945       MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1946       {
1947         return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
1948       }
1949
1950       std::string __str__() const throw(INTERP_KERNEL::Exception)
1951       {
1952         return self->simpleRepr();
1953       }
1954
1955       PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1956       {
1957         DataArrayInt *ret1=0;
1958         MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1959         PyObject *ret=PyTuple_New(2);
1960         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1961         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1962         return ret;
1963       }
1964
1965       PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1966       {
1967         DataArrayInt *ret1=0;
1968         MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1969         PyObject *ret=PyTuple_New(2);
1970         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1971         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1972         return ret;
1973       }
1974
1975       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1976       {
1977         DataArrayInt *ret1=0;
1978         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1979         PyObject *ret=PyTuple_New(2);
1980         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1981         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1982         return ret;
1983       }
1984       
1985       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1986       {
1987         DataArrayInt *ret1=0;
1988         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1989         PyObject *ret=PyTuple_New(2);
1990         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1991         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1992         return ret;
1993       }
1994       
1995       PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1996       {
1997         DataArrayInt *ret1=0;
1998         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1999         PyObject *ret=PyTuple_New(2);
2000         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2001         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2002         return ret;
2003       }
2004
2005       PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2006       {
2007          DataArrayInt *ret1=0;
2008          DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2009          PyObject *ret=PyTuple_New(2);
2010          PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2011          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2012          return ret;
2013       }
2014
2015       DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2016       {
2017         DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2018         if(ret)
2019           ret->incrRef();
2020         return ret;
2021       }
2022     }
2023   };
2024
2025   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2026   {
2027   public:
2028     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2029     static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2030     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2031     MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2032     void loadArrays() throw(INTERP_KERNEL::Exception);
2033     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
2034     void releaseArrays() throw(INTERP_KERNEL::Exception);
2035     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2036     int getNumberOfFields() const;
2037     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2038     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2039     //
2040     void resize(int newSize) throw(INTERP_KERNEL::Exception);
2041     void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2042     void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2043     int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2044     MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2045     MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2046     MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2047     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2048     %extend
2049        {
2050          MEDFileFields()
2051          {
2052            return MEDFileFields::New();
2053          }
2054
2055          MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2056          {
2057            return MEDFileFields::New(fileName,loadAll);
2058          }
2059          
2060          std::string __str__() const throw(INTERP_KERNEL::Exception)
2061          {
2062            return self->simpleRepr();
2063          }
2064
2065          PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2066          {
2067            bool ret1;
2068            std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2069            PyObject *ret=PyTuple_New(2);
2070            PyObject *ret_0=PyList_New(ret0.size());
2071            int rk=0;
2072            for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2073              {
2074                PyObject *elt=PyTuple_New(2);
2075                PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2076                PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2077                PyList_SetItem(ret_0,rk,elt);
2078              }
2079            PyTuple_SetItem(ret,0,ret_0);
2080            PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2081            PyTuple_SetItem(ret,1,ret_1);
2082            return ret;
2083          }
2084
2085          MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2086          {
2087            std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2088            return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2089          }
2090
2091          MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2092          {
2093            std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2094            return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2095          }
2096          
2097          PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2098          {
2099            if(obj && PyList_Check(obj))
2100              {
2101                int sz=PyList_Size(obj);
2102                MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2103                int *pt=da->getPointer();
2104                for(int i=0;i<sz;i++,pt++)
2105                  {
2106                    PyObject *elt1=PyList_GetItem(obj,i);
2107                    *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2108                  }
2109                return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2110              }
2111            else
2112              return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2113          }
2114
2115          MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2116          {
2117            self->setFieldAtPos(obj,field);
2118            return self;
2119          }
2120
2121          int __len__() const throw(INTERP_KERNEL::Exception)
2122          {
2123            return self->getNumberOfFields();
2124          }
2125
2126          MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2127          {
2128            return self->iterator();
2129          }
2130          
2131          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2132          {
2133            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2134            return self->changeMeshNames(modifTab);
2135          }
2136
2137          int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2138          {
2139            if(elt0 && PyInt_Check(elt0))
2140              {//fmts[3]
2141                return PyInt_AS_LONG(elt0);
2142              }
2143            else if(elt0 && PyString_Check(elt0))
2144              return self->getPosFromFieldName(PyString_AsString(elt0));
2145            else
2146              throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2147          }
2148          
2149          std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2150          {
2151            if(PyList_Check(elts))
2152              {
2153                int sz=PyList_Size(elts);
2154                std::vector<int> ret(sz);
2155                for(int i=0;i<sz;i++)
2156                  {
2157                    PyObject *elt=PyList_GetItem(elts,i);
2158                    ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2159                  }
2160                return ret;
2161              }
2162            else
2163              {
2164                std::vector<int> ret(1);
2165                ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2166                return ret;
2167              }
2168          }
2169
2170          void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2171          {
2172            std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2173            convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2174            self->pushFields(tmp);
2175          }
2176          
2177          void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2178          {
2179            if(elts && PySlice_Check(elts))
2180              {
2181                Py_ssize_t strt=2,stp=2,step=2;
2182                PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2183                if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2184                  self->destroyFieldsAtPos2(strt,stp,step);
2185                else
2186                  throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2187              }
2188            else
2189              {
2190                std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2191                if(!idsToRemove.empty())
2192                  self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2193              }
2194          }
2195        }
2196   };
2197
2198   class MEDFileParameter1TS : public RefCountObject
2199   {
2200   public:
2201     void setIteration(int it);
2202     int getIteration() const;
2203     void setOrder(int order);
2204     int getOrder() const;
2205     void setTimeValue(double time);
2206     void setTime(int dt, int it, double time);
2207     double getTime(int& dt, int& it);
2208     double getTimeValue() const;
2209   };
2210
2211   class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2212   {
2213   public:
2214     void setValue(double val) throw(INTERP_KERNEL::Exception);
2215     double getValue() const throw(INTERP_KERNEL::Exception);
2216     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2217     %extend
2218     {
2219       std::string __str__() const throw(INTERP_KERNEL::Exception)
2220       {
2221         return self->simpleRepr();
2222       }
2223     }
2224   };
2225
2226   class MEDFileParameterTinyInfo : public MEDFileWritable
2227   {
2228   public:
2229     void setDescription(const char *name);
2230     const char *getDescription() const;
2231     void setTimeUnit(const char *unit);
2232     const char *getTimeUnit() const;
2233   };
2234
2235   class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2236   {
2237   public:
2238     static MEDFileParameterDouble1TS *New();
2239     static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2240     static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2241     static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2242     virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2243     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2244     void setName(const char *name) throw(INTERP_KERNEL::Exception);
2245     const char *getName() const throw(INTERP_KERNEL::Exception);
2246     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2247     %extend
2248     {
2249       MEDFileParameterDouble1TS()
2250       {
2251         return MEDFileParameterDouble1TS::New();
2252       }
2253       
2254       MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2255       {
2256         return MEDFileParameterDouble1TS::New(fileName);
2257       }
2258
2259       MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2260       {
2261         return MEDFileParameterDouble1TS::New(fileName,paramName);
2262       }
2263
2264       MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2265       {
2266         return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2267       }
2268
2269       std::string __str__() const throw(INTERP_KERNEL::Exception)
2270       {
2271         return self->simpleRepr();
2272       }
2273
2274       PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2275       {
2276         std::string what;
2277         bool ret0=self->isEqual(other,eps,what);
2278         PyObject *res=PyList_New(2);
2279         PyObject *ret0Py=ret0?Py_True:Py_False;
2280         Py_XINCREF(ret0Py);
2281         PyList_SetItem(res,0,ret0Py);
2282         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2283         return res;
2284       }
2285     }
2286   };
2287
2288   class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2289   {
2290   public:
2291     static MEDFileParameterMultiTS *New();
2292     static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2293     static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2294     const char *getName() const;
2295     void setName(const char *name);
2296     MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2297     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2298     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2299     void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2300     double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2301     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2302     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2303     %extend
2304     {
2305       MEDFileParameterMultiTS()
2306       {
2307         return MEDFileParameterMultiTS::New();
2308       }
2309       
2310       MEDFileParameterMultiTS(const char *fileName)
2311       {
2312         return MEDFileParameterMultiTS::New(fileName);
2313       }
2314
2315       MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2316       {
2317         return MEDFileParameterMultiTS::New(fileName,paramName);
2318       }
2319
2320       std::string __str__() const throw(INTERP_KERNEL::Exception)
2321       {
2322         return self->simpleRepr();
2323       }
2324       
2325       PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2326       {
2327         std::string what;
2328         bool ret0=self->isEqual(other,eps,what);
2329         PyObject *res=PyList_New(2);
2330         PyObject *ret0Py=ret0?Py_True:Py_False;
2331         Py_XINCREF(ret0Py);
2332         PyList_SetItem(res,0,ret0Py);
2333         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2334         return res;
2335       }
2336       
2337       void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2338       {
2339         int sw;
2340         int pos1;
2341         std::vector<int> pos2;
2342         DataArrayInt *pos3=0;
2343         DataArrayIntTuple *pos4=0;
2344         convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2345         switch(sw)
2346           {
2347           case 1:
2348             {
2349               self->eraseTimeStepIds(&pos1,&pos1+1);
2350               return;
2351             }
2352           case 2:
2353             {
2354               if(pos2.empty())
2355                 return;
2356               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2357               return ;
2358             }
2359           case 3:
2360             {
2361               self->eraseTimeStepIds(pos3->begin(),pos3->end());
2362               return ;
2363             }
2364           default:
2365             throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2366           }
2367       }
2368
2369       int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2370       {
2371         if(elt0 && PyInt_Check(elt0))
2372           {//fmts[3]
2373             int pos=PyInt_AS_LONG(elt0);
2374             return pos;
2375           }
2376         else if(elt0 && PyTuple_Check(elt0))
2377           {
2378             if(PyTuple_Size(elt0)==2)
2379               {
2380                 PyObject *o0=PyTuple_GetItem(elt0,0);
2381                 PyObject *o1=PyTuple_GetItem(elt0,1);
2382                 if(PyInt_Check(o0) && PyInt_Check(o1))
2383                   {//fmts(1,-1)
2384                     int iter=PyInt_AS_LONG(o0);
2385                     int order=PyInt_AS_LONG(o1);
2386                     return self->getPosOfTimeStep(iter,order);
2387                   }
2388                 else
2389                   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 !");
2390               }
2391             else
2392               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 !");
2393           }
2394         else if(elt0 && PyFloat_Check(elt0))
2395           {
2396             double val=PyFloat_AS_DOUBLE(elt0);
2397             return self->getPosGivenTime(val);
2398           }
2399         else
2400           throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2401       }
2402
2403       MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2404       {
2405         MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2406         if(ret)
2407           ret->incrRef();
2408         return ret;
2409       }
2410
2411       std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2412       {
2413         if(PyList_Check(elts))
2414           {
2415             int sz=PyList_Size(elts);
2416             std::vector<int> ret(sz);
2417             for(int i=0;i<sz;i++)
2418               {
2419                 PyObject *elt=PyList_GetItem(elts,i);
2420                 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2421               }
2422             return ret;
2423           }
2424         else
2425           {
2426             std::vector<int> ret(1);
2427             ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2428             return ret;
2429           }
2430       }
2431
2432       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2433       {
2434         std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2435         if(!idsToRemove.empty())
2436           self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2437       }
2438       
2439       MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2440       {
2441         MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2442         if(ret)
2443           ret->incrRef();
2444         return ret;
2445       }
2446
2447       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2448       {
2449         std::vector< std::pair<int,int> > res=self->getIterations();
2450         PyObject *ret=PyList_New(res.size());
2451         int rk=0;
2452         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2453           {
2454             PyObject *elt=PyTuple_New(2);
2455             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2456             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2457             PyList_SetItem(ret,rk,elt);
2458           }
2459         return ret;
2460       }
2461
2462       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2463       {
2464         std::vector<double> res2;
2465         std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2466         PyObject *ret=PyList_New(res.size());
2467         int rk=0;
2468         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2469           {
2470             PyObject *elt=PyTuple_New(3);
2471             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2472             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2473             PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2474             PyList_SetItem(ret,rk,elt);
2475           }
2476         return ret;
2477       }
2478     }
2479   };
2480
2481   class MEDFileParameters : public RefCountObject, public MEDFileWritable
2482   {
2483   public:
2484     static MEDFileParameters *New();
2485     static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2486     MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2487     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2488     std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2489     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2490     void resize(int newSize) throw(INTERP_KERNEL::Exception);
2491     void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2492     void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2493     void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2494     int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2495     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2496     %extend
2497     {
2498       MEDFileParameters()
2499       {
2500         return MEDFileParameters::New();
2501       }
2502       
2503       MEDFileParameters(const char *fileName)
2504       {
2505         return MEDFileParameters::New(fileName);
2506       }
2507
2508       std::string __str__() const throw(INTERP_KERNEL::Exception)
2509       {
2510         return self->simpleRepr();
2511       }
2512
2513       MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2514       {
2515         if(PyInt_Check(obj))
2516           {
2517             MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2518             if(ret)
2519               ret->incrRef();
2520             return ret;
2521           }
2522         else if(PyString_Check(obj))
2523           {
2524             MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2525             if(ret)
2526               ret->incrRef();
2527             return ret;
2528           }
2529         else
2530           throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2531       }
2532
2533       int __len__() const throw(INTERP_KERNEL::Exception)
2534       {
2535         return self->getNumberOfParams();
2536       }
2537       
2538       MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2539       {
2540         MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2541         if(ret)
2542           ret->incrRef();
2543         return ret;
2544       }
2545
2546       MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2547       {
2548         MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2549         if(ret)
2550           ret->incrRef();
2551         return ret;
2552       }
2553       
2554       PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2555       {
2556         std::string what;
2557         bool ret0=self->isEqual(other,eps,what);
2558         PyObject *res=PyList_New(2);
2559         PyObject *ret0Py=ret0?Py_True:Py_False;
2560         Py_XINCREF(ret0Py);
2561         PyList_SetItem(res,0,ret0Py);
2562         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2563         return res;
2564       }
2565     }
2566   };
2567
2568   class MEDFileData : public RefCountObject, public MEDFileWritable
2569   {
2570   public:
2571     static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2572     static MEDFileData *New();
2573     MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2574     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2575     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2576     void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2577     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2578     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2579     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2580     //
2581     bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2582     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2583     //
2584     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2585     %extend
2586        {
2587          MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2588          {
2589            return MEDFileData::New(fileName);
2590          }
2591
2592          MEDFileData()
2593          {
2594            return MEDFileData::New();
2595          }
2596
2597          std::string __str__() const throw(INTERP_KERNEL::Exception)
2598          {
2599            return self->simpleRepr();
2600          }
2601
2602          MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2603          {
2604            MEDFileMeshes *ret=self->getMeshes();
2605            if(ret)
2606              ret->incrRef();
2607            return ret;
2608          }
2609
2610          MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2611          {
2612            MEDFileParameters *ret=self->getParams();
2613            if(ret)
2614              ret->incrRef();
2615            return ret;
2616          }
2617
2618          MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2619          {
2620            MEDFileFields *ret=self->getFields();
2621            if(ret)
2622              ret->incrRef();
2623            return ret;
2624          }
2625
2626          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2627          {
2628            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2629            return self->changeMeshNames(modifTab);
2630          }
2631        }
2632   };
2633
2634   class SauvReader : public RefCountObject
2635   {
2636   public:
2637     static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2638     MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2639   };
2640
2641   class SauvWriter : public RefCountObject
2642   {
2643   public:
2644     static SauvWriter * New();
2645     void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2646     void write(const char* fileName) throw(INTERP_KERNEL::Exception);
2647   };
2648
2649 }