Salome HOME
6082423e5f6e2273beef44684754b366f3d54294
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
1 // Copyright (C) 2007-2012  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 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
441     virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
442     virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
443     virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
444     virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
445     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
446     virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
447     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
448     %extend
449        {
450          MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
451          {
452            return MEDFileMesh::New(fileName);
453          }
454
455          MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
456          {
457            return MEDFileMesh::New(fileName,mName,dt,it);
458          }
459          
460          std::string __str__() const throw(INTERP_KERNEL::Exception)
461          {
462            return self->simpleRepr();
463          }
464
465          PyObject *getTime() throw(INTERP_KERNEL::Exception)
466          {
467            int tmp1,tmp2;
468            double tmp0=self->getTime(tmp1,tmp2);
469            PyObject *res = PyList_New(3);
470            PyList_SetItem(res,0,SWIG_From_int(tmp1));
471            PyList_SetItem(res,1,SWIG_From_int(tmp2));
472            PyList_SetItem(res,2,SWIG_From_double(tmp0));
473            return res;
474          }
475
476          virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
477          {
478            std::string what;
479            bool ret0=self->isEqual(other,eps,what);
480            PyObject *res=PyList_New(2);
481            PyObject *ret0Py=ret0?Py_True:Py_False;
482            Py_XINCREF(ret0Py);
483            PyList_SetItem(res,0,ret0Py);
484            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
485            return res;
486          }
487          
488          PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
489          {
490            std::string what;
491            bool ret0=self->areFamsEqual(other,what);
492            PyObject *res=PyList_New(2);
493            PyObject *ret0Py=ret0?Py_True:Py_False;
494            Py_XINCREF(ret0Py);
495            PyList_SetItem(res,0,ret0Py);
496            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
497            return res;
498          }
499
500          PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
501          {
502            std::string what;
503            bool ret0=self->areGrpsEqual(other,what);
504            PyObject *res=PyList_New(2);
505            PyObject *ret0Py=ret0?Py_True:Py_False;
506            Py_XINCREF(ret0Py);
507            PyList_SetItem(res,0,ret0Py);
508            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
509            return res;
510          }
511
512          PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
513          {
514            const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
515            if(tmp)
516              tmp->incrRef();
517            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
518          }
519
520          PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
521          {
522            const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
523            if(tmp)
524              tmp->incrRef();
525            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
526          }
527
528          PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
529          {
530            bool ret1;
531            std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
532            PyObject *ret=PyTuple_New(2);
533            PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
534            PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
535            return ret;
536          }
537          
538          PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
539          {
540            DataArrayInt *ret3=0;
541            std::vector<int> ret1,ret2;
542            bool ret0=self->unPolyze(ret1,ret2,ret3);
543            PyObject *ret=PyTuple_New(4);
544            PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
545            //
546            PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
547            for(int j=0;j<(int)ret1.size()/3;j++)
548              {
549                PyObject *retLev2=PyList_New(3);
550                PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
551                PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
552                PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
553                PyList_SetItem(retLev1_0,j,retLev2);
554              }
555            PyTuple_SetItem(ret,1,retLev1_0);
556            //
557            PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
558            for(int j=0;j<(int)ret2.size()/3;j++)
559              {
560                PyObject *retLev2=PyList_New(3);
561                PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
562                PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
563                PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
564                PyList_SetItem(retLev1_1,j,retLev2);
565              }
566            PyTuple_SetItem(ret,2,retLev1_1);
567            //
568            PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
569            return ret;
570          }
571        }
572   };
573
574   class MEDFileUMesh : public MEDFileMesh
575   {
576   public:
577     static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
578     static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
579     static MEDFileUMesh *New();
580     ~MEDFileUMesh();
581     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
582     //
583     std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
584     std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
585     std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
586     std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
587     std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
588     std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
589     std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
590     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
591     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
592     MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
593     DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
594     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
595     DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
596     MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
597     DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
598     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
599     DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
600     DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
601     DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
602     DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
603     DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
604     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
605     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
606     MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
607     MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
608     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
609     //
610     void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
611     void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
612     void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
613     void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
614     void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
615     void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
616     void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
617     void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
618     void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
619     void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
620     void optimizeFamilies() throw(INTERP_KERNEL::Exception);
621     DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
622     %extend
623        { 
624          MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
625          {
626            return MEDFileUMesh::New(fileName,mName,dt,it);
627          }
628
629          MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
630          {
631            return MEDFileUMesh::New(fileName);
632          }
633
634          MEDFileUMesh()
635          {
636            return MEDFileUMesh::New();
637          }
638          
639          PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
640          {
641            const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
642            if(tmp)
643              tmp->incrRef();
644            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
645          }
646          
647          void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
648          {
649            std::vector<const DataArrayInt *> grps;
650            convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
651            self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
652          }
653
654          DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
655          {
656            DataArrayDouble *ret=self->getCoords();
657            if(ret)
658              ret->incrRef();
659            return ret;
660          }
661
662          PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
663          {
664            DataArrayInt *ret0=0,*ret1=0,*ret2=0;
665            self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
666            PyObject *ret=PyTuple_New(3);
667            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
668            PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
669            PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
670            return ret;
671          }
672        }
673   };
674
675   class MEDFileStructuredMesh : public MEDFileMesh
676   {
677   };
678
679   class MEDFileCMesh : public MEDFileStructuredMesh
680   {
681   public:
682     static MEDFileCMesh *New();
683     static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
684     static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
685     void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
686     %extend
687        {
688          MEDFileCMesh()
689          {
690            return MEDFileCMesh::New();
691          }
692
693          MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
694          {
695            return MEDFileCMesh::New(fileName);
696          }
697
698          MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
699          {
700            return MEDFileCMesh::New(fileName,mName,dt,it);
701          }
702          
703          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
704          {
705            const MEDCouplingCMesh *tmp=self->getMesh();
706            if(tmp)
707              tmp->incrRef();
708            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
709          }
710        }
711   };
712
713   class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
714   {
715   public:
716     static MEDFileCurveLinearMesh *New();
717     static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
718     static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
719     void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
720     %extend
721        {
722          MEDFileCurveLinearMesh()
723          {
724            return MEDFileCurveLinearMesh::New();
725          }
726
727          MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
728          {
729            return MEDFileCurveLinearMesh::New(fileName);
730          }
731
732          MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
733          {
734            return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
735          }
736          
737          PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
738          {
739            const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
740            if(tmp)
741              tmp->incrRef();
742            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
743          }
744        }
745   };
746
747   class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
748   {
749   public:
750     static MEDFileMeshMultiTS *New();
751     static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
752     static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
753     MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
754     const char *getName() const throw(INTERP_KERNEL::Exception);
755     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
756     void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
757     %extend
758        { 
759          MEDFileMeshMultiTS()
760          {
761            return MEDFileMeshMultiTS::New();
762          }
763
764          MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
765          {
766            return MEDFileMeshMultiTS::New(fileName);
767          }
768
769          MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
770          {
771            return MEDFileMeshMultiTS::New(fileName,mName);
772          }
773
774          MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
775            {
776              MEDFileMesh *ret=self->getOneTimeStep();
777              if(ret)
778                ret->incrRef();
779              return ret;
780            }
781        }
782   };
783
784   class MEDFileMeshesIterator
785   {
786   public:
787     %extend
788     {
789       PyObject *next() throw(INTERP_KERNEL::Exception)
790       {
791         MEDFileMesh *ret=self->nextt();
792         if(ret)
793           {
794             ret->incrRef();
795             return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
796           }
797         else
798           {
799             PyErr_SetString(PyExc_StopIteration,"No more data.");
800             return 0;
801           }
802       }
803     }
804   };
805
806   class MEDFileMeshes : public RefCountObject, public MEDFileWritable
807   {
808   public:
809     static MEDFileMeshes *New();
810     static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
811     MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
812     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
813     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
814     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
815     //
816     void resize(int newSize) throw(INTERP_KERNEL::Exception);
817     void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
818     void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
819     void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
820     %extend
821        {
822          MEDFileMeshes()
823          {
824            return MEDFileMeshes::New();
825          }
826
827          MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
828          {
829            return MEDFileMeshes::New(fileName);
830          }
831
832          std::string __str__() const
833            {
834              return self->simpleRepr();
835            }
836
837          MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
838          {
839            if(PyInt_Check(obj))
840              {
841                MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
842                if(ret)
843                  ret->incrRef();
844                return ret;
845              }
846            else if(PyString_Check(obj))
847              {
848                MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
849                if(ret)
850                  ret->incrRef();
851                return ret;
852              }
853            else
854              throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
855          }
856
857          MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
858          {
859            self->setMeshAtPos(obj,mesh);
860            return self;
861          }
862
863          MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
864          {
865            return self->iterator();
866          }
867          
868          MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
869            {
870              MEDFileMesh *ret=self->getMeshAtPos(i);
871              if(ret)
872                ret->incrRef();
873              return ret;
874            }
875          MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
876            {
877              MEDFileMesh *ret=self->getMeshWithName(mname);
878              if(ret)
879                ret->incrRef();
880              return ret;
881            }
882        }
883   };
884
885   class MEDFileFieldLoc : public RefCountObject
886   {
887   public:
888     const std::string& getName() const;
889     int getDimension() const;
890     int getNumberOfGaussPoints() const;
891     int getNumberOfPointsInCells() const;
892     const std::vector<double>& getRefCoords() const;
893     const std::vector<double>& getGaussCoords() const;
894     const std::vector<double>& getGaussWeights() const;
895     bool isEqual(const MEDFileFieldLoc& other, double eps) const;
896   %extend
897     {
898       std::string __str__() const throw(INTERP_KERNEL::Exception)
899       {
900         return self->repr();
901       }
902     }
903   };
904
905   class MEDFileFieldGlobsReal
906   {
907   public:
908     void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
909     void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
910     std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
911     std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
912     bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
913     bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
914     std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
915     std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
916     std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
917     std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
918     virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
919     virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
920     virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
921     virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
922     void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
923     void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
924     void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
925     void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
926     int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
927     int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
928   %extend
929      {
930        PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
931        {
932          const DataArrayInt *ret=self->getProfile(pflName);
933          if(ret)
934            ret->incrRef();
935          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
936        }
937
938        PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
939        {
940          const DataArrayInt *ret=self->getProfileFromId(pflId);
941          if(ret)
942            ret->incrRef();
943          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
944        }
945
946        PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
947        {
948          const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
949          loc->incrRef();
950          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
951        }
952        
953        PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
954        {
955          const MEDFileFieldLoc *loc=&self->getLocalization(locName);
956          loc->incrRef();
957          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
958        }
959        
960        PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
961        {
962          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
963          return convertVecPairVecStToPy(ret);
964        }
965
966        PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
967        {
968          std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
969          return convertVecPairVecStToPy(ret);
970        }
971
972        void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
973        {
974          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
975          self->changePflsNames(v);
976        }
977
978        void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
979        {
980          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
981          self->changePflsRefsNamesGen(v);
982        }
983
984        void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
985        {
986          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
987          self->changePflsNamesInStruct(v);
988        }
989
990        void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
991        {
992          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
993          self->changeLocsNames(v);
994        }
995
996        void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
997        {
998          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
999          self->changeLocsRefsNamesGen(v);
1000        }
1001        
1002        void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1003        {
1004          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1005          self->changeLocsNamesInStruct(v);
1006        }
1007      }
1008   };
1009
1010   class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1011   {
1012   public:
1013     static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1014     static MEDFileField1TS *New();
1015     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1016     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1017     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1018     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1019     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1020     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1021     //
1022     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1023     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1024     void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1025     void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1026     void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1027     MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1028     //
1029     int getDimension() const throw(INTERP_KERNEL::Exception);
1030     int getIteration() const throw(INTERP_KERNEL::Exception);
1031     int getOrder() const throw(INTERP_KERNEL::Exception);
1032     std::string getName() throw(INTERP_KERNEL::Exception);
1033     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1034     std::string getMeshName() throw(INTERP_KERNEL::Exception);
1035     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1036     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1037     bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1038     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1039     void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1040     %extend
1041        {
1042          MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1043          {
1044            return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1045          }
1046
1047          MEDFileField1TS()
1048          {
1049            return MEDFileField1TS::New();
1050          }
1051          
1052          std::string __str__() const throw(INTERP_KERNEL::Exception)
1053            {
1054              return self->simpleRepr();
1055            }
1056
1057          PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1058            {
1059              DataArrayInt *ret1=0;
1060              DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1061              PyObject *ret=PyTuple_New(2);
1062              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1063              PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1064              return ret;
1065            }
1066
1067          void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1068            {
1069              self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1070            }
1071          
1072          void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1073            {
1074              self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1075            }
1076
1077          PyObject *getTime() throw(INTERP_KERNEL::Exception)
1078          {
1079            int tmp1,tmp2;
1080            double tmp0=self->getTime(tmp1,tmp2);
1081            PyObject *res = PyList_New(3);
1082            PyList_SetItem(res,0,SWIG_From_int(tmp1));
1083            PyList_SetItem(res,1,SWIG_From_int(tmp2));
1084            PyList_SetItem(res,2,SWIG_From_double(tmp0));
1085            return res;
1086          }
1087          
1088          PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1089          {
1090            std::pair<int,int> res=self->getDtIt();
1091            PyObject *elt=PyTuple_New(2);
1092            PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1093            PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1094            return elt;
1095          }
1096          
1097          PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1098          {
1099            std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1100            PyObject *ret2=PyList_New(ret.size());
1101            for(int i=0;i<(int)ret.size();i++)
1102              PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1103            return ret2;
1104          }
1105          
1106          PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1107          {
1108            std::vector<int> ret1;
1109            int ret0=self->getNonEmptyLevels(mname,ret1);
1110            PyObject *elt=PyTuple_New(2);
1111            PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1112            PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1113            return elt;
1114          }
1115          
1116          PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1117          {
1118            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1119            std::vector< std::vector<TypeOfField> > typesF;
1120            std::vector< std::vector<std::string> > pfls;
1121            std::vector< std::vector<std::string> > locs;
1122            std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1123            int sz=ret.size();
1124            PyObject *ret2=PyList_New(sz);
1125            for(int i=0;i<sz;i++)
1126              {
1127                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1128                const std::vector<TypeOfField>& typesFI=typesF[i];
1129                const std::vector<std::string>& pflsI=pfls[i];
1130                const std::vector<std::string>& locsI=locs[i];
1131                PyObject *elt=PyTuple_New(2);
1132                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1133                int sz2=ret[i].size();
1134                PyObject *elt2=PyList_New(sz2);
1135                for(int j=0;j<sz2;j++)
1136                  {
1137                    PyObject *elt3=PyTuple_New(4);
1138                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1139                    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));
1140                    PyTuple_SetItem(elt3,1,elt4);
1141                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1142                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1143                    PyList_SetItem(elt2,j,elt3);
1144                  }
1145                PyTuple_SetItem(elt,1,elt2);
1146                PyList_SetItem(ret2,i,elt);
1147              }
1148            return ret2;
1149          }
1150
1151          PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1152          {
1153            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1154            std::vector< std::vector<TypeOfField> > typesF;
1155            std::vector< std::vector<std::string> > pfls;
1156            std::vector< std::vector<std::string> > locs;
1157            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1158            int sz=ret.size();
1159            PyObject *ret2=PyList_New(sz);
1160            for(int i=0;i<sz;i++)
1161              {
1162                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1163                const std::vector<TypeOfField>& typesFI=typesF[i];
1164                const std::vector<std::string>& pflsI=pfls[i];
1165                const std::vector<std::string>& locsI=locs[i];
1166                PyObject *elt=PyTuple_New(2);
1167                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1168                int sz2=ret[i].size();
1169                PyObject *elt2=PyList_New(sz2);
1170                for(int j=0;j<sz2;j++)
1171                  {
1172                    PyObject *elt3=PyTuple_New(4);
1173                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1174                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1175                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1176                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1177                    PyList_SetItem(elt2,j,elt3);
1178                  }
1179                PyTuple_SetItem(elt,1,elt2);
1180                PyList_SetItem(ret2,i,elt);
1181              }
1182            return ret2;
1183          }
1184
1185          DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1186          {
1187            DataArrayDouble *ret=self->getUndergroundDataArray();
1188            if(ret)
1189              ret->incrRef();
1190            return ret;
1191          }
1192
1193          PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1194          {
1195            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1196            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1197            if(elt0)
1198              elt0->incrRef();
1199            PyObject *ret=PyTuple_New(2);
1200            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1201            std::size_t sz=elt1Cpp.size();
1202            PyObject *elt=PyList_New(sz);
1203            for(std::size_t i=0;i<sz;i++)
1204              {
1205                PyObject *elt1=PyTuple_New(2);
1206                PyObject *elt2=PyTuple_New(2);
1207                PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1208                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1209                PyObject *elt3=PyTuple_New(2);
1210                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1211                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1212                PyTuple_SetItem(elt1,0,elt2);
1213                PyTuple_SetItem(elt1,1,elt3);
1214                PyList_SetItem(elt,i,elt1);
1215              }
1216            PyTuple_SetItem(ret,1,elt);
1217            return ret;
1218          }
1219          
1220          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1221          {
1222            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1223            return self->changeMeshNames(modifTab);
1224          }
1225        }
1226   };
1227
1228   class MEDFileFieldMultiTSIterator
1229   {
1230   public:
1231     %extend
1232     {
1233       PyObject *next() throw(INTERP_KERNEL::Exception)
1234       {
1235         MEDFileField1TS *ret=self->nextt();
1236         if(ret)
1237           return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1238         else
1239           {
1240             PyErr_SetString(PyExc_StopIteration,"No more data.");
1241             return 0;
1242           }
1243       }
1244     }
1245   };
1246
1247   class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1248   {
1249   public:
1250     static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1251     static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1252     static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1253     MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1254     //
1255     MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1256     MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1257     MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1258     //
1259     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1260     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1261     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1262     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1263     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1264     MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1265     //
1266     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1267     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1268     //
1269     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1270     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1271     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1272     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1273     std::string getName() const throw(INTERP_KERNEL::Exception);
1274     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1275     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1276     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1277     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1278     %extend
1279        {
1280          MEDFileFieldMultiTS()
1281          {
1282            return MEDFileFieldMultiTS::New();
1283          }
1284
1285          MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1286          {
1287            return MEDFileFieldMultiTS::New(fileName);
1288          }
1289
1290          MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1291          {
1292            return MEDFileFieldMultiTS::New(fileName,fieldName);
1293          }
1294          
1295          std::string __str__() const throw(INTERP_KERNEL::Exception)
1296          {
1297            return self->simpleRepr();
1298          }
1299
1300          int __len__() const throw(INTERP_KERNEL::Exception)
1301          {
1302            return self->getNumberOfTS();
1303          }
1304
1305          MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1306          {
1307            if(elt0 && PyInt_Check(elt0))
1308              {//fmts[3]
1309                int pos=PyInt_AS_LONG(elt0);
1310                return self->getTimeStepAtPos(pos);
1311              }
1312            else if(elt0 && PyTuple_Check(elt0))
1313              {
1314                if(PyTuple_Size(elt0)==2)
1315                  {
1316                    PyObject *o0=PyTuple_GetItem(elt0,0);
1317                    PyObject *o1=PyTuple_GetItem(elt0,1);
1318                    if(PyInt_Check(o0) && PyInt_Check(o1))
1319                      {//fmts(1,-1)
1320                        int iter=PyInt_AS_LONG(o0);
1321                        int order=PyInt_AS_LONG(o1);
1322                        return self->getTimeStep(iter,order);
1323                      }
1324                    else
1325                      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 !");
1326                  }
1327                else
1328                  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 !");
1329              }
1330            else if(elt0 && PyFloat_Check(elt0))
1331              {
1332                double val=PyFloat_AS_DOUBLE(elt0);
1333                return self->getTimeStepGivenTime(val);
1334              }
1335            else
1336              throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1337          }
1338
1339          MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1340          {
1341            return self->iterator();
1342          }
1343
1344          PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1345            {
1346              DataArrayInt *ret1=0;
1347              DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1348              PyObject *ret=PyTuple_New(2);
1349              PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1350              PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1351              return ret;
1352            }
1353
1354          PyObject *getIterations() const
1355          {
1356            std::vector< std::pair<int,int> > res=self->getIterations();
1357            PyObject *ret=PyList_New(res.size());
1358            int rk=0;
1359            for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1360              {
1361                PyObject *elt=PyTuple_New(2);
1362                PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1363                PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1364                PyList_SetItem(ret,rk,elt);
1365              }
1366            return ret;
1367          }
1368
1369          PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1370            {
1371              std::vector<double> ret1;
1372              std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1373              std::size_t sz=ret.size();
1374              PyObject *ret2=PyList_New(sz);
1375              for(std::size_t i=0;i<sz;i++)
1376                {
1377                  PyObject *elt=PyTuple_New(3);
1378                  PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1379                  PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1380                  PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1381                  PyList_SetItem(ret2,i,elt);
1382                }
1383              return ret2;
1384            }
1385
1386          PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1387          {
1388            std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1389            PyObject *ret2=PyList_New(ret.size());
1390            for(int i=0;i<(int)ret.size();i++)
1391              {
1392                const std::vector<TypeOfField>& rett=ret[i];
1393                PyObject *ret3=PyList_New(rett.size());
1394                for(int j=0;j<(int)rett.size();j++)
1395                  PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1396                PyList_SetItem(ret2,i,ret3);
1397              }
1398            return ret2;
1399          }
1400
1401          PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1402          {
1403            std::vector<int> ret1;
1404            int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1405            PyObject *elt=PyTuple_New(2);
1406            PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1407            PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1408            return elt;
1409          }
1410
1411          PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1412          {
1413            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1414            std::vector< std::vector<TypeOfField> > typesF;
1415            std::vector< std::vector<std::string> > pfls;
1416            std::vector< std::vector<std::string> > locs;
1417            std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1418            int sz=ret.size();
1419            PyObject *ret2=PyList_New(sz);
1420            for(int i=0;i<sz;i++)
1421              {
1422                const std::vector< std::pair<int,int> >& dadsI=ret[i];
1423                const std::vector<TypeOfField>& typesFI=typesF[i];
1424                const std::vector<std::string>& pflsI=pfls[i];
1425                const std::vector<std::string>& locsI=locs[i];
1426                PyObject *elt=PyTuple_New(2);
1427                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1428                int sz2=ret[i].size();
1429                PyObject *elt2=PyList_New(sz2);
1430                for(int j=0;j<sz2;j++)
1431                  {
1432                    PyObject *elt3=PyTuple_New(4);
1433                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1434                    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));
1435                    PyTuple_SetItem(elt3,1,elt4);
1436                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1437                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1438                    PyList_SetItem(elt2,j,elt3);
1439                  }
1440                PyTuple_SetItem(elt,1,elt2);
1441                PyList_SetItem(ret2,i,elt);
1442              }
1443            return ret2;
1444          }
1445
1446          PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1447          {
1448            std::vector<INTERP_KERNEL::NormalizedCellType> types;
1449            std::vector< std::vector<TypeOfField> > typesF;
1450            std::vector< std::vector<std::string> > pfls;
1451            std::vector< std::vector<std::string> > locs;
1452            std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1453            int sz=ret.size();
1454            PyObject *ret2=PyList_New(sz);
1455            for(int i=0;i<sz;i++)
1456              {
1457                const std::vector<DataArrayDouble *>& dadsI=ret[i];
1458                const std::vector<TypeOfField>& typesFI=typesF[i];
1459                const std::vector<std::string>& pflsI=pfls[i];
1460                const std::vector<std::string>& locsI=locs[i];
1461                PyObject *elt=PyTuple_New(2);
1462                PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1463                int sz2=ret[i].size();
1464                PyObject *elt2=PyList_New(sz2);
1465                for(int j=0;j<sz2;j++)
1466                  {
1467                    PyObject *elt3=PyTuple_New(4);
1468                    PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1469                    PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1470                    PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1471                    PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1472                    PyList_SetItem(elt2,j,elt3);
1473                  }
1474                PyTuple_SetItem(elt,1,elt2);
1475                PyList_SetItem(ret2,i,elt);
1476              }
1477            return ret2;
1478          }
1479          DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1480          {
1481            DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1482            if(ret)
1483              ret->incrRef();
1484            return ret;
1485          }
1486          PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1487          {
1488            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1489            DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1490            if(elt0)
1491              elt0->incrRef();
1492            PyObject *ret=PyTuple_New(2);
1493            PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1494            std::size_t sz=elt1Cpp.size();
1495            PyObject *elt=PyList_New(sz);
1496            for(std::size_t i=0;i<sz;i++)
1497              {
1498                PyObject *elt1=PyTuple_New(2);
1499                PyObject *elt2=PyTuple_New(2);
1500                PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1501                PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1502                PyObject *elt3=PyTuple_New(2);
1503                PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1504                PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1505                PyTuple_SetItem(elt1,0,elt2);
1506                PyTuple_SetItem(elt1,1,elt3);
1507                PyList_SetItem(elt,i,elt1);
1508              }
1509            PyTuple_SetItem(ret,1,elt);
1510            return ret;
1511          }
1512
1513          int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1514          {
1515            if(elt0 && PyInt_Check(elt0))
1516              {//fmts[3]
1517                int pos=PyInt_AS_LONG(elt0);
1518                return pos;
1519              }
1520            else if(elt0 && PyTuple_Check(elt0))
1521              {
1522                if(PyTuple_Size(elt0)==2)
1523                  {
1524                    PyObject *o0=PyTuple_GetItem(elt0,0);
1525                    PyObject *o1=PyTuple_GetItem(elt0,1);
1526                    if(PyInt_Check(o0) && PyInt_Check(o1))
1527                      {//fmts(1,-1)
1528                        int iter=PyInt_AS_LONG(o0);
1529                        int order=PyInt_AS_LONG(o1);
1530                        return self->getPosOfTimeStep(iter,order);
1531                      }
1532                    else
1533                      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 !");
1534                  }
1535                else
1536                  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 !");
1537              }
1538            else if(elt0 && PyFloat_Check(elt0))
1539              {
1540                double val=PyFloat_AS_DOUBLE(elt0);
1541                return self->getPosGivenTime(val);
1542              }
1543            else
1544              throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1545          }
1546
1547          std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1548          {
1549            if(PyList_Check(elts))
1550              {
1551                int sz=PyList_Size(elts);
1552                std::vector<int> ret(sz);
1553                for(int i=0;i<sz;i++)
1554                  {
1555                    PyObject *elt=PyList_GetItem(elts,i);
1556                    ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1557                  }
1558                return ret;
1559              }
1560            else
1561              {
1562                std::vector<int> ret(1);
1563                ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1564                return ret;
1565              }
1566          }
1567
1568          void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1569          {
1570            std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1571            if(!idsToRemove.empty())
1572              self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1573          }
1574
1575          void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1576          {
1577            int sw;
1578            int pos1;
1579            std::vector<int> pos2;
1580            DataArrayInt *pos3=0;
1581            DataArrayIntTuple *pos4=0;
1582            convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1583            switch(sw)
1584              {
1585              case 1:
1586                {
1587                  self->eraseTimeStepIds(&pos1,&pos1+1);
1588                  return;
1589                }
1590              case 2:
1591                {
1592                  if(pos2.empty())
1593                    return;
1594                  self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1595                  return ;
1596                }
1597              case 3:
1598                {
1599                  self->eraseTimeStepIds(pos3->begin(),pos3->end());
1600                  return ;
1601                }
1602              default:
1603                throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1604              }
1605          }
1606
1607          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1608          {
1609            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1610            return self->changeMeshNames(modifTab);
1611          }
1612        }
1613   };
1614
1615   class MEDFileFieldsIterator
1616   {
1617   public:
1618     %extend
1619     {
1620       PyObject *next() throw(INTERP_KERNEL::Exception)
1621       {
1622         MEDFileFieldMultiTS *ret=self->nextt();
1623         if(ret)
1624           return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1625         else
1626           {
1627             PyErr_SetString(PyExc_StopIteration,"No more data.");
1628             return 0;
1629           }
1630       }
1631     }
1632   };
1633
1634   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1635   {
1636   public:
1637     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1638     static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1639     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
1640     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1641     int getNumberOfFields() const;
1642     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1643     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1644     //
1645     void resize(int newSize) throw(INTERP_KERNEL::Exception);
1646     void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1647     void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1648     MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1649     MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1650     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1651     %extend
1652        {
1653          MEDFileFields()
1654          {
1655            return MEDFileFields::New();
1656          }
1657
1658          MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1659          {
1660            return MEDFileFields::New(fileName);
1661          }
1662          
1663          std::string __str__() const throw(INTERP_KERNEL::Exception)
1664          {
1665            return self->simpleRepr();
1666          }
1667          
1668          MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1669          {
1670            if(PyInt_Check(obj))
1671              {
1672                return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1673              }
1674            else if(PyString_Check(obj))
1675              {
1676                return self->getFieldWithName(PyString_AsString(obj));
1677              }
1678            else
1679              throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1680          }
1681
1682          MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1683          {
1684            self->setFieldAtPos(obj,field);
1685            return self;
1686          }
1687
1688          MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1689          {
1690            return self->iterator();
1691          }
1692          
1693          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1694          {
1695            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1696            return self->changeMeshNames(modifTab);
1697          }
1698        }
1699   };
1700
1701   class MEDFileParameter1TS : public RefCountObject
1702   {
1703   public:
1704     void setIteration(int it);
1705     int getIteration() const;
1706     void setOrder(int order);
1707     int getOrder() const;
1708     void setTimeValue(double time);
1709     void setTime(int dt, int it, double time);
1710     double getTime(int& dt, int& it);
1711     double getTimeValue() const;
1712   };
1713
1714   class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
1715   {
1716   public:
1717     void setValue(double val) throw(INTERP_KERNEL::Exception);
1718     double getValue() const throw(INTERP_KERNEL::Exception);
1719     std::string simpleRepr() const;
1720     %extend
1721     {
1722       std::string __str__() const throw(INTERP_KERNEL::Exception)
1723       {
1724         return self->simpleRepr();
1725       }
1726     }
1727   };
1728
1729   class MEDFileParameterTinyInfo : public MEDFileWritable
1730   {
1731   public:
1732     void setDescription(const char *name);
1733     const char *getDescription() const;
1734     void setTimeUnit(const char *unit);
1735     const char *getTimeUnit() const;
1736   };
1737
1738   class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
1739   {
1740   public:
1741     static MEDFileParameterDouble1TS *New();
1742     static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1743     static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
1744     static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
1745     virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1746     virtual std::string simpleRepr() const;
1747     void setName(const char *name) throw(INTERP_KERNEL::Exception);
1748     const char *getName() const throw(INTERP_KERNEL::Exception);
1749     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1750     %extend
1751     {
1752       MEDFileParameterDouble1TS()
1753       {
1754         return MEDFileParameterDouble1TS::New();
1755       }
1756       
1757       MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1758       {
1759         return MEDFileParameterDouble1TS::New(fileName);
1760       }
1761
1762       MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
1763       {
1764         return MEDFileParameterDouble1TS::New(fileName,paramName);
1765       }
1766
1767       MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
1768       {
1769         return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
1770       }
1771
1772       std::string __str__() const throw(INTERP_KERNEL::Exception)
1773       {
1774         return self->simpleRepr();
1775       }
1776
1777       PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
1778       {
1779         std::string what;
1780         bool ret0=self->isEqual(other,eps,what);
1781         PyObject *res=PyList_New(2);
1782         PyObject *ret0Py=ret0?Py_True:Py_False;
1783         Py_XINCREF(ret0Py);
1784         PyList_SetItem(res,0,ret0Py);
1785         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1786         return res;
1787       }
1788     }
1789   };
1790
1791   class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
1792   {
1793   public:
1794     static MEDFileParameterMultiTS *New();
1795     static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1796     static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
1797     const char *getName() const;
1798     void setName(const char *name);
1799     MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1800     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1801     std::string simpleRepr() const;
1802     void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
1803     double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1804     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1805     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1806     %extend
1807     {
1808       MEDFileParameterMultiTS()
1809       {
1810         return MEDFileParameterMultiTS::New();
1811       }
1812       
1813       MEDFileParameterMultiTS(const char *fileName)
1814       {
1815         return MEDFileParameterMultiTS::New(fileName);
1816       }
1817
1818       MEDFileParameterMultiTS(const char *fileName, const char *paramName)
1819       {
1820         return MEDFileParameterMultiTS::New(fileName,paramName);
1821       }
1822
1823       std::string __str__() const throw(INTERP_KERNEL::Exception)
1824       {
1825         return self->simpleRepr();
1826       }
1827       
1828       PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
1829       {
1830         std::string what;
1831         bool ret0=self->isEqual(other,eps,what);
1832         PyObject *res=PyList_New(2);
1833         PyObject *ret0Py=ret0?Py_True:Py_False;
1834         Py_XINCREF(ret0Py);
1835         PyList_SetItem(res,0,ret0Py);
1836         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1837         return res;
1838       }
1839       
1840       void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
1841       {
1842         int sw;
1843         int pos1;
1844         std::vector<int> pos2;
1845         DataArrayInt *pos3=0;
1846         DataArrayIntTuple *pos4=0;
1847         convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
1848         switch(sw)
1849           {
1850           case 1:
1851             {
1852               self->eraseTimeStepIds(&pos1,&pos1+1);
1853               return;
1854             }
1855           case 2:
1856             {
1857               if(pos2.empty())
1858                 return;
1859               self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1860               return ;
1861             }
1862           case 3:
1863             {
1864               self->eraseTimeStepIds(pos3->begin(),pos3->end());
1865               return ;
1866             }
1867           default:
1868             throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1869           }
1870       }
1871
1872       int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1873       {
1874         if(elt0 && PyInt_Check(elt0))
1875           {//fmts[3]
1876             int pos=PyInt_AS_LONG(elt0);
1877             return pos;
1878           }
1879         else if(elt0 && PyTuple_Check(elt0))
1880           {
1881             if(PyTuple_Size(elt0)==2)
1882               {
1883                 PyObject *o0=PyTuple_GetItem(elt0,0);
1884                 PyObject *o1=PyTuple_GetItem(elt0,1);
1885                 if(PyInt_Check(o0) && PyInt_Check(o1))
1886                   {//fmts(1,-1)
1887                     int iter=PyInt_AS_LONG(o0);
1888                     int order=PyInt_AS_LONG(o1);
1889                     return self->getPosOfTimeStep(iter,order);
1890                   }
1891                 else
1892                   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 !");
1893               }
1894             else
1895               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 !");
1896           }
1897         else if(elt0 && PyFloat_Check(elt0))
1898           {
1899             double val=PyFloat_AS_DOUBLE(elt0);
1900             return self->getPosGivenTime(val);
1901           }
1902         else
1903           throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1904       }
1905
1906       MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1907       {
1908         MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
1909         if(ret)
1910           ret->incrRef();
1911         return ret;
1912       }
1913
1914       std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1915       {
1916         if(PyList_Check(elts))
1917           {
1918             int sz=PyList_Size(elts);
1919             std::vector<int> ret(sz);
1920             for(int i=0;i<sz;i++)
1921               {
1922                 PyObject *elt=PyList_GetItem(elts,i);
1923                 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
1924               }
1925             return ret;
1926           }
1927         else
1928           {
1929             std::vector<int> ret(1);
1930             ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
1931             return ret;
1932           }
1933       }
1934
1935       void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1936       {
1937         std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
1938         if(!idsToRemove.empty())
1939           self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1940       }
1941       
1942       MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
1943       {
1944         MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
1945         if(ret)
1946           ret->incrRef();
1947         return ret;
1948       }
1949
1950       PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1951       {
1952         std::vector< std::pair<int,int> > res=self->getIterations();
1953         PyObject *ret=PyList_New(res.size());
1954         int rk=0;
1955         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1956           {
1957             PyObject *elt=PyTuple_New(2);
1958             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1959             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1960             PyList_SetItem(ret,rk,elt);
1961           }
1962         return ret;
1963       }
1964
1965       PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1966       {
1967         std::vector<double> res2;
1968         std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
1969         PyObject *ret=PyList_New(res.size());
1970         int rk=0;
1971         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1972           {
1973             PyObject *elt=PyTuple_New(3);
1974             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1975             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1976             PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
1977             PyList_SetItem(ret,rk,elt);
1978           }
1979         return ret;
1980       }
1981     }
1982   };
1983
1984   class MEDFileParameters : public RefCountObject, public MEDFileWritable
1985   {
1986   public:
1987     static MEDFileParameters *New();
1988     static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1989     MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
1990     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1991     std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
1992     std::string simpleRepr() const;
1993     void resize(int newSize) throw(INTERP_KERNEL::Exception);
1994     void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
1995     void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
1996     void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
1997     int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
1998     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
1999     %extend
2000     {
2001       MEDFileParameters()
2002       {
2003         return MEDFileParameters::New();
2004       }
2005       
2006       MEDFileParameters(const char *fileName)
2007       {
2008         return MEDFileParameters::New(fileName);
2009       }
2010
2011       std::string __str__() const throw(INTERP_KERNEL::Exception)
2012       {
2013         return self->simpleRepr();
2014       }
2015
2016       MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2017       {
2018         if(PyInt_Check(obj))
2019           {
2020             MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2021             if(ret)
2022               ret->incrRef();
2023             return ret;
2024           }
2025         else if(PyString_Check(obj))
2026           {
2027             MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2028             if(ret)
2029               ret->incrRef();
2030             return ret;
2031           }
2032         else
2033           throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2034       }
2035       
2036       MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2037       {
2038         MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2039         if(ret)
2040           ret->incrRef();
2041         return ret;
2042       }
2043
2044       MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2045       {
2046         MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2047         if(ret)
2048           ret->incrRef();
2049         return ret;
2050       }
2051       
2052       PyObject *isEqual(const MEDFileParameters *other, double eps) const
2053       {
2054         std::string what;
2055         bool ret0=self->isEqual(other,eps,what);
2056         PyObject *res=PyList_New(2);
2057         PyObject *ret0Py=ret0?Py_True:Py_False;
2058         Py_XINCREF(ret0Py);
2059         PyList_SetItem(res,0,ret0Py);
2060         PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2061         return res;
2062       }
2063     }
2064   };
2065
2066   class MEDFileData : public RefCountObject, public MEDFileWritable
2067   {
2068   public:
2069     static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2070     static MEDFileData *New();
2071     MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2072     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2073     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2074     void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2075     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2076     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2077     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2078     //
2079     bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2080     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2081     //
2082     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2083     %extend
2084        {
2085          MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2086          {
2087            return MEDFileData::New(fileName);
2088          }
2089
2090          MEDFileData()
2091          {
2092            return MEDFileData::New();
2093          }
2094
2095          std::string __str__() const throw(INTERP_KERNEL::Exception)
2096          {
2097            return self->simpleRepr();
2098          }
2099
2100          MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2101          {
2102            MEDFileMeshes *ret=self->getMeshes();
2103            if(ret)
2104              ret->incrRef();
2105            return ret;
2106          }
2107
2108          MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2109          {
2110            MEDFileParameters *ret=self->getParams();
2111            if(ret)
2112              ret->incrRef();
2113            return ret;
2114          }
2115
2116          MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2117          {
2118            MEDFileFields *ret=self->getFields();
2119            if(ret)
2120              ret->incrRef();
2121            return ret;
2122          }
2123
2124          bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2125          {
2126            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2127            return self->changeMeshNames(modifTab);
2128          }
2129        }
2130   };
2131
2132   class SauvReader : public RefCountObject
2133   {
2134   public:
2135     static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2136     MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2137   };
2138
2139   class SauvWriter : public RefCountObject
2140   {
2141   public:
2142     static SauvWriter * New();
2143     void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2144     void write(const char* fileName) throw(INTERP_KERNEL::Exception);
2145   };
2146
2147 }