Salome HOME
d3af1eed904aa11e1a31196f347669a1376be589
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 %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 "MEDFileMeshReadSelector.hxx"
35 #include "MEDFileFieldOverView.hxx"
36 #include "MEDLoaderTypemaps.i"
37 #include "SauvReader.hxx"
38 #include "SauvWriter.hxx"
39
40 using namespace ParaMEDMEM;
41 %}
42
43 #if SWIG_VERSION >= 0x010329
44 %template()  std::vector<std::string>;
45 #endif
46
47 %typemap(out) ParaMEDMEM::MEDFileMesh*
48 {
49   $result=convertMEDFileMesh($1,$owner);
50 }
51
52 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
53 {
54   $result=convertMEDFileParameter1TS($1,$owner);
55 }
56
57 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
58 {
59   $result=convertMEDFileFieldMultiTS($1,$owner);
60 }
61
62 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
63 {
64   $result=convertMEDFileField1TS($1,$owner);
65 }
66
67 %typemap(out) ParaMEDMEM::MEDMeshMultiLev*
68 {
69   $result=convertMEDMeshMultiLev($1,$owner);
70 }
71
72 %newobject MEDLoader::ReadUMeshFromFamilies;
73 %newobject MEDLoader::ReadUMeshFromGroups;
74 %newobject MEDLoader::ReadUMeshFromFile;
75 %newobject MEDLoader::ReadMeshFromFile;
76 %newobject MEDLoader::ReadField;
77 %newobject MEDLoader::ReadFieldCell;
78 %newobject MEDLoader::ReadFieldNode;
79 %newobject MEDLoader::ReadFieldGauss;
80 %newobject MEDLoader::ReadFieldGaussNE;
81 %newobject ParaMEDMEM::MEDFileMesh::New;
82 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
83 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
84 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
85 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
86 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
87 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
88 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
89 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
90 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
91 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
92 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
93 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
94 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
95 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
96 %newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::New;
98 %newobject ParaMEDMEM::MEDFileUMesh::LoadPartOf;
99 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
100 %newobject ParaMEDMEM::MEDFileUMesh::getPartDefAtLevel;
101 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
102 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
103 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
104 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
105 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
106 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
107 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
108 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
109 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
110 %newobject ParaMEDMEM::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
111 %newobject ParaMEDMEM::MEDFileUMesh::extractFamilyFieldOnGeoType;
112 %newobject ParaMEDMEM::MEDFileUMesh::extractNumberFieldOnGeoType;
113 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
114 %newobject ParaMEDMEM::MEDFileUMesh::buildExtrudedMesh;
115 %newobject ParaMEDMEM::MEDFileUMesh::__getitem__;
116 %newobject ParaMEDMEM::MEDFileUMesh::linearToQuadratic;
117 %newobject ParaMEDMEM::MEDFileUMesh::quadraticToLinear;
118 %newobject ParaMEDMEM::MEDFileCMesh::New;
119 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
120 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
121 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
122 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
123 %newobject ParaMEDMEM::MEDFileMeshes::New;
124 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
125 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
126 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
127 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
128 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
129
130 %newobject ParaMEDMEM::MEDFileFields::New;
131 %newobject ParaMEDMEM::MEDFileFields::LoadPartOf;
132 %newobject ParaMEDMEM::MEDFileFields::LoadSpecificEntities;
133 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
134 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
135 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
136 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
137 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
138 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
139 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
140 %newobject ParaMEDMEM::MEDFileFields::__iter__;
141
142 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
143 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
144 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
145 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
146 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
147 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
148 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
149 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
150 %newobject ParaMEDMEM::MEDFileFieldMultiTS::LoadSpecificEntities;
151 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
152 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
153 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
154 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
155 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
156 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
157 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
158 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::LoadSpecificEntities;
159 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
160 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
161
162 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
163 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
164 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
165 %newobject ParaMEDMEM::MEDFileField1TS::New;
166 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
167 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
168 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
169 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
170 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
171 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
172 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
173 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
174 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
175
176 %newobject ParaMEDMEM::MEDFileData::New;
177 %newobject ParaMEDMEM::MEDFileData::deepCpy;
178 %newobject ParaMEDMEM::MEDFileData::getMeshes;
179 %newobject ParaMEDMEM::MEDFileData::getFields;
180 %newobject ParaMEDMEM::MEDFileData::getParams;
181
182 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
183 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
184 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
185 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
186 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
187 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
188 %newobject ParaMEDMEM::MEDFileParameters::New;
189 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
190 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
191 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
192 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
193
194 %newobject ParaMEDMEM::SauvWriter::New;
195 %newobject ParaMEDMEM::SauvReader::New;
196 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
197
198 %newobject ParaMEDMEM::MEDFileMeshStruct::New;
199 %newobject ParaMEDMEM::MEDMeshMultiLev::prepare;
200 %newobject ParaMEDMEM::MEDMeshMultiLev::buildDataArray;
201 %newobject ParaMEDMEM::MEDFileFastCellSupportComparator::New;
202 %newobject ParaMEDMEM::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
203
204 %feature("unref") MEDFileMesh "$this->decrRef();"
205 %feature("unref") MEDFileUMesh "$this->decrRef();"
206 %feature("unref") MEDFileCMesh "$this->decrRef();"
207 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
208 %feature("unref") MEDFileMeshes "$this->decrRef();"
209 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
210 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
211 %feature("unref") MEDFileField1TS "$this->decrRef();"
212 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
213 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
214 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
215 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
216 %feature("unref") MEDFileFields "$this->decrRef();"
217 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
218 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
219 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
220 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
221 %feature("unref") MEDFileParameters "$this->decrRef();"
222 %feature("unref") MEDFileData "$this->decrRef();"
223 %feature("unref") SauvReader "$this->decrRef();"
224 %feature("unref") SauvWriter "$this->decrRef();"
225 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
226 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
227 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
228 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
229 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
230 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
231
232 class MEDLoader
233 {
234 public:
235   static bool HasXDR();
236   static std::string MEDFileVersionStr();
237   static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
238   static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
239   static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
240   static void CheckFileForRead(const std::string& fileName) throw(INTERP_KERNEL::Exception);
241   static std::vector<std::string> GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
242   static std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception);
243   static std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
244   static std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
245   static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception);
246   static std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception);
247   static std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
248   static std::vector<std::string> GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
249   static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
250   static std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
251   static std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
252   static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
253   static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj) throw(INTERP_KERNEL::Exception);
254   %extend
255      {
256        static PyObject *MEDFileVersion()
257        {
258          int major,minor,release;
259          MEDLoader::MEDFileVersion(major,minor,release);
260          PyObject *ret(PyTuple_New(3));
261          PyTuple_SetItem(ret,0,SWIG_From_int(major));
262          PyTuple_SetItem(ret,1,SWIG_From_int(minor));
263          PyTuple_SetItem(ret,2,SWIG_From_int(release));
264          return ret;
265        }
266
267        static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
268        {
269          std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
270          PyObject *ret=PyList_New(res.size());
271          int rk=0;
272          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
273            {
274              PyObject *elt=PyTuple_New(2);
275              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
276              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
277              PyList_SetItem(ret,rk,elt);
278            }
279          return ret;
280        }
281
282        static PyObject *GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
283        {
284          std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
285          PyObject *ret=PyList_New(res.size());
286          int rk=0;
287          for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
288            {
289              PyObject *elt=PyTuple_New(3);
290              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
291              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
292              PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
293              PyList_SetItem(ret,rk,elt);
294            }
295          return ret;
296        }
297
298        static PyObject *GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
299        {
300          std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
301          PyObject *ret=PyList_New(res.size());
302          int rk=0;
303          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
304            {
305              PyObject *elt=PyTuple_New(2);
306              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
307              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
308              PyList_SetItem(ret,rk,elt);
309            }
310          return ret;
311        }
312        static PyObject *GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
313        {
314          std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
315          PyObject *ret=PyList_New(res.size());
316          int rk=0;
317          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
318            {
319              PyObject *elt=PyTuple_New(2);
320              PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
321              PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
322              PyList_SetItem(ret,rk,elt);
323            }
324          return ret;
325        }
326        static PyObject *GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
327        {
328          std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
329          PyObject *ret=PyList_New(res.size());
330          int rk=0;
331          for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
332            {
333              PyObject *elt=PyTuple_New(2);
334              PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
335              PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
336              PyList_SetItem(ret,rk,elt);
337            }
338          return ret;
339        }
340        static PyObject *GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception)
341        {
342          int meshDim,spaceDim,numberOfNodes;
343          std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
344          PyObject *ret=PyTuple_New(4);
345          PyObject *elt0=PyList_New(res.size());
346          int i=0;
347          for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
348            {
349              const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
350              int j=0;
351              PyObject *elt1=PyList_New(obj2.size());
352              for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
353                {
354                  PyObject *elt2=PyTuple_New(2);
355                  PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
356                  PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
357                  PyList_SetItem(elt1,j,elt2);
358                }
359              PyList_SetItem(elt0,i,elt1);
360            }
361          PyTuple_SetItem(ret,0,elt0);
362          PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
363          PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
364          PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
365          return ret;
366        }
367        static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
368                                              const std::string& fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
369        {
370          std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
371          std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
372          return convertFieldDoubleVecToPy(res);
373        }
374        static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
375        {
376          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
377          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
378          MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
379        }
380        static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
381        {
382          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
383          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
384          MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
385        }
386        static void WriteUMeshes(const std::string& fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
387        {
388          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
389          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
390          MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
391        }
392        static PyObject *GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
393        {
394          std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
395          int size=v.size();
396          PyObject *ret=PyList_New(size);
397          for(int i=0;i<size;i++)
398            PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
399          return ret;
400        }
401        static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
402        {
403          std::vector<std::string> grps;
404          converPyListToVecString(li,grps);
405          return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
406        }
407        static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
408        {
409          std::vector<std::string> fams;
410          converPyListToVecString(li,fams);
411          return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
412        }
413      }
414   static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
415   static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
416   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
417   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
418   static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
419   static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
420   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
421   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
422   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
423   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
424   static void WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
425   static void WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
426   static void WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
427   static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
428   static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
429   static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
430 };
431
432 namespace ParaMEDMEM
433 {
434   class MEDFileWritable
435   {
436   public:
437     void copyOptionsFrom(const MEDFileWritable& other) const;
438     int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
439     void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
440     int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
441     void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
442   };
443
444   class MEDFileMeshReadSelector
445   {
446   public:
447     MEDFileMeshReadSelector();
448     MEDFileMeshReadSelector(unsigned int code);
449     unsigned int getCode() const;
450     void setCode(unsigned int newCode);
451     bool isCellFamilyFieldReading() const;
452     bool isNodeFamilyFieldReading() const;
453     bool isCellNameFieldReading() const;
454     bool isNodeNameFieldReading() const;
455     bool isCellNumFieldReading() const;
456     bool isNodeNumFieldReading() const;
457     void setCellFamilyFieldReading(bool b);
458     void setNodeFamilyFieldReading(bool b);
459     void setCellNameFieldReading(bool b);
460     void setNodeNameFieldReading(bool b);
461     void setCellNumFieldReading(bool b);
462     void setNodeNumFieldReading(bool b);
463     %extend
464     {
465       std::string __str__() const throw(INTERP_KERNEL::Exception)
466       {
467         std::ostringstream oss;
468         self->reprAll(oss);
469         return oss.str();
470       }
471       
472       std::string __repr__() const throw(INTERP_KERNEL::Exception)
473       {
474         std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
475         return oss.str();
476       }
477     }
478   };
479
480   class MEDFileMesh : public RefCountObject, public MEDFileWritable
481   {
482   public:
483     static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
484     static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
485     virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
486     virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
487     virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
488     virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
489     void setName(const std::string& name);
490     std::string getName();
491     std::string getUnivName() const;
492     bool getUnivNameWrStatus() const;
493     void setUnivNameWrStatus(bool newStatus);
494     void setDescription(const std::string& name);
495     std::string getDescription() const;
496     void setOrder(int order);
497     int getOrder() const;
498     void setIteration(int it);
499     int getIteration();
500     void setTimeValue(double time);
501     void setTime(int dt, int it, double time);
502     double getTimeValue() const;
503     void setTimeUnit(const std::string& unit);
504     std::string getTimeUnit() const;
505     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
506     virtual bool hasImplicitPart() const throw(INTERP_KERNEL::Exception);
507     virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
508     virtual void releaseImplicitPartIfAny() const throw(INTERP_KERNEL::Exception);
509     virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
510     virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
511     virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
512     virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception);
513     std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
514     std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
515     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
516     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
517     //
518     bool existsGroup(const std::string& groupName) const throw(INTERP_KERNEL::Exception);
519     bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
520     bool existsFamily(const std::string& familyName) const throw(INTERP_KERNEL::Exception);
521     void setFamilyId(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
522     void setFamilyIdUnique(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
523     void addFamily(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
524     void addFamilyOnGrp(const std::string& grpName, const std::string& famName) throw(INTERP_KERNEL::Exception);
525     virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName) throw(INTERP_KERNEL::Exception);
526     virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
527     void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
528     void clearGrpMap() throw(INTERP_KERNEL::Exception);
529     void clearFamMap() throw(INTERP_KERNEL::Exception);
530     void clearFamGrpMaps() throw(INTERP_KERNEL::Exception);
531     const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
532     const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
533     std::vector<std::string> getFamiliesOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception);
534     std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
535     std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception);
536     void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
537     void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
538     std::vector<std::string> getGroupsOnFamily(const std::string& name) const throw(INTERP_KERNEL::Exception);
539     void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
540     std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
541     std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
542     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
543     std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
544     void removeGroup(const std::string& name) throw(INTERP_KERNEL::Exception);
545     void removeFamily(const std::string& name) throw(INTERP_KERNEL::Exception);
546     std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
547     std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
548     void removeFamiliesReferedByNoGroups() throw(INTERP_KERNEL::Exception);
549     void rearrangeFamilies() throw(INTERP_KERNEL::Exception);
550     void checkOrphanFamilyZero() const throw(INTERP_KERNEL::Exception);
551     void changeGroupName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
552     void changeFamilyName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
553     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
554     void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
555     void setFamilyInfo(const std::map<std::string,int>& info);
556     void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
557     int getFamilyId(const std::string& name) const throw(INTERP_KERNEL::Exception);
558     int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
559     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
560     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
561     int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
562     int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
563     int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
564     virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
565     virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
566     virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
567     DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
568     DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
569     std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
570     std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
571     bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
572     void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
573     void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
574     virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
575     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
576     virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
577     //
578     virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
579     virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
580     virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
581     virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
582     virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
583     virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
584     virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
585     virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
586     virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
587     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
588     virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
589     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
590     %extend
591        {
592          std::string __str__() const throw(INTERP_KERNEL::Exception)
593          {
594            return self->simpleRepr();
595          }
596
597          PyObject *getTime() throw(INTERP_KERNEL::Exception)
598          {
599            int tmp1,tmp2;
600            double tmp0=self->getTime(tmp1,tmp2);
601            PyObject *res = PyList_New(3);
602            PyList_SetItem(res,0,SWIG_From_int(tmp1));
603            PyList_SetItem(res,1,SWIG_From_int(tmp2));
604            PyList_SetItem(res,2,SWIG_From_double(tmp0));
605            return res;
606          }
607
608          virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
609          {
610            std::string what;
611            bool ret0=self->isEqual(other,eps,what);
612            PyObject *res=PyList_New(2);
613            PyObject *ret0Py=ret0?Py_True:Py_False;
614            Py_XINCREF(ret0Py);
615            PyList_SetItem(res,0,ret0Py);
616            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
617            return res;
618          }
619
620          void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
621          {
622            std::vector<const DataArrayInt *> grps;
623            convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
624            self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
625          }
626          
627          PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
628          {
629            std::string what;
630            bool ret0=self->areFamsEqual(other,what);
631            PyObject *res=PyList_New(2);
632            PyObject *ret0Py=ret0?Py_True:Py_False;
633            Py_XINCREF(ret0Py);
634            PyList_SetItem(res,0,ret0Py);
635            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
636            return res;
637          }
638
639          PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
640          {
641            std::string what;
642            bool ret0=self->areGrpsEqual(other,what);
643            PyObject *res=PyList_New(2);
644            PyObject *ret0Py=ret0?Py_True:Py_False;
645            Py_XINCREF(ret0Py);
646            PyList_SetItem(res,0,ret0Py);
647            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
648            return res;
649          }
650
651          PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
652          {
653            std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
654            std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
655            PyObject *res=PyList_New(result.size());
656            for(int i=0;iL!=result.end(); i++, iL++)
657              PyList_SetItem(res,i,PyInt_FromLong(*iL));
658            return res;
659          }
660
661          PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
662          {
663            std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
664            std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
665            PyObject *res=PyList_New(result.size());
666            for(int i=0;iL!=result.end(); i++, iL++)
667              PyList_SetItem(res,i,PyInt_FromLong(*iL));
668            return res;
669          }
670
671          PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
672          {
673            const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
674            if(tmp)
675              tmp->incrRef();
676            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
677          }
678
679          PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
680          {
681            const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
682            if(tmp)
683              tmp->incrRef();
684            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
685          }
686
687          PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
688          {
689            const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
690            if(tmp)
691              tmp->incrRef();
692            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
693          }
694          
695          PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
696          {
697            const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
698            if(tmp)
699              tmp->incrRef();
700            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
701          }
702
703          PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
704          {
705            bool ret1;
706            std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
707            PyObject *ret=PyTuple_New(2);
708            PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
709            PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
710            return ret;
711          }
712          
713          PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
714          {
715            DataArrayInt *ret3=0;
716            std::vector<int> ret1,ret2;
717            bool ret0=self->unPolyze(ret1,ret2,ret3);
718            PyObject *ret=PyTuple_New(4);
719            PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
720            //
721            PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
722            for(int j=0;j<(int)ret1.size()/3;j++)
723              {
724                PyObject *retLev2=PyList_New(3);
725                PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
726                PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
727                PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
728                PyList_SetItem(retLev1_0,j,retLev2);
729              }
730            PyTuple_SetItem(ret,1,retLev1_0);
731            //
732            PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
733            for(int j=0;j<(int)ret2.size()/3;j++)
734              {
735                PyObject *retLev2=PyList_New(3);
736                PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
737                PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
738                PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
739                PyList_SetItem(retLev1_1,j,retLev2);
740              }
741            PyTuple_SetItem(ret,2,retLev1_1);
742            //
743            PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
744            return ret;
745          }
746        }
747   };
748
749   class MEDFileUMesh : public MEDFileMesh
750   {
751   public:
752     static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
753     static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
754     static MEDFileUMesh *New();
755     ~MEDFileUMesh();
756     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
757     int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
758     //
759     std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const throw(INTERP_KERNEL::Exception);
760     std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const throw(INTERP_KERNEL::Exception);
761     std::vector<int> getFamNonEmptyLevels(const std::string& fam) const throw(INTERP_KERNEL::Exception);
762     std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const throw(INTERP_KERNEL::Exception);
763     std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
764     std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
765     std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
766     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
767     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
768     MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
769     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
770     MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
771     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
772     DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
773     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
774     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
775     MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
776     MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
777     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
778     void forceComputationOfParts() const throw(INTERP_KERNEL::Exception);
779     //
780     int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
781     void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
782     void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
783     void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
784     void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
785     void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
786     void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
787     void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) throw(INTERP_KERNEL::Exception);
788     void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
789     void optimizeFamilies() throw(INTERP_KERNEL::Exception);
790     DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
791     DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
792     DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
793     MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const throw(INTERP_KERNEL::Exception);
794     MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const throw(INTERP_KERNEL::Exception);
795     MEDFileUMesh *quadraticToLinear(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
796     %extend
797        { 
798          MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
799          {
800            return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
801          }
802
803          MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
804          {
805            return MEDFileUMesh::New(fileName,mrs);
806          }
807
808          MEDFileUMesh()
809          {
810            return MEDFileUMesh::New();
811          }
812
813          // serialization
814          static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
815          {
816            return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDFileUMesh");
817          }
818
819          static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
820          {
821            std::vector<int> typesCpp1;
822            convertPyToNewIntArr3(types,typesCpp1);
823            std::size_t sz(typesCpp1.size());
824            std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
825            for(std::size_t ii=0;ii<sz;ii++)
826              typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
827            return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
828          }
829
830          PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
831          {// put an empty dict in input to say to __new__ to call __init__...
832            PyObject *ret(PyTuple_New(1));
833            PyObject *ret0(PyDict_New());
834            PyTuple_SetItem(ret,0,ret0);
835            return ret;
836          }
837
838          PyObject *__getstate__() throw(INTERP_KERNEL::Exception)
839          {
840            std::vector<double> a0;
841            std::vector<int> a1;
842            std::vector<std::string> a2;
843            std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
844            MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
845            self->serialize(a0,a1,a2,a3,a4);
846            PyObject *ret(PyTuple_New(5));
847            PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
848            PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
849            int sz(a2.size());
850            PyObject *ret2(PyList_New(sz));
851            for(int i=0;i<sz;i++)
852              PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
853            PyTuple_SetItem(ret,2,ret2);
854            sz=a3.size();
855            PyObject *ret3(PyList_New(sz));
856            for(int i=0;i<sz;i++)
857              {
858                DataArrayInt *elt(a3[i]);
859                if(elt)
860                  elt->incrRef();
861                PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
862              }
863            PyTuple_SetItem(ret,3,ret3);
864            DataArrayDouble *ret4(a4);
865            if(ret4)
866              ret4->incrRef();
867            PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
868            return ret;
869          }
870
871          void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
872          {
873            static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
874            if(!PyTuple_Check(inp))
875              throw INTERP_KERNEL::Exception(MSG);
876            int sz(PyTuple_Size(inp));
877            if(sz!=5)
878              throw INTERP_KERNEL::Exception(MSG);
879            std::vector<double> a0;
880            std::vector<int> a1;
881            std::vector<std::string> a2;
882            std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
883            MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
884            //
885            PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
886            int tmp(-1);
887            fillArrayWithPyListDbl3(a0py,tmp,a0);
888            convertPyToNewIntArr3(a1py,a1);
889            fillStringVector(a2py,a2);
890            //
891            PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
892            void *argp(0);
893            int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0));
894            if(!SWIG_IsOK(status))
895              throw INTERP_KERNEL::Exception(MSG);
896            a4=reinterpret_cast<DataArrayDouble *>(argp);
897            if((DataArrayDouble *)a4)
898              a4->incrRef();
899            {
900              std::vector< DataArrayInt * > a3Tmp;
901              convertFromPyObjVectorOfObj<ParaMEDMEM::DataArrayInt *>(b0py,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",a3Tmp);
902              std::size_t sz(a3Tmp.size());
903              a3.resize(sz);
904              for(std::size_t i=0;i<sz;i++)
905                {
906                  a3[i]=a3Tmp[i];
907                  if(a3Tmp[i])
908                    a3Tmp[i]->incrRef();
909                }
910              self->unserialize(a0,a1,a2,a3,a4);
911            }
912          }
913
914          MEDCouplingUMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
915          {
916            return self->getMeshAtLevel(meshDimRelToMaxExt,false);
917          }
918
919          void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh) throw(INTERP_KERNEL::Exception)
920          {
921            if(!mesh)
922              throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
923            MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
924            if(m0)
925              {
926                self->setMeshAtLevel(meshDimRelToMax,m0,false);
927                return ;
928              }
929            MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
930            if(m1)
931              {
932                self->setMeshAtLevel(meshDimRelToMax,m1);
933                return ;
934              }
935            throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
936          }
937
938          void __delitem__(int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
939          {
940            self->removeMeshAtLevel(meshDimRelToMax);
941          }
942
943          void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
944          {
945            std::vector<const MEDCouplingUMesh *> ms;
946            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
947            self->setMeshes(ms,renum);
948          }
949
950          void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
951          {
952            std::vector<const MEDCouplingUMesh *> ms;
953            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
954            self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
955          }
956          
957          void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
958          {
959            std::vector<const MEDCouplingUMesh *> ms;
960            convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
961            self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
962          }
963
964          DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
965          {
966            DataArrayDouble *ret=self->getCoords();
967            if(ret)
968              ret->incrRef();
969            return ret;
970          }
971
972          PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const throw(INTERP_KERNEL::Exception)
973          {
974            const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
975            if(ret)
976              ret->incrRef();
977            return const_cast<PartDefinition *>(ret);
978          }
979
980          PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception)
981          {
982            DataArrayInt *ret0=0,*ret1=0,*ret2=0;
983            self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
984            PyObject *ret=PyTuple_New(3);
985            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
986            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
987            PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
988            return ret;
989          }
990          
991          MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception)
992          {
993            MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
994            if(ret)
995              ret->incrRef();
996            return ret;
997          }
998
999          PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
1000          {
1001            std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
1002            std::size_t sz(tmp.size());
1003            PyObject *ret=PyList_New(sz);
1004            for(std::size_t i=0;i<sz;i++)
1005              {
1006                if(tmp[i])
1007                  tmp[i]->incrRef();
1008                PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1009              }
1010            return ret;
1011          }
1012        }
1013   };
1014
1015   class MEDFileStructuredMesh : public MEDFileMesh
1016   {
1017   public:
1018     %extend
1019     {
1020       MEDCoupling1SGTUMesh *getImplicitFaceMesh() const throw(INTERP_KERNEL::Exception)
1021       {
1022         MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1023         if(ret)
1024           ret->incrRef();
1025         return ret;
1026       }
1027     }
1028   };
1029
1030   class MEDFileCMesh : public MEDFileStructuredMesh
1031   {
1032   public:
1033     static MEDFileCMesh *New();
1034     static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1035     static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1036     void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
1037     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
1038     %extend
1039        {
1040          MEDFileCMesh()
1041          {
1042            return MEDFileCMesh::New();
1043          }
1044
1045          MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1046          {
1047            return MEDFileCMesh::New(fileName,mrs);
1048          }
1049
1050          MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1051          {
1052            return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1053          }
1054          
1055          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
1056          {
1057            const MEDCouplingCMesh *tmp=self->getMesh();
1058            if(tmp)
1059              tmp->incrRef();
1060            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1061          }
1062        }
1063   };
1064
1065   class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1066   {
1067   public:
1068     static MEDFileCurveLinearMesh *New();
1069     static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1070     static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1071     void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
1072     %extend
1073        {
1074          MEDFileCurveLinearMesh()
1075          {
1076            return MEDFileCurveLinearMesh::New();
1077          }
1078
1079          MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1080          {
1081            return MEDFileCurveLinearMesh::New(fileName,mrs);
1082          }
1083
1084          MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1085          {
1086            return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1087          }
1088          
1089          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
1090          {
1091            const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1092            if(tmp)
1093              tmp->incrRef();
1094            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1095          }
1096        }
1097   };
1098
1099   class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
1100   {
1101   public:
1102     static MEDFileMeshMultiTS *New();
1103     static MEDFileMeshMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
1104     static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception);
1105     MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1106     std::string getName() const throw(INTERP_KERNEL::Exception);
1107     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1108     void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
1109     %extend
1110        { 
1111          MEDFileMeshMultiTS()
1112          {
1113            return MEDFileMeshMultiTS::New();
1114          }
1115
1116          MEDFileMeshMultiTS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
1117          {
1118            return MEDFileMeshMultiTS::New(fileName);
1119          }
1120
1121          MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception)
1122          {
1123            return MEDFileMeshMultiTS::New(fileName,mName);
1124          }
1125
1126          MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
1127            {
1128              MEDFileMesh *ret=self->getOneTimeStep();
1129              if(ret)
1130                ret->incrRef();
1131              return ret;
1132            }
1133        }
1134   };
1135
1136   class MEDFileMeshesIterator
1137   {
1138   public:
1139     %extend
1140     {
1141       PyObject *next() throw(INTERP_KERNEL::Exception)
1142       {
1143         MEDFileMesh *ret=self->nextt();
1144         if(ret)
1145           {
1146             ret->incrRef();
1147             return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1148           }
1149         else
1150           {
1151             PyErr_SetString(PyExc_StopIteration,"No more data.");
1152             return 0;
1153           }
1154       }
1155     }
1156   };
1157
1158   class MEDFileMeshes : public RefCountObject, public MEDFileWritable
1159   {
1160   public:
1161     static MEDFileMeshes *New();
1162     static MEDFileMeshes *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
1163     MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
1164     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1165     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
1166     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1167     //
1168     void resize(int newSize) throw(INTERP_KERNEL::Exception);
1169     void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
1170     void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
1171     void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
1172     %extend
1173        {
1174          MEDFileMeshes()
1175          {
1176            return MEDFileMeshes::New();
1177          }
1178
1179          MEDFileMeshes(const std::string& fileName) throw(INTERP_KERNEL::Exception)
1180          {
1181            return MEDFileMeshes::New(fileName);
1182          }
1183
1184          std::string __str__() const throw(INTERP_KERNEL::Exception)
1185            {
1186              return self->simpleRepr();
1187            }
1188
1189          MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1190          {
1191            if(PyInt_Check(obj))
1192              {
1193                MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1194                if(ret)
1195                  ret->incrRef();
1196                return ret;
1197              }
1198            else if(PyString_Check(obj))
1199              {
1200                MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
1201                if(ret)
1202                  ret->incrRef();
1203                return ret;
1204              }
1205            else
1206              throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
1207          }
1208
1209          MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
1210          {
1211            self->setMeshAtPos(obj,mesh);
1212            return self;
1213          }
1214
1215          MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
1216          {
1217            return self->iterator();
1218          }
1219
1220          int __len__() const throw(INTERP_KERNEL::Exception)
1221          {
1222            return self->getNumberOfMeshes();
1223          }
1224          
1225          MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
1226            {
1227              MEDFileMesh *ret=self->getMeshAtPos(i);
1228              if(ret)
1229                ret->incrRef();
1230              return ret;
1231            }
1232          MEDFileMesh *getMeshWithName(const std::string& mname) const throw(INTERP_KERNEL::Exception)
1233            {
1234              MEDFileMesh *ret=self->getMeshWithName(mname);
1235              if(ret)
1236                ret->incrRef();
1237              return ret;
1238            }
1239        }
1240   };
1241
1242   class MEDFileFieldLoc : public RefCountObject
1243   {
1244   public:
1245     std::string getName() const;
1246     int getDimension() const;
1247     int getNumberOfGaussPoints() const;
1248     int getNumberOfPointsInCells() const;
1249     const std::vector<double>& getRefCoords() const;
1250     const std::vector<double>& getGaussCoords() const;
1251     const std::vector<double>& getGaussWeights() const;
1252     bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
1253   %extend
1254     {
1255       std::string __str__() const throw(INTERP_KERNEL::Exception)
1256       {
1257         return self->repr();
1258       }
1259     }
1260   };
1261
1262   class MEDFileFieldGlobsReal
1263   {
1264   public:
1265     void resetContent();
1266     void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1267     void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1268     void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1269     void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1270     void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
1271     void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
1272     void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
1273     void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
1274     std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
1275     std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
1276     bool existsPfl(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
1277     bool existsLoc(const std::string& locName) const throw(INTERP_KERNEL::Exception);
1278     std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
1279     std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
1280     std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
1281     std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
1282     virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1283     virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1284     virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1285     virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1286     void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1287     void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1288     void changePflName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
1289     void changeLocName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
1290     int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1291     int getLocalizationId(const std::string& loc) const throw(INTERP_KERNEL::Exception);
1292   %extend
1293      {
1294        PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
1295        {
1296          const DataArrayInt *ret=self->getProfile(pflName);
1297          if(ret)
1298            ret->incrRef();
1299          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1300        }
1301
1302        PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1303        {
1304          const DataArrayInt *ret=self->getProfileFromId(pflId);
1305          if(ret)
1306            ret->incrRef();
1307          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1308        }
1309
1310        PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1311        {
1312          const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1313          if(loc)
1314            loc->incrRef();
1315          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1316        }
1317        
1318        PyObject *getLocalization(const std::string& locName) const throw(INTERP_KERNEL::Exception)
1319        {
1320          const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1321          if(loc)
1322            loc->incrRef();
1323          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1324        }
1325        
1326        PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1327        {
1328          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1329          return convertVecPairVecStToPy(ret);
1330        }
1331
1332        PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1333        {
1334          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1335          return convertVecPairVecStToPy(ret);
1336        }
1337
1338        void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1339        {
1340          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1341          self->changePflsNames(v);
1342        }
1343
1344        void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1345        {
1346          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1347          self->changePflsRefsNamesGen(v);
1348        }
1349
1350        void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1351        {
1352          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1353          self->changePflsNamesInStruct(v);
1354        }
1355
1356        void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1357        {
1358          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1359          self->changeLocsNames(v);
1360        }
1361
1362        void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1363        {
1364          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1365          self->changeLocsRefsNamesGen(v);
1366        }
1367        
1368        void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1369        {
1370          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1371          self->changeLocsNamesInStruct(v);
1372        }
1373
1374        std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1375        {
1376          std::ostringstream oss;
1377          self->simpleReprGlobs(oss);
1378          return oss.str();
1379        }
1380      }
1381   };
1382
1383   class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1384   {
1385   public:
1386     static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1387     static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1388     static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1389     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1390     void loadArrays() throw(INTERP_KERNEL::Exception);
1391     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1392     void unloadArrays() throw(INTERP_KERNEL::Exception);
1393     void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
1394     int getDimension() const throw(INTERP_KERNEL::Exception);
1395     int getIteration() const throw(INTERP_KERNEL::Exception);
1396     int getOrder() const throw(INTERP_KERNEL::Exception);
1397     std::string getName() throw(INTERP_KERNEL::Exception);
1398     void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
1399     std::string getMeshName() throw(INTERP_KERNEL::Exception);
1400     void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
1401     int getMeshIteration() const throw(INTERP_KERNEL::Exception);
1402     int getMeshOrder() const throw(INTERP_KERNEL::Exception);
1403     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1404     bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1405     void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1406     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1407     bool presenceOfMultiDiscPerGeoType() const throw(INTERP_KERNEL::Exception);
1408     void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1409     virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1410     MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1411     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1412     void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception);
1413     %extend
1414     {
1415       PyObject *getTime() throw(INTERP_KERNEL::Exception)
1416       {
1417         int tmp1,tmp2;
1418         double tmp0=self->getTime(tmp1,tmp2);
1419         PyObject *res = PyList_New(3);
1420         PyList_SetItem(res,0,SWIG_From_int(tmp1));
1421         PyList_SetItem(res,1,SWIG_From_int(tmp2));
1422         PyList_SetItem(res,2,SWIG_From_double(tmp0));
1423         return res;
1424       }
1425
1426       PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1427       {
1428         std::pair<int,int> res=self->getDtIt();
1429         PyObject *elt=PyTuple_New(2);
1430         PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1431         PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1432         return elt;
1433       }
1434
1435       void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1436       {
1437         self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1438       }
1439       
1440       void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1441       {
1442         self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1443       }
1444
1445       bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1446       {
1447         std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1448         return self->changeMeshNames(modifTab);
1449       }
1450       
1451       PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1452       {
1453         std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1454         PyObject *ret2=PyList_New(ret.size());
1455         for(int i=0;i<(int)ret.size();i++)
1456           PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1457         return ret2;
1458       }
1459
1460       PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1461       {
1462         std::vector<int> ret1;
1463         int ret0=self->getNonEmptyLevels(mname,ret1);
1464         PyObject *elt=PyTuple_New(2);
1465         PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1466         PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1467         return elt;
1468       }
1469
1470       PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1471       {
1472         std::vector<INTERP_KERNEL::NormalizedCellType> types;
1473         std::vector< std::vector<TypeOfField> > typesF;
1474         std::vector< std::vector<std::string> > pfls;
1475         std::vector< std::vector<std::string> > locs;
1476         std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1477         int sz=ret.size();
1478         PyObject *ret2=PyList_New(sz);
1479            for(int i=0;i<sz;i++)
1480              {
1481                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1482                const std::vector<TypeOfField>& typesFI=typesF[i];
1483                const std::vector<std::string>& pflsI=pfls[i];
1484                const std::vector<std::string>& locsI=locs[i];
1485                PyObject *elt=PyTuple_New(2);
1486                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1487                int sz2=ret[i].size();
1488                PyObject *elt2=PyList_New(sz2);
1489                for(int j=0;j<sz2;j++)
1490                  {
1491                    PyObject *elt3=PyTuple_New(4);
1492                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1493                    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));
1494                    PyTuple_SetItem(elt3,1,elt4);
1495                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1496                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1497                    PyList_SetItem(elt2,j,elt3);
1498                  }
1499                PyTuple_SetItem(elt,1,elt2);
1500                PyList_SetItem(ret2,i,elt);
1501              }
1502            return ret2;
1503       }
1504
1505       PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1506       {
1507         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1508         std::size_t sz=ret.size();
1509         PyObject *retPy=PyList_New(sz);
1510         for(std::size_t i=0;i<sz;i++)
1511           PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1512         return retPy;
1513       }
1514
1515       PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
1516       {
1517         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
1518         std::size_t sz=ret.size();
1519         PyObject *retPy=PyList_New(sz);
1520         for(std::size_t i=0;i<sz;i++)
1521           PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1522         return retPy;
1523       }
1524
1525       PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
1526       {
1527         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
1528         std::size_t sz=ret.size();
1529         PyObject *retPy=PyList_New(sz);
1530         for(std::size_t i=0;i<sz;i++)
1531           PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1532         return retPy;
1533       }
1534     }
1535   };
1536
1537   class MEDFileField1TS : public MEDFileAnyTypeField1TS
1538   {
1539   public:
1540     static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1541     static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1542     static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1543     static MEDFileField1TS *New();
1544     ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1545     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1546     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1547     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1548     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1549     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1550     //
1551     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1552     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1553     void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1554     void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1555     %extend
1556        {
1557          MEDFileField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1558          {
1559            return MEDFileField1TS::New(fileName,loadAll);
1560          }
1561          
1562          MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1563          {
1564            return MEDFileField1TS::New(fileName,fieldName,loadAll);
1565          }
1566
1567          MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1568          {
1569            return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1570          }
1571
1572          MEDFileField1TS()
1573          {
1574            return MEDFileField1TS::New();
1575          }
1576
1577          void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1578          {
1579            const DataArrayDouble *arr=0;
1580            if(field)
1581              arr=field->getArray();
1582            self->copyTinyInfoFrom(field,arr);
1583          }
1584          
1585          std::string __str__() const throw(INTERP_KERNEL::Exception)
1586          {
1587            return self->simpleRepr();
1588          }
1589          
1590          PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1591          {
1592            DataArrayInt *ret1=0;
1593            DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1594            PyObject *ret=PyTuple_New(2);
1595            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1596            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1597            return ret;
1598          }
1599
1600          PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1601          {
1602            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1603            std::vector< std::vector<TypeOfField> > typesF;
1604            std::vector< std::vector<std::string> > pfls;
1605            std::vector< std::vector<std::string> > locs;
1606            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1607            int sz=ret.size();
1608            PyObject *ret2=PyList_New(sz);
1609            for(int i=0;i<sz;i++)
1610              {
1611                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1612                const std::vector<TypeOfField>& typesFI=typesF[i];
1613                const std::vector<std::string>& pflsI=pfls[i];
1614                const std::vector<std::string>& locsI=locs[i];
1615                PyObject *elt=PyTuple_New(2);
1616                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1617                int sz2=ret[i].size();
1618                PyObject *elt2=PyList_New(sz2);
1619                for(int j=0;j<sz2;j++)
1620                  {
1621                    PyObject *elt3=PyTuple_New(4);
1622                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1623                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1624                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1625                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1626                    PyList_SetItem(elt2,j,elt3);
1627                  }
1628                PyTuple_SetItem(elt,1,elt2);
1629                PyList_SetItem(ret2,i,elt);
1630              }
1631            return ret2;
1632          }
1633
1634          DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1635          {
1636            DataArrayDouble *ret=self->getUndergroundDataArray();
1637            if(ret)
1638              ret->incrRef();
1639            return ret;
1640          }
1641
1642          PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1643          {
1644            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1645            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1646            if(elt0)
1647              elt0->incrRef();
1648            PyObject *ret=PyTuple_New(2);
1649            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1650            std::size_t sz=elt1Cpp.size();
1651            PyObject *elt=PyList_New(sz);
1652            for(std::size_t i=0;i<sz;i++)
1653              {
1654                PyObject *elt1=PyTuple_New(2);
1655                PyObject *elt2=PyTuple_New(2);
1656                PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1657                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1658                PyObject *elt3=PyTuple_New(2);
1659                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1660                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1661                PyTuple_SetItem(elt1,0,elt2);
1662                PyTuple_SetItem(elt1,1,elt3);
1663                PyList_SetItem(elt,i,elt1);
1664              }
1665            PyTuple_SetItem(ret,1,elt);
1666            return ret;
1667          }
1668        }
1669   };
1670
1671   class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1672   {
1673   public:
1674     static MEDFileIntField1TS *New();
1675     static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1676     static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1677     static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1678     ParaMEDMEM::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1679     //
1680     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1681     void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1682     %extend
1683     {
1684       MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1685       {
1686         return MEDFileIntField1TS::New();
1687       }
1688
1689       MEDFileIntField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1690       {
1691         return MEDFileIntField1TS::New(fileName,loadAll);
1692       }
1693
1694       MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1695       {
1696         return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1697       }
1698
1699       MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1700       {
1701         return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1702       }
1703
1704       std::string __str__() const throw(INTERP_KERNEL::Exception)
1705       {
1706         return self->simpleRepr();
1707       }
1708
1709       PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1710       {
1711         DataArrayInt *ret1=0;
1712         MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1713         PyObject *ret=PyTuple_New(2);
1714         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1715         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1716         return ret;
1717       }
1718
1719       PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1720       {
1721         DataArrayInt *ret1=0;
1722         MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1723         PyObject *ret=PyTuple_New(2);
1724         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1725         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1726         return ret;
1727       }
1728
1729       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1730       {
1731         DataArrayInt *ret1=0;
1732         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1733         PyObject *ret=PyTuple_New(2);
1734         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1735         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1736         return ret;
1737       }
1738       
1739       PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1740       {
1741         DataArrayInt *ret1=0;
1742         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1743         PyObject *ret=PyTuple_New(2);
1744         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1745         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1746         return ret;
1747       }
1748       
1749       PyObject *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1750       {
1751         DataArrayInt *ret1=0;
1752         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1753         PyObject *ret=PyTuple_New(2);
1754         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1755         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1756         return ret;
1757       }
1758
1759       PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1760       {
1761          DataArrayInt *ret1=0;
1762          DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1763          PyObject *ret=PyTuple_New(2);
1764          PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1765          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1766          return ret;
1767       }
1768       
1769       DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1770       {
1771         DataArrayInt *ret=self->getUndergroundDataArray();
1772         if(ret)
1773           ret->incrRef();
1774         return ret;
1775       }
1776     }
1777   };
1778
1779   class MEDFileAnyTypeFieldMultiTSIterator
1780   {
1781   public:
1782     %extend
1783     {
1784       PyObject *next() throw(INTERP_KERNEL::Exception)
1785       {
1786         MEDFileAnyTypeField1TS *ret=self->nextt();
1787         if(ret)
1788           return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1789         else
1790           {
1791             PyErr_SetString(PyExc_StopIteration,"No more data.");
1792             return 0;
1793           }
1794       }
1795     }
1796   };
1797
1798   class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1799   {
1800   public:
1801     static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1802     static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1803     MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1804     virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1805     std::string getName() const throw(INTERP_KERNEL::Exception);
1806     void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
1807     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1808     void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception);
1809     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1810     void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
1811     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1812     bool presenceOfMultiDiscPerGeoType() const throw(INTERP_KERNEL::Exception);
1813     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1814     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1815     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1816     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1817     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1818     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1819     void loadArrays() throw(INTERP_KERNEL::Exception);
1820     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1821     void unloadArrays() throw(INTERP_KERNEL::Exception);
1822     void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
1823     //
1824     virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1825     MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1826     MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1827     void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1828     void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1829     %extend
1830     {
1831       int __len__() const throw(INTERP_KERNEL::Exception)
1832       {
1833         return self->getNumberOfTS();
1834       }
1835
1836       int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1837       {
1838         if(elt0 && PyInt_Check(elt0))
1839           {//fmts[3]
1840             int pos=PyInt_AS_LONG(elt0);
1841             return pos;
1842           }
1843         else if(elt0 && PyTuple_Check(elt0))
1844           {
1845             if(PyTuple_Size(elt0)==2)
1846               {
1847                 PyObject *o0=PyTuple_GetItem(elt0,0);
1848                 PyObject *o1=PyTuple_GetItem(elt0,1);
1849                 if(PyInt_Check(o0) && PyInt_Check(o1))
1850                   {//fmts(1,-1)
1851                     int iter=PyInt_AS_LONG(o0);
1852                     int order=PyInt_AS_LONG(o1);
1853                     return self->getPosOfTimeStep(iter,order);
1854                   }
1855                 else
1856                   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 !");
1857               }
1858             else
1859               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 !");
1860           }
1861         else if(elt0 && PyFloat_Check(elt0))
1862           {
1863             double val=PyFloat_AS_DOUBLE(elt0);
1864             return self->getPosGivenTime(val);
1865           }
1866         else
1867           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1868       }
1869       
1870       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1871       {
1872         std::vector< std::pair<int,int> > res=self->getIterations();
1873         PyObject *ret=PyList_New(res.size());
1874         int rk=0;
1875         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1876           {
1877             PyObject *elt=PyTuple_New(2);
1878             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1879             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1880             PyList_SetItem(ret,rk,elt);
1881           }
1882         return ret;
1883       }
1884       
1885       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1886       {
1887         std::vector<double> ret1;
1888         std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1889         std::size_t sz=ret.size();
1890         PyObject *ret2=PyList_New(sz);
1891         for(std::size_t i=0;i<sz;i++)
1892           {
1893             PyObject *elt=PyTuple_New(3);
1894             PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1895             PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1896             PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1897             PyList_SetItem(ret2,i,elt);
1898           }
1899         return ret2;
1900       }
1901       
1902       PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1903       {
1904         std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1905         PyObject *ret2=PyList_New(ret.size());
1906         for(int i=0;i<(int)ret.size();i++)
1907           {
1908             const std::vector<TypeOfField>& rett=ret[i];
1909             PyObject *ret3=PyList_New(rett.size());
1910             for(int j=0;j<(int)rett.size();j++)
1911               PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1912             PyList_SetItem(ret2,i,ret3);
1913           }
1914         return ret2;
1915       }
1916       
1917       PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1918       {
1919         std::vector<int> ret1;
1920         int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1921         PyObject *elt=PyTuple_New(2);
1922         PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1923         PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1924         return elt;
1925       }
1926       
1927       PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1928       {
1929         std::vector<INTERP_KERNEL::NormalizedCellType> types;
1930         std::vector< std::vector<TypeOfField> > typesF;
1931         std::vector< std::vector<std::string> > pfls;
1932         std::vector< std::vector<std::string> > locs;
1933         std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1934         int sz=ret.size();
1935         PyObject *ret2=PyList_New(sz);
1936         for(int i=0;i<sz;i++)
1937           {
1938             const std::vector< std::pair<int,int> >& dadsI=ret[i];
1939             const std::vector<TypeOfField>& typesFI=typesF[i];
1940             const std::vector<std::string>& pflsI=pfls[i];
1941             const std::vector<std::string>& locsI=locs[i];
1942             PyObject *elt=PyTuple_New(2);
1943             PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1944             int sz2=ret[i].size();
1945             PyObject *elt2=PyList_New(sz2);
1946             for(int j=0;j<sz2;j++)
1947               {
1948                 PyObject *elt3=PyTuple_New(4);
1949                 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1950                 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));
1951                 PyTuple_SetItem(elt3,1,elt4);
1952                 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1953                 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1954                 PyList_SetItem(elt2,j,elt3);
1955               }
1956             PyTuple_SetItem(elt,1,elt2);
1957             PyList_SetItem(ret2,i,elt);
1958           }
1959         return ret2;
1960       }
1961
1962       std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1963       {
1964         if(PyList_Check(elts))
1965           {
1966             int sz=PyList_Size(elts);
1967             std::vector<int> ret(sz);
1968             for(int i=0;i<sz;i++)
1969               {
1970                 PyObject *elt=PyList_GetItem(elts,i);
1971                 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1972               }
1973             return ret;
1974           }
1975         else
1976           {
1977             std::vector<int> ret(1);
1978             ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1979             return ret;
1980           }
1981       }
1982       
1983       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1984       {
1985         if(PySlice_Check(elts))
1986           {
1987             Py_ssize_t strt=2,stp=2,step=2;
1988             PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1989             GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1990             self->eraseTimeStepIds2(strt,stp,step);
1991           }
1992         else
1993           {
1994             std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1995             if(!idsToRemove.empty())
1996               self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1997           }
1998       }
1999       
2000       void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
2001       {
2002         int sw;
2003         int pos1;
2004         std::vector<int> pos2;
2005         DataArrayInt *pos3=0;
2006         DataArrayIntTuple *pos4=0;
2007         convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2008         switch(sw)
2009           {
2010           case 1:
2011             {
2012               self->eraseTimeStepIds(&pos1,&pos1+1);
2013               return;
2014             }
2015           case 2:
2016             {
2017               if(pos2.empty())
2018                 return;
2019               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2020               return ;
2021             }
2022           case 3:
2023             {
2024               self->eraseTimeStepIds(pos3->begin(),pos3->end());
2025               return ;
2026             }
2027           default:
2028             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2029           }
2030       }
2031
2032       MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
2033       {
2034         return self->iterator();
2035       }
2036
2037       PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2038       {
2039         if(elt0 && PyList_Check(elt0))
2040           {
2041             int sz=PyList_Size(elt0);
2042             MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2043             int *pt=da->getPointer();
2044             for(int i=0;i<sz;i++,pt++)
2045               {
2046                 PyObject *elt1=PyList_GetItem(elt0,i);
2047                 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2048               }
2049             return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2050           }
2051         else if(elt0 && PySlice_Check(elt0))
2052           {
2053             Py_ssize_t strt=2,stp=2,step=2;
2054             PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
2055             GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2056             return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
2057           }
2058         else
2059           return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2060       }
2061
2062       bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2063       {
2064         std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2065         return self->changeMeshNames(modifTab);
2066       }
2067
2068       PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
2069       {
2070         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2071         std::size_t sz=ret.size();
2072         PyObject *retPy=PyList_New(sz);
2073         for(std::size_t i=0;i<sz;i++)
2074           PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2075         return retPy;
2076       }
2077
2078       PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
2079       {
2080         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2081         std::size_t sz=ret.size();
2082         PyObject *retPy=PyList_New(sz);
2083         for(std::size_t i=0;i<sz;i++)
2084           PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2085         return retPy;
2086       }
2087
2088       PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
2089       {
2090         std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2091         std::size_t sz=ret.size();
2092         PyObject *retPy=PyList_New(sz);
2093         for(std::size_t i=0;i<sz;i++)
2094           PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2095         return retPy;
2096       }
2097
2098       void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
2099       {
2100         void *argp(0);
2101         int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,0|0));
2102         if(SWIG_IsOK(status))
2103           {
2104             self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
2105           }
2106         else
2107           {
2108             std::vector<MEDFileAnyTypeField1TS *> tmp;
2109             convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2110             self->pushBackTimeSteps(tmp);
2111           }
2112       }
2113
2114       static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception)
2115       {
2116         std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2117         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2118         std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2119         std::size_t sz=ret.size();
2120         PyObject *retPy=PyList_New(sz);
2121         for(std::size_t i=0;i<sz;i++)
2122           {
2123             std::size_t sz2=ret[i].size();
2124             PyObject *ret1Py=PyList_New(sz2);
2125             for(std::size_t j=0;j<sz2;j++)
2126               {
2127                 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2128                 if(elt)
2129                   elt->incrRef();
2130                 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2131               }
2132             PyList_SetItem(retPy,i,ret1Py);
2133           }
2134         return retPy;
2135       }
2136       
2137       static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
2138       {
2139         std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2140         convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2141         std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> > ret2;
2142         std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2143         if(ret2.size()!=ret.size())
2144           {
2145             std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2146             throw INTERP_KERNEL::Exception(oss.str().c_str());
2147           }
2148         std::size_t sz=ret.size();
2149         PyObject *retPy=PyList_New(sz);
2150         for(std::size_t i=0;i<sz;i++)
2151           {
2152             std::size_t sz2=ret[i].size();
2153             PyObject *ret0Py=PyTuple_New(2);
2154             PyObject *ret1Py=PyList_New(sz2);
2155             for(std::size_t j=0;j<sz2;j++)
2156               {
2157                 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2158                 if(elt)
2159                   elt->incrRef();
2160                 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2161               }
2162             PyTuple_SetItem(ret0Py,0,ret1Py);
2163             PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_ParaMEDMEM__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2164             PyList_SetItem(retPy,i,ret0Py);
2165           }
2166         return retPy;
2167       }
2168     }
2169   };
2170
2171   class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2172   {
2173   public:
2174     static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
2175     static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2176     static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2177     //
2178     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2179     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2180     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2181     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2182     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2183     //
2184     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
2185     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
2186     ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
2187     %extend
2188        {
2189          MEDFileFieldMultiTS()
2190          {
2191            return MEDFileFieldMultiTS::New();
2192          }
2193
2194          MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2195          {
2196            return MEDFileFieldMultiTS::New(fileName,loadAll);
2197          }
2198
2199          MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2200          {
2201            return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2202          }
2203
2204          static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2205          {
2206            std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2207            std::size_t sz(tmp.size());
2208            std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2209            for(std::size_t i=0;i<sz;i++)
2210              {
2211                entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2212                entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2213              }
2214            return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2215          }
2216          
2217          std::string __str__() const throw(INTERP_KERNEL::Exception)
2218          {
2219            return self->simpleRepr();
2220          }
2221
2222          PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2223          {
2224            DataArrayInt *ret1=0;
2225            DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2226            PyObject *ret=PyTuple_New(2);
2227            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2228            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2229            return ret;
2230          }
2231
2232          PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
2233          {
2234            std::vector<INTERP_KERNEL::NormalizedCellType> types;
2235            std::vector< std::vector<TypeOfField> > typesF;
2236            std::vector< std::vector<std::string> > pfls;
2237            std::vector< std::vector<std::string> > locs;
2238            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2239            int sz=ret.size();
2240            PyObject *ret2=PyList_New(sz);
2241            for(int i=0;i<sz;i++)
2242              {
2243                const std::vector<DataArrayDouble *>& dadsI=ret[i];
2244                const std::vector<TypeOfField>& typesFI=typesF[i];
2245                const std::vector<std::string>& pflsI=pfls[i];
2246                const std::vector<std::string>& locsI=locs[i];
2247                PyObject *elt=PyTuple_New(2);
2248                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2249                int sz2=ret[i].size();
2250                PyObject *elt2=PyList_New(sz2);
2251                for(int j=0;j<sz2;j++)
2252                  {
2253                    PyObject *elt3=PyTuple_New(4);
2254                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2255                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2256                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2257                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2258                    PyList_SetItem(elt2,j,elt3);
2259                  }
2260                PyTuple_SetItem(elt,1,elt2);
2261                PyList_SetItem(ret2,i,elt);
2262              }
2263            return ret2;
2264          }
2265          DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2266          {
2267            DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
2268            if(ret)
2269              ret->incrRef();
2270            return ret;
2271          }
2272          
2273          PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2274          {
2275            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
2276            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
2277            if(elt0)
2278              elt0->incrRef();
2279            PyObject *ret=PyTuple_New(2);
2280            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2281            std::size_t sz=elt1Cpp.size();
2282            PyObject *elt=PyList_New(sz);
2283            for(std::size_t i=0;i<sz;i++)
2284              {
2285                PyObject *elt1=PyTuple_New(2);
2286                PyObject *elt2=PyTuple_New(2);
2287                PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
2288                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
2289                PyObject *elt3=PyTuple_New(2);
2290                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
2291                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
2292                PyTuple_SetItem(elt1,0,elt2);
2293                PyTuple_SetItem(elt1,1,elt3);
2294                PyList_SetItem(elt,i,elt1);
2295              }
2296            PyTuple_SetItem(ret,1,elt);
2297            return ret;
2298          }
2299        }
2300   };
2301
2302   class MEDFileFieldsIterator
2303   {
2304   public:
2305     %extend
2306     {
2307       PyObject *next() throw(INTERP_KERNEL::Exception)
2308       {
2309         MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
2310         if(ret)
2311           return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
2312         else
2313           {
2314             PyErr_SetString(PyExc_StopIteration,"No more data.");
2315             return 0;
2316           }
2317       }
2318     }
2319   };
2320
2321   class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2322   {
2323   public:
2324     static MEDFileIntFieldMultiTS *New();
2325     static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2326     static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2327     //
2328     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
2329     void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
2330     ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
2331     %extend
2332     {
2333       MEDFileIntFieldMultiTS()
2334       {
2335         return MEDFileIntFieldMultiTS::New();
2336       }
2337       
2338       MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2339       {
2340         return MEDFileIntFieldMultiTS::New(fileName,loadAll);
2341       }
2342       
2343       MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2344       {
2345         return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
2346       }
2347
2348       static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
2349       {
2350         std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2351         std::size_t sz(tmp.size());
2352         std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2353         for(std::size_t i=0;i<sz;i++)
2354           {
2355             entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2356             entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2357           }
2358         return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
2359       }
2360
2361       std::string __str__() const throw(INTERP_KERNEL::Exception)
2362       {
2363         return self->simpleRepr();
2364       }
2365
2366       PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2367       {
2368         DataArrayInt *ret1=0;
2369         MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
2370         PyObject *ret=PyTuple_New(2);
2371         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2372         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2373         return ret;
2374       }
2375
2376       PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2377       {
2378         DataArrayInt *ret1=0;
2379         MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
2380         PyObject *ret=PyTuple_New(2);
2381         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2382         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383         return ret;
2384       }
2385
2386       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2387       {
2388         DataArrayInt *ret1=0;
2389         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
2390         PyObject *ret=PyTuple_New(2);
2391         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2392         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393         return ret;
2394       }
2395       
2396       PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2397       {
2398         DataArrayInt *ret1=0;
2399         MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
2400         PyObject *ret=PyTuple_New(2);
2401         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2402         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2403         return ret;
2404       }
2405       
2406       PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2407       {
2408         DataArrayInt *ret1=0;
2409         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
2410         PyObject *ret=PyTuple_New(2);
2411         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2412         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2413         return ret;
2414       }
2415
2416       PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2417       {
2418          DataArrayInt *ret1=0;
2419          DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2420          PyObject *ret=PyTuple_New(2);
2421          PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2422          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2423          return ret;
2424       }
2425
2426       DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2427       {
2428         DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2429         if(ret)
2430           ret->incrRef();
2431         return ret;
2432       }
2433     }
2434   };
2435
2436   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2437   {
2438   public:
2439     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2440     static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2441     static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0) throw(INTERP_KERNEL::Exception);
2442     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2443     MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2444     void loadArrays() throw(INTERP_KERNEL::Exception);
2445     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
2446     void unloadArrays() throw(INTERP_KERNEL::Exception);
2447     void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
2448     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2449     int getNumberOfFields() const;
2450     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2451     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2452     //
2453     void resize(int newSize) throw(INTERP_KERNEL::Exception);
2454     void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2455     void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2456     int getPosFromFieldName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
2457     MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2458     MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
2459     MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception);
2460     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2461     bool removeFieldsWithoutAnyTimeStep() throw(INTERP_KERNEL::Exception);
2462     %extend
2463        {
2464          MEDFileFields()
2465          {
2466            return MEDFileFields::New();
2467          }
2468
2469          MEDFileFields(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2470          {
2471            return MEDFileFields::New(fileName,loadAll);
2472          }
2473          
2474          std::string __str__() const throw(INTERP_KERNEL::Exception)
2475          {
2476            return self->simpleRepr();
2477          }
2478
2479          static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2480          {
2481            std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
2482            std::size_t sz(tmp.size());
2483            std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
2484            for(std::size_t i=0;i<sz;i++)
2485              {
2486                entitiesCpp[i].first=(TypeOfField)tmp[i].first;
2487                entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
2488              }
2489            return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll);
2490          }
2491
2492          PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2493          {
2494            bool ret1;
2495            std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2496            PyObject *ret=PyTuple_New(2);
2497            PyObject *ret_0=PyList_New(ret0.size());
2498            int rk=0;
2499            for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2500              {
2501                PyObject *elt=PyTuple_New(2);
2502                PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2503                PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2504                PyList_SetItem(ret_0,rk,elt);
2505              }
2506            PyTuple_SetItem(ret,0,ret_0);
2507            PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2508            PyTuple_SetItem(ret,1,ret_1);
2509            return ret;
2510          }
2511
2512          MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2513          {
2514            std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2515            return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2516          }
2517
2518          MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2519          {
2520            std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2521            return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2522          }
2523          
2524          PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2525          {
2526            if(obj && PyList_Check(obj))
2527              {
2528                int sz=PyList_Size(obj);
2529                MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2530                int *pt=da->getPointer();
2531                for(int i=0;i<sz;i++,pt++)
2532                  {
2533                    PyObject *elt1=PyList_GetItem(obj,i);
2534                    *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2535                  }
2536                return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2537              }
2538            else
2539              return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2540          }
2541
2542          MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2543          {
2544            self->setFieldAtPos(obj,field);
2545            return self;
2546          }
2547
2548          int __len__() const throw(INTERP_KERNEL::Exception)
2549          {
2550            return self->getNumberOfFields();
2551          }
2552
2553          MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2554          {
2555            return self->iterator();
2556          }
2557          
2558          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2559          {
2560            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2561            return self->changeMeshNames(modifTab);
2562          }
2563
2564          int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2565          {
2566            if(elt0 && PyInt_Check(elt0))
2567              {//fmts[3]
2568                return PyInt_AS_LONG(elt0);
2569              }
2570            else if(elt0 && PyString_Check(elt0))
2571              return self->getPosFromFieldName(PyString_AsString(elt0));
2572            else
2573              throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2574          }
2575          
2576          std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2577          {
2578            if(PyList_Check(elts))
2579              {
2580                int sz=PyList_Size(elts);
2581                std::vector<int> ret(sz);
2582                for(int i=0;i<sz;i++)
2583                  {
2584                    PyObject *elt=PyList_GetItem(elts,i);
2585                    ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2586                  }
2587                return ret;
2588              }
2589            else
2590              {
2591                std::vector<int> ret(1);
2592                ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2593                return ret;
2594              }
2595          }
2596
2597          void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2598          {
2599            std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2600            convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2601            self->pushFields(tmp);
2602          }
2603          
2604          void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2605          {
2606            if(elts && PySlice_Check(elts))
2607              {
2608                Py_ssize_t strt=2,stp=2,step=2;
2609                PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2610                GetIndicesOfSlice(oC,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
2611                self->destroyFieldsAtPos2(strt,stp,step);
2612              }
2613            else
2614              {
2615                std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2616                if(!idsToRemove.empty())
2617                  self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2618              }
2619          }
2620        }
2621   };
2622
2623   class MEDFileParameter1TS : public RefCountObject
2624   {
2625   public:
2626     void setIteration(int it);
2627     int getIteration() const;
2628     void setOrder(int order);
2629     int getOrder() const;
2630     void setTimeValue(double time);
2631     void setTime(int dt, int it, double time);
2632     double getTime(int& dt, int& it);
2633     double getTimeValue() const;
2634   };
2635
2636   class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2637   {
2638   public:
2639     void setValue(double val) throw(INTERP_KERNEL::Exception);
2640     double getValue() const throw(INTERP_KERNEL::Exception);
2641     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2642     %extend
2643     {
2644       std::string __str__() const throw(INTERP_KERNEL::Exception)
2645       {
2646         return self->simpleRepr();
2647       }
2648     }
2649   };
2650
2651   class MEDFileParameterTinyInfo : public MEDFileWritable
2652   {
2653   public:
2654     void setDescription(const std::string& name);
2655     std::string getDescription() const;
2656     void setTimeUnit(const std::string& unit);
2657     std::string getTimeUnit() const;
2658   };
2659
2660   class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2661   {
2662   public:
2663     static MEDFileParameterDouble1TS *New();
2664     static MEDFileParameterDouble1TS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2665     static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
2666     static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2667     virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2668     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2669     void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
2670     std::string getName() const throw(INTERP_KERNEL::Exception);
2671     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2672     %extend
2673     {
2674       MEDFileParameterDouble1TS()
2675       {
2676         return MEDFileParameterDouble1TS::New();
2677       }
2678       
2679       MEDFileParameterDouble1TS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
2680       {
2681         return MEDFileParameterDouble1TS::New(fileName);
2682       }
2683
2684       MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception)
2685       {
2686         return MEDFileParameterDouble1TS::New(fileName,paramName);
2687       }
2688
2689       MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2690       {
2691         return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2692       }
2693
2694       std::string __str__() const throw(INTERP_KERNEL::Exception)
2695       {
2696         return self->simpleRepr();
2697       }
2698
2699       PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2700       {
2701         std::string what;
2702         bool ret0=self->isEqual(other,eps,what);
2703         PyObject *res=PyList_New(2);
2704         PyObject *ret0Py=ret0?Py_True:Py_False;
2705         Py_XINCREF(ret0Py);
2706         PyList_SetItem(res,0,ret0Py);
2707         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2708         return res;
2709       }
2710     }
2711   };
2712
2713   class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2714   {
2715   public:
2716     static MEDFileParameterMultiTS *New();
2717     static MEDFileParameterMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2718     static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
2719     std::string getName() const;
2720     void setName(const std::string& name);
2721     MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2722     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2723     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2724     void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2725     double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2726     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2727     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2728     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
2729     %extend
2730     {
2731       MEDFileParameterMultiTS()
2732       {
2733         return MEDFileParameterMultiTS::New();
2734       }
2735       
2736       MEDFileParameterMultiTS(const std::string& fileName)
2737       {
2738         return MEDFileParameterMultiTS::New(fileName);
2739       }
2740
2741       MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
2742       {
2743         return MEDFileParameterMultiTS::New(fileName,paramName);
2744       }
2745
2746       std::string __str__() const throw(INTERP_KERNEL::Exception)
2747       {
2748         return self->simpleRepr();
2749       }
2750       
2751       PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2752       {
2753         std::string what;
2754         bool ret0=self->isEqual(other,eps,what);
2755         PyObject *res=PyList_New(2);
2756         PyObject *ret0Py=ret0?Py_True:Py_False;
2757         Py_XINCREF(ret0Py);
2758         PyList_SetItem(res,0,ret0Py);
2759         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2760         return res;
2761       }
2762       
2763       void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2764       {
2765         int sw;
2766         int pos1;
2767         std::vector<int> pos2;
2768         DataArrayInt *pos3=0;
2769         DataArrayIntTuple *pos4=0;
2770         convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2771         switch(sw)
2772           {
2773           case 1:
2774             {
2775               self->eraseTimeStepIds(&pos1,&pos1+1);
2776               return;
2777             }
2778           case 2:
2779             {
2780               if(pos2.empty())
2781                 return;
2782               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2783               return ;
2784             }
2785           case 3:
2786             {
2787               self->eraseTimeStepIds(pos3->begin(),pos3->end());
2788               return ;
2789             }
2790           default:
2791             throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2792           }
2793       }
2794
2795       int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2796       {
2797         if(elt0 && PyInt_Check(elt0))
2798           {//fmts[3]
2799             int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
2800             return pos;
2801           }
2802         else if(elt0 && PyTuple_Check(elt0))
2803           {
2804             if(PyTuple_Size(elt0)==2)
2805               {
2806                 PyObject *o0=PyTuple_GetItem(elt0,0);
2807                 PyObject *o1=PyTuple_GetItem(elt0,1);
2808                 if(PyInt_Check(o0) && PyInt_Check(o1))
2809                   {//fmts(1,-1)
2810                     int iter=PyInt_AS_LONG(o0);
2811                     int order=PyInt_AS_LONG(o1);
2812                     return self->getPosOfTimeStep(iter,order);
2813                   }
2814                 else
2815                   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 !");
2816               }
2817             else
2818               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 !");
2819           }
2820         else if(elt0 && PyFloat_Check(elt0))
2821           {
2822             double val=PyFloat_AS_DOUBLE(elt0);
2823             return self->getPosGivenTime(val);
2824           }
2825         else
2826           throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2827       }
2828
2829       MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2830       {
2831         MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2832         if(ret)
2833           ret->incrRef();
2834         return ret;
2835       }
2836
2837       std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2838       {
2839         if(PyList_Check(elts))
2840           {
2841             int sz=PyList_Size(elts);
2842             std::vector<int> ret(sz);
2843             for(int i=0;i<sz;i++)
2844               {
2845                 PyObject *elt=PyList_GetItem(elts,i);
2846                 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2847               }
2848             return ret;
2849           }
2850         else
2851           {
2852             std::vector<int> ret(1);
2853             ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2854             return ret;
2855           }
2856       }
2857
2858       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2859       {
2860         std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2861         if(!idsToRemove.empty())
2862           self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2863       }
2864       
2865       MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2866       {
2867         MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2868         if(ret)
2869           ret->incrRef();
2870         return ret;
2871       }
2872
2873       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2874       {
2875         std::vector< std::pair<int,int> > res=self->getIterations();
2876         PyObject *ret=PyList_New(res.size());
2877         int rk=0;
2878         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2879           {
2880             PyObject *elt=PyTuple_New(2);
2881             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2882             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2883             PyList_SetItem(ret,rk,elt);
2884           }
2885         return ret;
2886       }
2887
2888       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2889       {
2890         std::vector<double> res2;
2891         std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2892         PyObject *ret=PyList_New(res.size());
2893         int rk=0;
2894         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2895           {
2896             PyObject *elt=PyTuple_New(3);
2897             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2898             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2899             PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2900             PyList_SetItem(ret,rk,elt);
2901           }
2902         return ret;
2903       }
2904     }
2905   };
2906
2907   class MEDFileParameters : public RefCountObject, public MEDFileWritable
2908   {
2909   public:
2910     static MEDFileParameters *New();
2911     static MEDFileParameters *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2912     MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2913     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2914     std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2915     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2916     void resize(int newSize) throw(INTERP_KERNEL::Exception);
2917     void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2918     void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2919     void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2920     int getPosFromParamName(const std::string& paramName) const throw(INTERP_KERNEL::Exception);
2921     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2922     %extend
2923     {
2924       MEDFileParameters()
2925       {
2926         return MEDFileParameters::New();
2927       }
2928       
2929       MEDFileParameters(const std::string& fileName)
2930       {
2931         return MEDFileParameters::New(fileName);
2932       }
2933
2934       std::string __str__() const throw(INTERP_KERNEL::Exception)
2935       {
2936         return self->simpleRepr();
2937       }
2938
2939       MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2940       {
2941         if(PyInt_Check(obj))
2942           {
2943             MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
2944             if(ret)
2945               ret->incrRef();
2946             return ret;
2947           }
2948         else if(PyString_Check(obj))
2949           {
2950             MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2951             if(ret)
2952               ret->incrRef();
2953             return ret;
2954           }
2955         else
2956           throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2957       }
2958
2959       int __len__() const throw(INTERP_KERNEL::Exception)
2960       {
2961         return self->getNumberOfParams();
2962       }
2963       
2964       MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2965       {
2966         MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2967         if(ret)
2968           ret->incrRef();
2969         return ret;
2970       }
2971
2972       MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const throw(INTERP_KERNEL::Exception)
2973       {
2974         MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2975         if(ret)
2976           ret->incrRef();
2977         return ret;
2978       }
2979       
2980       PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2981       {
2982         std::string what;
2983         bool ret0=self->isEqual(other,eps,what);
2984         PyObject *res=PyList_New(2);
2985         PyObject *ret0Py=ret0?Py_True:Py_False;
2986         Py_XINCREF(ret0Py);
2987         PyList_SetItem(res,0,ret0Py);
2988         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2989         return res;
2990       }
2991     }
2992   };
2993
2994   class MEDFileData : public RefCountObject, public MEDFileWritable
2995   {
2996   public:
2997     static MEDFileData *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2998     static MEDFileData *New();
2999     MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
3000     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
3001     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
3002     void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
3003     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
3004     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
3005     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
3006     //
3007     bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
3008     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
3009     //
3010     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
3011     %extend
3012        {
3013          MEDFileData(const std::string& fileName) throw(INTERP_KERNEL::Exception)
3014          {
3015            return MEDFileData::New(fileName);
3016          }
3017
3018          MEDFileData()
3019          {
3020            return MEDFileData::New();
3021          }
3022
3023          std::string __str__() const throw(INTERP_KERNEL::Exception)
3024          {
3025            return self->simpleRepr();
3026          }
3027
3028          MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
3029          {
3030            MEDFileMeshes *ret=self->getMeshes();
3031            if(ret)
3032              ret->incrRef();
3033            return ret;
3034          }
3035
3036          MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
3037          {
3038            MEDFileParameters *ret=self->getParams();
3039            if(ret)
3040              ret->incrRef();
3041            return ret;
3042          }
3043
3044          MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
3045          {
3046            MEDFileFields *ret=self->getFields();
3047            if(ret)
3048              ret->incrRef();
3049            return ret;
3050          }
3051
3052          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
3053          {
3054            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
3055            return self->changeMeshNames(modifTab);
3056          }
3057        }
3058   };
3059
3060   class SauvReader : public RefCountObject
3061   {
3062   public:
3063     static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
3064     MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
3065     %extend
3066     {
3067       SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception)
3068       {
3069         return SauvReader::New(fileName);
3070       }
3071     }
3072   };
3073
3074   class SauvWriter : public RefCountObject
3075   {
3076   public:
3077     static SauvWriter * New();
3078     void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
3079     void write(const std::string& fileName) throw(INTERP_KERNEL::Exception);
3080     void setCpyGrpIfOnASingleFamilyStatus(bool status) throw(INTERP_KERNEL::Exception);
3081     bool getCpyGrpIfOnASingleFamilyStatus() const throw(INTERP_KERNEL::Exception);
3082     %extend
3083     {
3084       SauvWriter() throw(INTERP_KERNEL::Exception)
3085       {
3086         return SauvWriter::New();
3087       }
3088     }
3089   };
3090   
3091   ///////////////
3092
3093   class MEDFileMeshStruct;
3094
3095   class MEDFileField1TSStructItem
3096   {
3097   public:
3098     static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
3099   };
3100
3101   class MEDFileMeshStruct : public RefCountObject
3102   {
3103   public:
3104     static MEDFileMeshStruct *New(const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
3105   protected:
3106     ~MEDFileMeshStruct();
3107   };
3108   
3109   class MEDMeshMultiLev : public RefCountObject
3110   {
3111   public:
3112     virtual MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception);
3113     DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception);
3114   protected:
3115     ~MEDMeshMultiLev();
3116   public:
3117     %extend
3118     {
3119       PyObject *retrieveFamilyIdsOnCells() const throw(INTERP_KERNEL::Exception)
3120       {
3121         DataArrayInt *famIds(0);
3122         bool isWithoutCopy(false);
3123         self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3124         PyObject *ret=PyTuple_New(2);
3125         PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3126         Py_XINCREF(ret1Py);
3127         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3128         PyTuple_SetItem(ret,1,ret1Py);
3129         return ret;
3130       }
3131
3132       PyObject *retrieveNumberIdsOnCells() const throw(INTERP_KERNEL::Exception)
3133       {
3134         DataArrayInt *numIds(0);
3135         bool isWithoutCopy(false);
3136         self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
3137         PyObject *ret=PyTuple_New(2);
3138         PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3139         Py_XINCREF(ret1Py);
3140         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3141         PyTuple_SetItem(ret,1,ret1Py);
3142         return ret;
3143       }
3144       
3145       PyObject *retrieveFamilyIdsOnNodes() const throw(INTERP_KERNEL::Exception)
3146       {
3147         DataArrayInt *famIds(0);
3148         bool isWithoutCopy(false);
3149         self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
3150         PyObject *ret=PyTuple_New(2);
3151         PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3152         Py_XINCREF(ret1Py);
3153         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3154         PyTuple_SetItem(ret,1,ret1Py);
3155         return ret;
3156       }
3157
3158       PyObject *retrieveNumberIdsOnNodes() const throw(INTERP_KERNEL::Exception)
3159       {
3160         DataArrayInt *numIds(0);
3161         bool isWithoutCopy(false);
3162         self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
3163         PyObject *ret=PyTuple_New(2);
3164         PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3165         Py_XINCREF(ret1Py);
3166         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3167         PyTuple_SetItem(ret,1,ret1Py);
3168         return ret;
3169       }
3170
3171       PyObject *getGeoTypes() const throw(INTERP_KERNEL::Exception)
3172       {
3173         std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
3174         std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
3175         PyObject *res(PyList_New(result.size()));
3176         for(int i=0;iL!=result.end(); i++, iL++)
3177           PyList_SetItem(res,i,PyInt_FromLong(*iL));
3178         return res;
3179       }
3180     }
3181   };
3182
3183   class MEDUMeshMultiLev : public MEDMeshMultiLev
3184   {
3185   protected:
3186     ~MEDUMeshMultiLev();
3187   public:
3188     %extend
3189      {
3190        PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
3191        {
3192          DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
3193          bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
3194          PyObject *ret0Py=ncc?Py_True:Py_False;
3195          Py_XINCREF(ret0Py);
3196          PyObject *ret=PyTuple_New(7);
3197          PyTuple_SetItem(ret,0,ret0Py);
3198          PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3199          PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_ParaMEDMEM__DataArrayByte, SWIG_POINTER_OWN | 0 ));
3200          PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3201          PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3202          PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3203          PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3204          return ret;
3205        }
3206      }
3207   };
3208
3209   class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
3210   {
3211   protected:
3212     ~MEDStructuredMeshMultiLev();
3213   };
3214
3215   class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
3216   {
3217   protected:
3218     ~MEDCMeshMultiLev();
3219   public:
3220     %extend
3221     {
3222       PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
3223       {
3224         bool isInternal;
3225         std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
3226         std::size_t sz(objs.size());
3227         PyObject *ret(PyTuple_New(2));
3228         PyObject *ret0=PyList_New(sz);
3229         for(std::size_t i=0;i<sz;i++)
3230           PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3231         PyTuple_SetItem(ret,0,ret0);
3232         PyObject *ret1Py(isInternal?Py_True:Py_False);
3233         Py_XINCREF(ret1Py);
3234         PyTuple_SetItem(ret,1,ret1Py);
3235         return ret;
3236       }
3237     }
3238   };
3239
3240   class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
3241   {
3242   protected:
3243     ~MEDCurveLinearMeshMultiLev();
3244   public:
3245     %extend
3246     {
3247       PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
3248       {
3249         DataArrayDouble *ret0(0);
3250         std::vector<int> ret1;
3251         bool ret2;
3252         self->buildVTUArrays(ret0,ret1,ret2);
3253         std::size_t sz(ret1.size());
3254         PyObject *ret=PyTuple_New(3);
3255         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3256         PyObject *ret1Py=PyList_New(sz);
3257         for(std::size_t i=0;i<sz;i++)
3258           PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
3259         PyTuple_SetItem(ret,1,ret1Py);
3260         PyObject *ret2Py(ret2?Py_True:Py_False);
3261         Py_XINCREF(ret2Py);
3262         PyTuple_SetItem(ret,2,ret2Py);
3263         return ret;
3264       }
3265     }
3266   };
3267
3268   class MEDFileFastCellSupportComparator : public RefCountObject
3269   {
3270   public:
3271     static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception);
3272     MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
3273     bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
3274     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
3275   protected:
3276     ~MEDFileFastCellSupportComparator();
3277   public:
3278     %extend
3279     {
3280       PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const throw(INTERP_KERNEL::Exception)
3281       {
3282         std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
3283         std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
3284         PyObject *res(PyList_New(result.size()));
3285         for(int i=0;iL!=result.end(); i++, iL++)
3286           PyList_SetItem(res,i,PyInt_FromLong(*iL));
3287         return res;
3288       }
3289     }
3290   };
3291 }