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