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