1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
23 #define MEDCOUPLING_EXPORT
24 #define MEDLOADER_EXPORT
26 %include "MEDCouplingCommon.i"
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"
38 using namespace ParaMEDMEM;
41 #if SWIG_VERSION >= 0x010329
42 %template() std::vector<std::string>;
45 %typemap(out) ParaMEDMEM::MEDFileMesh*
47 $result=convertMEDFileMesh($1,$owner);
50 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
52 $result=convertMEDFileParameter1TS($1,$owner);
55 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
57 $result=convertMEDFileFieldMultiTS($1,$owner);
60 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
62 $result=convertMEDFileField1TS($1,$owner);
65 %newobject MEDLoader::ReadUMeshFromFamilies;
66 %newobject MEDLoader::ReadUMeshFromGroups;
67 %newobject MEDLoader::ReadUMeshFromFile;
68 %newobject MEDLoader::ReadField;
69 %newobject MEDLoader::ReadFieldCell;
70 %newobject MEDLoader::ReadFieldNode;
71 %newobject MEDLoader::ReadFieldGauss;
72 %newobject MEDLoader::ReadFieldGaussNE;
73 %newobject ParaMEDMEM::MEDFileMesh::New;
74 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
75 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
76 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
77 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
78 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
79 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
80 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
81 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
82 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
83 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
84 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
85 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
86 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
87 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
88 %newobject ParaMEDMEM::MEDFileUMesh::New;
89 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
90 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
91 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
92 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
93 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
94 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
95 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
96 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
98 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
99 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
100 %newobject ParaMEDMEM::MEDFileCMesh::New;
101 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
102 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
103 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
104 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
105 %newobject ParaMEDMEM::MEDFileMeshes::New;
106 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
107 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
108 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
109 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
110 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
112 %newobject ParaMEDMEM::MEDFileFields::New;
113 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
114 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
115 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
116 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
117 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
118 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
119 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
120 %newobject ParaMEDMEM::MEDFileFields::__iter__;
122 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
123 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
124 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
125 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
126 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
127 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
128 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
129 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
130 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
131 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
132 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
133 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
134 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
135 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
136 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
138 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
139 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
140 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
141 %newobject ParaMEDMEM::MEDFileField1TS::New;
142 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
143 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
144 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
145 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
146 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
147 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
148 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
150 %newobject ParaMEDMEM::MEDFileData::New;
151 %newobject ParaMEDMEM::MEDFileData::deepCpy;
152 %newobject ParaMEDMEM::MEDFileData::getMeshes;
153 %newobject ParaMEDMEM::MEDFileData::getFields;
154 %newobject ParaMEDMEM::MEDFileData::getParams;
156 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
157 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
158 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
159 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
160 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
161 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
162 %newobject ParaMEDMEM::MEDFileParameters::New;
163 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
164 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
165 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
166 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
168 %newobject ParaMEDMEM::SauvWriter::New;
169 %newobject ParaMEDMEM::SauvReader::New;
170 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
172 %feature("unref") MEDFileMesh "$this->decrRef();"
173 %feature("unref") MEDFileUMesh "$this->decrRef();"
174 %feature("unref") MEDFileCMesh "$this->decrRef();"
175 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
176 %feature("unref") MEDFileMeshes "$this->decrRef();"
177 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
178 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
179 %feature("unref") MEDFileField1TS "$this->decrRef();"
180 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
181 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
182 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
183 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
184 %feature("unref") MEDFileFields "$this->decrRef();"
185 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
186 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
187 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
188 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
189 %feature("unref") MEDFileParameters "$this->decrRef();"
190 %feature("unref") MEDFileData "$this->decrRef();"
191 %feature("unref") SauvReader "$this->decrRef();"
192 %feature("unref") SauvWriter "$this->decrRef();"
197 static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
198 static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
199 static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
200 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
201 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
202 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
203 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
204 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
205 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
206 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
207 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
208 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
209 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
210 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
211 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
212 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
215 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
217 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
218 PyObject *ret=PyList_New(res.size());
220 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
222 PyObject *elt=PyTuple_New(2);
223 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
224 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
225 PyList_SetItem(ret,rk,elt);
230 static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
232 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
233 PyObject *ret=PyList_New(res.size());
235 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
237 PyObject *elt=PyTuple_New(3);
238 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
239 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
240 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
241 PyList_SetItem(ret,rk,elt);
246 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
248 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
249 PyObject *ret=PyList_New(res.size());
251 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
253 PyObject *elt=PyTuple_New(2);
254 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
255 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
256 PyList_SetItem(ret,rk,elt);
260 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
262 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
263 PyObject *ret=PyList_New(res.size());
265 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
267 PyObject *elt=PyTuple_New(2);
268 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
269 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
270 PyList_SetItem(ret,rk,elt);
274 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
276 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
277 PyObject *ret=PyList_New(res.size());
279 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
281 PyObject *elt=PyTuple_New(2);
282 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
283 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
284 PyList_SetItem(ret,rk,elt);
288 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
290 int meshDim,spaceDim,numberOfNodes;
291 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
292 PyObject *ret=PyTuple_New(4);
293 PyObject *elt0=PyList_New(res.size());
295 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
297 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
299 PyObject *elt1=PyList_New(obj2.size());
300 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
302 PyObject *elt2=PyTuple_New(2);
303 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
304 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
305 PyList_SetItem(elt1,j,elt2);
307 PyList_SetItem(elt0,i,elt1);
309 PyTuple_SetItem(ret,0,elt0);
310 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
311 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
312 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
315 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
316 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
318 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
319 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
320 return convertFieldDoubleVecToPy(res);
322 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
324 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
325 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
326 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
328 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
330 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
331 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
332 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
334 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
336 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
337 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
338 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
340 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
342 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
344 PyObject *ret=PyList_New(size);
345 for(int i=0;i<size;i++)
346 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
349 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
351 std::vector<std::string> grps;
352 converPyListToVecString(li,grps);
353 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
355 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
357 std::vector<std::string> fams;
358 converPyListToVecString(li,fams);
359 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
362 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
363 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
364 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
365 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);
366 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
367 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
368 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
369 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
370 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
371 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
372 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
373 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
374 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
379 class MEDFileWritable
382 void copyOptionsFrom(const MEDFileWritable& other) const;
383 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
384 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
385 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
386 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
389 class MEDFileMesh : public RefCountObject, public MEDFileWritable
392 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
393 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
394 virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
395 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
396 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
397 virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
398 void setName(const char *name);
399 const char *getName();
400 const char *getUnivName() const;
401 bool getUnivNameWrStatus() const;
402 void setUnivNameWrStatus(bool newStatus);
403 void setDescription(const char *name);
404 const char *getDescription() const;
405 void setOrder(int order);
406 int getOrder() const;
407 void setIteration(int it);
409 void setTimeValue(double time);
410 void setTime(int dt, int it, double time);
411 double getTimeValue() const;
412 void setTimeUnit(const char *unit);
413 const char *getTimeUnit() const;
414 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
415 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
416 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
417 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
418 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
419 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
420 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
421 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
423 bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
424 bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
425 bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
426 void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
427 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
428 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
429 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
430 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
431 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
432 void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
433 const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
434 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
435 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
436 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
437 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
438 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
439 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
440 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
441 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
442 std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
443 std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
444 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
445 std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
446 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
447 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
448 std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
449 std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
450 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
451 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
452 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
453 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
454 void setFamilyInfo(const std::map<std::string,int>& info);
455 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
456 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
457 int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
458 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
459 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
460 int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
461 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
462 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
463 virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
464 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
465 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
466 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
467 DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
468 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
469 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
470 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
471 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
472 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
473 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
474 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
475 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
477 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
478 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
479 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
480 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
481 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
482 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
483 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
484 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
485 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
486 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
487 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
488 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
491 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
493 return MEDFileMesh::New(fileName);
496 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
498 return MEDFileMesh::New(fileName,mName,dt,it);
501 std::string __str__() const throw(INTERP_KERNEL::Exception)
503 return self->simpleRepr();
506 PyObject *getTime() throw(INTERP_KERNEL::Exception)
509 double tmp0=self->getTime(tmp1,tmp2);
510 PyObject *res = PyList_New(3);
511 PyList_SetItem(res,0,SWIG_From_int(tmp1));
512 PyList_SetItem(res,1,SWIG_From_int(tmp2));
513 PyList_SetItem(res,2,SWIG_From_double(tmp0));
517 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
520 bool ret0=self->isEqual(other,eps,what);
521 PyObject *res=PyList_New(2);
522 PyObject *ret0Py=ret0?Py_True:Py_False;
524 PyList_SetItem(res,0,ret0Py);
525 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
529 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
532 bool ret0=self->areFamsEqual(other,what);
533 PyObject *res=PyList_New(2);
534 PyObject *ret0Py=ret0?Py_True:Py_False;
536 PyList_SetItem(res,0,ret0Py);
537 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
541 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
544 bool ret0=self->areGrpsEqual(other,what);
545 PyObject *res=PyList_New(2);
546 PyObject *ret0Py=ret0?Py_True:Py_False;
548 PyList_SetItem(res,0,ret0Py);
549 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
553 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
555 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
558 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
561 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
563 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
566 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
569 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
571 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
574 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
577 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
580 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
581 PyObject *ret=PyTuple_New(2);
582 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
583 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
587 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
589 DataArrayInt *ret3=0;
590 std::vector<int> ret1,ret2;
591 bool ret0=self->unPolyze(ret1,ret2,ret3);
592 PyObject *ret=PyTuple_New(4);
593 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
595 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
596 for(int j=0;j<(int)ret1.size()/3;j++)
598 PyObject *retLev2=PyList_New(3);
599 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
600 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
601 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
602 PyList_SetItem(retLev1_0,j,retLev2);
604 PyTuple_SetItem(ret,1,retLev1_0);
606 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
607 for(int j=0;j<(int)ret2.size()/3;j++)
609 PyObject *retLev2=PyList_New(3);
610 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
611 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
612 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
613 PyList_SetItem(retLev1_1,j,retLev2);
615 PyTuple_SetItem(ret,2,retLev1_1);
617 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
623 class MEDFileUMesh : public MEDFileMesh
626 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
627 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
628 static MEDFileUMesh *New();
630 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
632 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
633 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
634 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
635 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
636 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
637 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
638 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
639 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
640 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
641 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
642 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
643 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
644 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
645 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
646 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
647 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
648 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
649 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
650 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
651 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
652 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
653 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
654 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
655 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
656 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
657 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
659 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
660 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
661 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
662 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
663 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
664 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
665 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
666 void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false) throw(INTERP_KERNEL::Exception);
667 void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
668 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
669 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
672 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
674 return MEDFileUMesh::New(fileName,mName,dt,it);
677 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
679 return MEDFileUMesh::New(fileName);
684 return MEDFileUMesh::New();
687 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
689 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
692 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
695 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
697 std::vector<const DataArrayInt *> grps;
698 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
699 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
702 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
704 DataArrayDouble *ret=self->getCoords();
710 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
712 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
713 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
714 PyObject *ret=PyTuple_New(3);
715 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
716 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
717 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
723 class MEDFileStructuredMesh : public MEDFileMesh
727 class MEDFileCMesh : public MEDFileStructuredMesh
730 static MEDFileCMesh *New();
731 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
732 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
733 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
738 return MEDFileCMesh::New();
741 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
743 return MEDFileCMesh::New(fileName);
746 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
748 return MEDFileCMesh::New(fileName,mName,dt,it);
751 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
753 const MEDCouplingCMesh *tmp=self->getMesh();
756 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
761 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
764 static MEDFileCurveLinearMesh *New();
765 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
766 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
767 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
770 MEDFileCurveLinearMesh()
772 return MEDFileCurveLinearMesh::New();
775 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
777 return MEDFileCurveLinearMesh::New(fileName);
780 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
782 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
785 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
787 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
790 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
795 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
798 static MEDFileMeshMultiTS *New();
799 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
800 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
801 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
802 const char *getName() const throw(INTERP_KERNEL::Exception);
803 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
804 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
809 return MEDFileMeshMultiTS::New();
812 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
814 return MEDFileMeshMultiTS::New(fileName);
817 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
819 return MEDFileMeshMultiTS::New(fileName,mName);
822 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
824 MEDFileMesh *ret=self->getOneTimeStep();
832 class MEDFileMeshesIterator
837 PyObject *next() throw(INTERP_KERNEL::Exception)
839 MEDFileMesh *ret=self->nextt();
843 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
847 PyErr_SetString(PyExc_StopIteration,"No more data.");
854 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
857 static MEDFileMeshes *New();
858 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
859 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
860 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
861 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
862 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
864 void resize(int newSize) throw(INTERP_KERNEL::Exception);
865 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
866 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
867 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
872 return MEDFileMeshes::New();
875 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
877 return MEDFileMeshes::New(fileName);
880 std::string __str__() const throw(INTERP_KERNEL::Exception)
882 return self->simpleRepr();
885 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
889 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
894 else if(PyString_Check(obj))
896 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
902 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
905 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
907 self->setMeshAtPos(obj,mesh);
911 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
913 return self->iterator();
916 int __len__() const throw(INTERP_KERNEL::Exception)
918 return self->getNumberOfMeshes();
921 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
923 MEDFileMesh *ret=self->getMeshAtPos(i);
928 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
930 MEDFileMesh *ret=self->getMeshWithName(mname);
938 class MEDFileFieldLoc : public RefCountObject
941 const std::string& getName() const;
942 int getDimension() const;
943 int getNumberOfGaussPoints() const;
944 int getNumberOfPointsInCells() const;
945 const std::vector<double>& getRefCoords() const;
946 const std::vector<double>& getGaussCoords() const;
947 const std::vector<double>& getGaussWeights() const;
948 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
951 std::string __str__() const throw(INTERP_KERNEL::Exception)
958 class MEDFileFieldGlobsReal
962 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
963 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
964 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
965 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
966 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
967 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
968 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
969 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
970 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
971 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
972 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
973 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
974 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
975 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
976 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
977 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
978 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
979 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
980 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
981 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
982 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
983 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
984 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
985 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
986 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
987 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
990 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
992 const DataArrayInt *ret=self->getProfile(pflName);
995 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
998 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1000 const DataArrayInt *ret=self->getProfileFromId(pflId);
1003 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1006 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1008 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1011 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1014 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1016 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1019 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1022 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1024 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1025 return convertVecPairVecStToPy(ret);
1028 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1030 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1031 return convertVecPairVecStToPy(ret);
1034 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1036 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1037 self->changePflsNames(v);
1040 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1042 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1043 self->changePflsRefsNamesGen(v);
1046 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1048 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1049 self->changePflsNamesInStruct(v);
1052 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1054 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1055 self->changeLocsNames(v);
1058 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1060 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1061 self->changeLocsRefsNamesGen(v);
1064 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1066 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1067 self->changeLocsNamesInStruct(v);
1070 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1072 std::ostringstream oss;
1073 self->simpleReprGlobs(oss);
1079 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1082 static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1083 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1084 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1085 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1086 int getDimension() const throw(INTERP_KERNEL::Exception);
1087 int getIteration() const throw(INTERP_KERNEL::Exception);
1088 int getOrder() const throw(INTERP_KERNEL::Exception);
1089 std::string getName() throw(INTERP_KERNEL::Exception);
1090 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1091 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1092 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1093 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1094 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1095 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1096 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1097 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1098 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1099 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1100 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1101 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1104 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1107 double tmp0=self->getTime(tmp1,tmp2);
1108 PyObject *res = PyList_New(3);
1109 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1110 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1111 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1115 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1117 std::pair<int,int> res=self->getDtIt();
1118 PyObject *elt=PyTuple_New(2);
1119 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1120 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1124 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1126 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1129 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1131 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1134 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1136 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1137 return self->changeMeshNames(modifTab);
1140 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1142 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1143 PyObject *ret2=PyList_New(ret.size());
1144 for(int i=0;i<(int)ret.size();i++)
1145 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1149 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1151 std::vector<int> ret1;
1152 int ret0=self->getNonEmptyLevels(mname,ret1);
1153 PyObject *elt=PyTuple_New(2);
1154 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1155 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1159 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1161 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1162 std::vector< std::vector<TypeOfField> > typesF;
1163 std::vector< std::vector<std::string> > pfls;
1164 std::vector< std::vector<std::string> > locs;
1165 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1167 PyObject *ret2=PyList_New(sz);
1168 for(int i=0;i<sz;i++)
1170 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1171 const std::vector<TypeOfField>& typesFI=typesF[i];
1172 const std::vector<std::string>& pflsI=pfls[i];
1173 const std::vector<std::string>& locsI=locs[i];
1174 PyObject *elt=PyTuple_New(2);
1175 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1176 int sz2=ret[i].size();
1177 PyObject *elt2=PyList_New(sz2);
1178 for(int j=0;j<sz2;j++)
1180 PyObject *elt3=PyTuple_New(4);
1181 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1182 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));
1183 PyTuple_SetItem(elt3,1,elt4);
1184 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1185 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1186 PyList_SetItem(elt2,j,elt3);
1188 PyTuple_SetItem(elt,1,elt2);
1189 PyList_SetItem(ret2,i,elt);
1194 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1196 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1197 std::size_t sz=ret.size();
1198 PyObject *retPy=PyList_New(sz);
1199 for(std::size_t i=0;i<sz;i++)
1200 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1206 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1209 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1210 static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1211 static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1212 static MEDFileField1TS *New();
1213 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1214 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1215 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1216 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1217 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1219 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1220 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1221 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1222 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1225 MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1227 return MEDFileField1TS::New(fileName);
1230 MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1232 return MEDFileField1TS::New(fileName,fieldName);
1235 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1237 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1242 return MEDFileField1TS::New();
1245 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1247 const DataArrayDouble *arr=0;
1249 arr=field->getArray();
1250 self->copyTinyInfoFrom(field,arr);
1253 std::string __str__() const throw(INTERP_KERNEL::Exception)
1255 return self->simpleRepr();
1258 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1260 DataArrayInt *ret1=0;
1261 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1262 PyObject *ret=PyTuple_New(2);
1263 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1264 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1268 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1270 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1271 std::vector< std::vector<TypeOfField> > typesF;
1272 std::vector< std::vector<std::string> > pfls;
1273 std::vector< std::vector<std::string> > locs;
1274 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1276 PyObject *ret2=PyList_New(sz);
1277 for(int i=0;i<sz;i++)
1279 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1280 const std::vector<TypeOfField>& typesFI=typesF[i];
1281 const std::vector<std::string>& pflsI=pfls[i];
1282 const std::vector<std::string>& locsI=locs[i];
1283 PyObject *elt=PyTuple_New(2);
1284 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1285 int sz2=ret[i].size();
1286 PyObject *elt2=PyList_New(sz2);
1287 for(int j=0;j<sz2;j++)
1289 PyObject *elt3=PyTuple_New(4);
1290 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1291 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1292 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1293 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1294 PyList_SetItem(elt2,j,elt3);
1296 PyTuple_SetItem(elt,1,elt2);
1297 PyList_SetItem(ret2,i,elt);
1302 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1304 DataArrayDouble *ret=self->getUndergroundDataArray();
1310 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1312 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1313 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1316 PyObject *ret=PyTuple_New(2);
1317 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1318 std::size_t sz=elt1Cpp.size();
1319 PyObject *elt=PyList_New(sz);
1320 for(std::size_t i=0;i<sz;i++)
1322 PyObject *elt1=PyTuple_New(2);
1323 PyObject *elt2=PyTuple_New(2);
1324 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1325 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1326 PyObject *elt3=PyTuple_New(2);
1327 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1328 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1329 PyTuple_SetItem(elt1,0,elt2);
1330 PyTuple_SetItem(elt1,1,elt3);
1331 PyList_SetItem(elt,i,elt1);
1333 PyTuple_SetItem(ret,1,elt);
1339 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1342 static MEDFileIntField1TS *New();
1343 static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1344 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1345 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1347 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1348 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1351 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1353 return MEDFileIntField1TS::New();
1356 MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1358 return MEDFileIntField1TS::New(fileName);
1361 MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1363 return MEDFileIntField1TS::New(fileName,fieldName);
1366 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1368 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order);
1371 std::string __str__() const throw(INTERP_KERNEL::Exception)
1373 return self->simpleRepr();
1376 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1378 DataArrayInt *ret1=0;
1379 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1380 PyObject *ret=PyTuple_New(2);
1381 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1382 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1386 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1388 DataArrayInt *ret1=0;
1389 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1390 PyObject *ret=PyTuple_New(2);
1391 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1392 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1396 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1398 DataArrayInt *ret1=0;
1399 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1400 PyObject *ret=PyTuple_New(2);
1401 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1402 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1406 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1408 DataArrayInt *ret1=0;
1409 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1410 PyObject *ret=PyTuple_New(2);
1411 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1412 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1416 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1418 DataArrayInt *ret1=0;
1419 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1420 PyObject *ret=PyTuple_New(2);
1421 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1422 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1426 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1428 DataArrayInt *ret1=0;
1429 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1430 PyObject *ret=PyTuple_New(2);
1431 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1432 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1436 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1438 DataArrayInt *ret=self->getUndergroundDataArray();
1446 class MEDFileAnyTypeFieldMultiTSIterator
1451 PyObject *next() throw(INTERP_KERNEL::Exception)
1453 MEDFileAnyTypeField1TS *ret=self->nextt();
1455 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1458 PyErr_SetString(PyExc_StopIteration,"No more data.");
1465 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1468 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1469 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1470 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1471 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1472 std::string getName() const throw(INTERP_KERNEL::Exception);
1473 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1474 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1475 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1476 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1477 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1478 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1479 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1480 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1481 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1482 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1483 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1484 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1486 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1487 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1488 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1489 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1490 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1493 int __len__() const throw(INTERP_KERNEL::Exception)
1495 return self->getNumberOfTS();
1498 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1500 if(elt0 && PyInt_Check(elt0))
1502 int pos=PyInt_AS_LONG(elt0);
1505 else if(elt0 && PyTuple_Check(elt0))
1507 if(PyTuple_Size(elt0)==2)
1509 PyObject *o0=PyTuple_GetItem(elt0,0);
1510 PyObject *o1=PyTuple_GetItem(elt0,1);
1511 if(PyInt_Check(o0) && PyInt_Check(o1))
1513 int iter=PyInt_AS_LONG(o0);
1514 int order=PyInt_AS_LONG(o1);
1515 return self->getPosOfTimeStep(iter,order);
1518 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1521 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1523 else if(elt0 && PyFloat_Check(elt0))
1525 double val=PyFloat_AS_DOUBLE(elt0);
1526 return self->getPosGivenTime(val);
1529 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1532 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1534 std::vector< std::pair<int,int> > res=self->getIterations();
1535 PyObject *ret=PyList_New(res.size());
1537 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1539 PyObject *elt=PyTuple_New(2);
1540 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1541 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1542 PyList_SetItem(ret,rk,elt);
1547 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1549 std::vector<double> ret1;
1550 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1551 std::size_t sz=ret.size();
1552 PyObject *ret2=PyList_New(sz);
1553 for(std::size_t i=0;i<sz;i++)
1555 PyObject *elt=PyTuple_New(3);
1556 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1557 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1558 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1559 PyList_SetItem(ret2,i,elt);
1564 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1566 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1567 PyObject *ret2=PyList_New(ret.size());
1568 for(int i=0;i<(int)ret.size();i++)
1570 const std::vector<TypeOfField>& rett=ret[i];
1571 PyObject *ret3=PyList_New(rett.size());
1572 for(int j=0;j<(int)rett.size();j++)
1573 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1574 PyList_SetItem(ret2,i,ret3);
1579 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1581 std::vector<int> ret1;
1582 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1583 PyObject *elt=PyTuple_New(2);
1584 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1585 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1589 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1591 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1592 std::vector< std::vector<TypeOfField> > typesF;
1593 std::vector< std::vector<std::string> > pfls;
1594 std::vector< std::vector<std::string> > locs;
1595 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1597 PyObject *ret2=PyList_New(sz);
1598 for(int i=0;i<sz;i++)
1600 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1601 const std::vector<TypeOfField>& typesFI=typesF[i];
1602 const std::vector<std::string>& pflsI=pfls[i];
1603 const std::vector<std::string>& locsI=locs[i];
1604 PyObject *elt=PyTuple_New(2);
1605 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1606 int sz2=ret[i].size();
1607 PyObject *elt2=PyList_New(sz2);
1608 for(int j=0;j<sz2;j++)
1610 PyObject *elt3=PyTuple_New(4);
1611 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1612 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));
1613 PyTuple_SetItem(elt3,1,elt4);
1614 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1615 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1616 PyList_SetItem(elt2,j,elt3);
1618 PyTuple_SetItem(elt,1,elt2);
1619 PyList_SetItem(ret2,i,elt);
1624 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1626 if(PyList_Check(elts))
1628 int sz=PyList_Size(elts);
1629 std::vector<int> ret(sz);
1630 for(int i=0;i<sz;i++)
1632 PyObject *elt=PyList_GetItem(elts,i);
1633 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1639 std::vector<int> ret(1);
1640 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1645 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1647 if(PySlice_Check(elts))
1649 Py_ssize_t strt=2,stp=2,step=2;
1650 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1651 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1653 self->eraseTimeStepIds2(strt,stp,step);
1656 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1660 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1661 if(!idsToRemove.empty())
1662 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1666 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1670 std::vector<int> pos2;
1671 DataArrayInt *pos3=0;
1672 DataArrayIntTuple *pos4=0;
1673 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1678 self->eraseTimeStepIds(&pos1,&pos1+1);
1685 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1690 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1694 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1698 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1700 return self->iterator();
1703 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1705 if(elt0 && PyList_Check(elt0))
1707 int sz=PyList_Size(elt0);
1708 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1709 int *pt=da->getPointer();
1710 for(int i=0;i<sz;i++,pt++)
1712 PyObject *elt1=PyList_GetItem(elt0,i);
1713 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1715 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1717 else if(elt0 && PySlice_Check(elt0))
1719 Py_ssize_t strt=2,stp=2,step=2;
1720 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1721 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1722 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1724 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1727 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1730 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1732 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1733 return self->changeMeshNames(modifTab);
1736 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1738 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1739 std::size_t sz=ret.size();
1740 PyObject *retPy=PyList_New(sz);
1741 for(std::size_t i=0;i<sz;i++)
1742 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1746 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1748 std::vector<MEDFileAnyTypeField1TS *> tmp;
1749 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1750 self->pushBackTimeSteps(tmp);
1755 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1758 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1759 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1760 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1762 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1763 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1764 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1765 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1766 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1768 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1769 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1772 MEDFileFieldMultiTS()
1774 return MEDFileFieldMultiTS::New();
1777 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1779 return MEDFileFieldMultiTS::New(fileName);
1782 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1784 return MEDFileFieldMultiTS::New(fileName,fieldName);
1787 std::string __str__() const throw(INTERP_KERNEL::Exception)
1789 return self->simpleRepr();
1792 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1794 DataArrayInt *ret1=0;
1795 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1796 PyObject *ret=PyTuple_New(2);
1797 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1798 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1802 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1804 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1805 std::vector< std::vector<TypeOfField> > typesF;
1806 std::vector< std::vector<std::string> > pfls;
1807 std::vector< std::vector<std::string> > locs;
1808 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1810 PyObject *ret2=PyList_New(sz);
1811 for(int i=0;i<sz;i++)
1813 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1814 const std::vector<TypeOfField>& typesFI=typesF[i];
1815 const std::vector<std::string>& pflsI=pfls[i];
1816 const std::vector<std::string>& locsI=locs[i];
1817 PyObject *elt=PyTuple_New(2);
1818 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1819 int sz2=ret[i].size();
1820 PyObject *elt2=PyList_New(sz2);
1821 for(int j=0;j<sz2;j++)
1823 PyObject *elt3=PyTuple_New(4);
1824 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1825 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1826 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1827 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1828 PyList_SetItem(elt2,j,elt3);
1830 PyTuple_SetItem(elt,1,elt2);
1831 PyList_SetItem(ret2,i,elt);
1835 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1837 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1843 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1845 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1846 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1849 PyObject *ret=PyTuple_New(2);
1850 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1851 std::size_t sz=elt1Cpp.size();
1852 PyObject *elt=PyList_New(sz);
1853 for(std::size_t i=0;i<sz;i++)
1855 PyObject *elt1=PyTuple_New(2);
1856 PyObject *elt2=PyTuple_New(2);
1857 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1858 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1859 PyObject *elt3=PyTuple_New(2);
1860 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1861 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1862 PyTuple_SetItem(elt1,0,elt2);
1863 PyTuple_SetItem(elt1,1,elt3);
1864 PyList_SetItem(elt,i,elt1);
1866 PyTuple_SetItem(ret,1,elt);
1872 class MEDFileFieldsIterator
1877 PyObject *next() throw(INTERP_KERNEL::Exception)
1879 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1881 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1884 PyErr_SetString(PyExc_StopIteration,"No more data.");
1891 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1894 static MEDFileIntFieldMultiTS *New();
1895 static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1896 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1898 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1899 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1902 MEDFileIntFieldMultiTS()
1904 return MEDFileIntFieldMultiTS::New();
1907 MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1909 return MEDFileIntFieldMultiTS::New(fileName);
1912 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1914 return MEDFileIntFieldMultiTS::New(fileName,fieldName);
1917 std::string __str__() const throw(INTERP_KERNEL::Exception)
1919 return self->simpleRepr();
1922 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1924 DataArrayInt *ret1=0;
1925 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1926 PyObject *ret=PyTuple_New(2);
1927 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1928 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1932 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1934 DataArrayInt *ret1=0;
1935 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1936 PyObject *ret=PyTuple_New(2);
1937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1938 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1942 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1944 DataArrayInt *ret1=0;
1945 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1946 PyObject *ret=PyTuple_New(2);
1947 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1948 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1952 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1954 DataArrayInt *ret1=0;
1955 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1956 PyObject *ret=PyTuple_New(2);
1957 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1958 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1962 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1964 DataArrayInt *ret1=0;
1965 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1966 PyObject *ret=PyTuple_New(2);
1967 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1968 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1972 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1974 DataArrayInt *ret1=0;
1975 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1976 PyObject *ret=PyTuple_New(2);
1977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1978 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1982 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1984 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
1992 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1995 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1996 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1997 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
1998 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
1999 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2000 int getNumberOfFields() const;
2001 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2002 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2004 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2005 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2006 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2007 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2008 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2009 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2010 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2011 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2016 return MEDFileFields::New();
2019 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
2021 return MEDFileFields::New(fileName);
2024 std::string __str__() const throw(INTERP_KERNEL::Exception)
2026 return self->simpleRepr();
2029 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2032 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2033 PyObject *ret=PyTuple_New(2);
2034 PyObject *ret_0=PyList_New(ret0.size());
2036 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2038 PyObject *elt=PyTuple_New(2);
2039 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2040 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2041 PyList_SetItem(ret_0,rk,elt);
2043 PyTuple_SetItem(ret,0,ret_0);
2044 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2045 PyTuple_SetItem(ret,1,ret_1);
2049 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2051 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2052 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2055 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2057 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2058 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2061 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2063 if(obj && PyList_Check(obj))
2065 int sz=PyList_Size(obj);
2066 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2067 int *pt=da->getPointer();
2068 for(int i=0;i<sz;i++,pt++)
2070 PyObject *elt1=PyList_GetItem(obj,i);
2071 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2073 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2076 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2079 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2081 self->setFieldAtPos(obj,field);
2085 int __len__() const throw(INTERP_KERNEL::Exception)
2087 return self->getNumberOfFields();
2090 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2092 return self->iterator();
2095 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2097 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2098 return self->changeMeshNames(modifTab);
2101 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2103 if(elt0 && PyInt_Check(elt0))
2105 return PyInt_AS_LONG(elt0);
2107 else if(elt0 && PyString_Check(elt0))
2108 return self->getPosFromFieldName(PyString_AsString(elt0));
2110 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2113 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2115 if(PyList_Check(elts))
2117 int sz=PyList_Size(elts);
2118 std::vector<int> ret(sz);
2119 for(int i=0;i<sz;i++)
2121 PyObject *elt=PyList_GetItem(elts,i);
2122 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2128 std::vector<int> ret(1);
2129 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2134 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2136 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2137 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2138 self->pushFields(tmp);
2141 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2143 if(elts && PySlice_Check(elts))
2145 Py_ssize_t strt=2,stp=2,step=2;
2146 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2147 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2148 self->destroyFieldsAtPos2(strt,stp,step);
2150 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2154 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2155 if(!idsToRemove.empty())
2156 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2162 class MEDFileParameter1TS : public RefCountObject
2165 void setIteration(int it);
2166 int getIteration() const;
2167 void setOrder(int order);
2168 int getOrder() const;
2169 void setTimeValue(double time);
2170 void setTime(int dt, int it, double time);
2171 double getTime(int& dt, int& it);
2172 double getTimeValue() const;
2175 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2178 void setValue(double val) throw(INTERP_KERNEL::Exception);
2179 double getValue() const throw(INTERP_KERNEL::Exception);
2180 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2183 std::string __str__() const throw(INTERP_KERNEL::Exception)
2185 return self->simpleRepr();
2190 class MEDFileParameterTinyInfo : public MEDFileWritable
2193 void setDescription(const char *name);
2194 const char *getDescription() const;
2195 void setTimeUnit(const char *unit);
2196 const char *getTimeUnit() const;
2199 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2202 static MEDFileParameterDouble1TS *New();
2203 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2204 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2205 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2206 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2207 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2208 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2209 const char *getName() const throw(INTERP_KERNEL::Exception);
2210 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2213 MEDFileParameterDouble1TS()
2215 return MEDFileParameterDouble1TS::New();
2218 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2220 return MEDFileParameterDouble1TS::New(fileName);
2223 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2225 return MEDFileParameterDouble1TS::New(fileName,paramName);
2228 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2230 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2233 std::string __str__() const throw(INTERP_KERNEL::Exception)
2235 return self->simpleRepr();
2238 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2241 bool ret0=self->isEqual(other,eps,what);
2242 PyObject *res=PyList_New(2);
2243 PyObject *ret0Py=ret0?Py_True:Py_False;
2245 PyList_SetItem(res,0,ret0Py);
2246 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2252 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2255 static MEDFileParameterMultiTS *New();
2256 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2257 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2258 const char *getName() const;
2259 void setName(const char *name);
2260 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2261 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2262 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2263 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2264 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2265 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2266 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2269 MEDFileParameterMultiTS()
2271 return MEDFileParameterMultiTS::New();
2274 MEDFileParameterMultiTS(const char *fileName)
2276 return MEDFileParameterMultiTS::New(fileName);
2279 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2281 return MEDFileParameterMultiTS::New(fileName,paramName);
2284 std::string __str__() const throw(INTERP_KERNEL::Exception)
2286 return self->simpleRepr();
2289 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2292 bool ret0=self->isEqual(other,eps,what);
2293 PyObject *res=PyList_New(2);
2294 PyObject *ret0Py=ret0?Py_True:Py_False;
2296 PyList_SetItem(res,0,ret0Py);
2297 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2301 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2305 std::vector<int> pos2;
2306 DataArrayInt *pos3=0;
2307 DataArrayIntTuple *pos4=0;
2308 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2313 self->eraseTimeStepIds(&pos1,&pos1+1);
2320 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2325 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2329 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2333 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2335 if(elt0 && PyInt_Check(elt0))
2337 int pos=PyInt_AS_LONG(elt0);
2340 else if(elt0 && PyTuple_Check(elt0))
2342 if(PyTuple_Size(elt0)==2)
2344 PyObject *o0=PyTuple_GetItem(elt0,0);
2345 PyObject *o1=PyTuple_GetItem(elt0,1);
2346 if(PyInt_Check(o0) && PyInt_Check(o1))
2348 int iter=PyInt_AS_LONG(o0);
2349 int order=PyInt_AS_LONG(o1);
2350 return self->getPosOfTimeStep(iter,order);
2353 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 !");
2356 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 !");
2358 else if(elt0 && PyFloat_Check(elt0))
2360 double val=PyFloat_AS_DOUBLE(elt0);
2361 return self->getPosGivenTime(val);
2364 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2367 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2369 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2375 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2377 if(PyList_Check(elts))
2379 int sz=PyList_Size(elts);
2380 std::vector<int> ret(sz);
2381 for(int i=0;i<sz;i++)
2383 PyObject *elt=PyList_GetItem(elts,i);
2384 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2390 std::vector<int> ret(1);
2391 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2396 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2398 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2399 if(!idsToRemove.empty())
2400 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2403 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2405 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2411 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2413 std::vector< std::pair<int,int> > res=self->getIterations();
2414 PyObject *ret=PyList_New(res.size());
2416 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2418 PyObject *elt=PyTuple_New(2);
2419 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2420 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2421 PyList_SetItem(ret,rk,elt);
2426 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2428 std::vector<double> res2;
2429 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2430 PyObject *ret=PyList_New(res.size());
2432 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2434 PyObject *elt=PyTuple_New(3);
2435 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2436 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2437 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2438 PyList_SetItem(ret,rk,elt);
2445 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2448 static MEDFileParameters *New();
2449 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2450 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2451 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2452 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2453 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2454 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2455 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2456 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2457 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2458 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2459 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2464 return MEDFileParameters::New();
2467 MEDFileParameters(const char *fileName)
2469 return MEDFileParameters::New(fileName);
2472 std::string __str__() const throw(INTERP_KERNEL::Exception)
2474 return self->simpleRepr();
2477 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2479 if(PyInt_Check(obj))
2481 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2486 else if(PyString_Check(obj))
2488 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2494 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2497 int __len__() const throw(INTERP_KERNEL::Exception)
2499 return self->getNumberOfParams();
2502 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2504 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2510 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2512 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2518 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2521 bool ret0=self->isEqual(other,eps,what);
2522 PyObject *res=PyList_New(2);
2523 PyObject *ret0Py=ret0?Py_True:Py_False;
2525 PyList_SetItem(res,0,ret0Py);
2526 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2532 class MEDFileData : public RefCountObject, public MEDFileWritable
2535 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2536 static MEDFileData *New();
2537 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2538 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2539 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2540 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2541 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2542 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2543 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2545 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2546 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2548 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2551 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2553 return MEDFileData::New(fileName);
2558 return MEDFileData::New();
2561 std::string __str__() const throw(INTERP_KERNEL::Exception)
2563 return self->simpleRepr();
2566 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2568 MEDFileMeshes *ret=self->getMeshes();
2574 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2576 MEDFileParameters *ret=self->getParams();
2582 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2584 MEDFileFields *ret=self->getFields();
2590 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2592 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2593 return self->changeMeshNames(modifTab);
2598 class SauvReader : public RefCountObject
2601 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2602 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2605 class SauvWriter : public RefCountObject
2608 static SauvWriter * New();
2609 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2610 void write(const char* fileName) throw(INTERP_KERNEL::Exception);