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 optimizeFamilies() throw(INTERP_KERNEL::Exception);
667 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
670 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
672 return MEDFileUMesh::New(fileName,mName,dt,it);
675 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
677 return MEDFileUMesh::New(fileName);
682 return MEDFileUMesh::New();
685 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
687 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
690 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
693 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
695 std::vector<const DataArrayInt *> grps;
696 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
697 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
700 void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
702 std::vector<const MEDCouplingUMesh *> ms;
703 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
704 self->setMeshes(ms,renum);
707 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
709 std::vector<const MEDCouplingUMesh *> ms;
710 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
711 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
714 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
716 std::vector<const MEDCouplingUMesh *> ms;
717 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
718 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
721 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
723 DataArrayDouble *ret=self->getCoords();
729 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
731 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
732 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
733 PyObject *ret=PyTuple_New(3);
734 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
735 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
736 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
742 class MEDFileStructuredMesh : public MEDFileMesh
746 class MEDFileCMesh : public MEDFileStructuredMesh
749 static MEDFileCMesh *New();
750 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
751 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
752 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
757 return MEDFileCMesh::New();
760 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
762 return MEDFileCMesh::New(fileName);
765 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
767 return MEDFileCMesh::New(fileName,mName,dt,it);
770 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
772 const MEDCouplingCMesh *tmp=self->getMesh();
775 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
780 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
783 static MEDFileCurveLinearMesh *New();
784 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
785 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
786 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
789 MEDFileCurveLinearMesh()
791 return MEDFileCurveLinearMesh::New();
794 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
796 return MEDFileCurveLinearMesh::New(fileName);
799 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
801 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
804 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
806 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
809 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
814 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
817 static MEDFileMeshMultiTS *New();
818 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
819 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
820 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
821 const char *getName() const throw(INTERP_KERNEL::Exception);
822 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
823 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
828 return MEDFileMeshMultiTS::New();
831 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
833 return MEDFileMeshMultiTS::New(fileName);
836 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
838 return MEDFileMeshMultiTS::New(fileName,mName);
841 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
843 MEDFileMesh *ret=self->getOneTimeStep();
851 class MEDFileMeshesIterator
856 PyObject *next() throw(INTERP_KERNEL::Exception)
858 MEDFileMesh *ret=self->nextt();
862 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
866 PyErr_SetString(PyExc_StopIteration,"No more data.");
873 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
876 static MEDFileMeshes *New();
877 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
878 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
879 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
880 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
881 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
883 void resize(int newSize) throw(INTERP_KERNEL::Exception);
884 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
885 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
886 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
891 return MEDFileMeshes::New();
894 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
896 return MEDFileMeshes::New(fileName);
899 std::string __str__() const throw(INTERP_KERNEL::Exception)
901 return self->simpleRepr();
904 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
908 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
913 else if(PyString_Check(obj))
915 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
921 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
924 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
926 self->setMeshAtPos(obj,mesh);
930 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
932 return self->iterator();
935 int __len__() const throw(INTERP_KERNEL::Exception)
937 return self->getNumberOfMeshes();
940 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
942 MEDFileMesh *ret=self->getMeshAtPos(i);
947 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
949 MEDFileMesh *ret=self->getMeshWithName(mname);
957 class MEDFileFieldLoc : public RefCountObject
960 const std::string& getName() const;
961 int getDimension() const;
962 int getNumberOfGaussPoints() const;
963 int getNumberOfPointsInCells() const;
964 const std::vector<double>& getRefCoords() const;
965 const std::vector<double>& getGaussCoords() const;
966 const std::vector<double>& getGaussWeights() const;
967 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
970 std::string __str__() const throw(INTERP_KERNEL::Exception)
977 class MEDFileFieldGlobsReal
981 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
982 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
983 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
984 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
985 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
986 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
987 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
988 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
989 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
990 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
991 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
992 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
993 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
994 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
995 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
996 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
997 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
998 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
999 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1000 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1001 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1002 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1003 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1004 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1005 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1006 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
1009 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
1011 const DataArrayInt *ret=self->getProfile(pflName);
1014 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1017 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1019 const DataArrayInt *ret=self->getProfileFromId(pflId);
1022 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1025 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1027 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1030 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1033 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1035 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1038 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1041 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1043 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1044 return convertVecPairVecStToPy(ret);
1047 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1049 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1050 return convertVecPairVecStToPy(ret);
1053 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1055 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1056 self->changePflsNames(v);
1059 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1061 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1062 self->changePflsRefsNamesGen(v);
1065 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1067 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1068 self->changePflsNamesInStruct(v);
1071 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1073 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1074 self->changeLocsNames(v);
1077 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1079 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1080 self->changeLocsRefsNamesGen(v);
1083 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1085 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1086 self->changeLocsNamesInStruct(v);
1089 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1091 std::ostringstream oss;
1092 self->simpleReprGlobs(oss);
1098 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1101 static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1102 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1103 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1104 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1105 int getDimension() const throw(INTERP_KERNEL::Exception);
1106 int getIteration() const throw(INTERP_KERNEL::Exception);
1107 int getOrder() const throw(INTERP_KERNEL::Exception);
1108 std::string getName() throw(INTERP_KERNEL::Exception);
1109 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1110 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1111 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1112 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1113 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1114 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1115 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1116 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1117 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1118 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1119 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1120 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1123 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1126 double tmp0=self->getTime(tmp1,tmp2);
1127 PyObject *res = PyList_New(3);
1128 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1129 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1130 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1134 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1136 std::pair<int,int> res=self->getDtIt();
1137 PyObject *elt=PyTuple_New(2);
1138 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1139 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1143 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1145 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1148 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1150 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1153 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1155 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1156 return self->changeMeshNames(modifTab);
1159 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1161 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1162 PyObject *ret2=PyList_New(ret.size());
1163 for(int i=0;i<(int)ret.size();i++)
1164 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1168 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1170 std::vector<int> ret1;
1171 int ret0=self->getNonEmptyLevels(mname,ret1);
1172 PyObject *elt=PyTuple_New(2);
1173 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1174 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1178 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1180 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1181 std::vector< std::vector<TypeOfField> > typesF;
1182 std::vector< std::vector<std::string> > pfls;
1183 std::vector< std::vector<std::string> > locs;
1184 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1186 PyObject *ret2=PyList_New(sz);
1187 for(int i=0;i<sz;i++)
1189 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1190 const std::vector<TypeOfField>& typesFI=typesF[i];
1191 const std::vector<std::string>& pflsI=pfls[i];
1192 const std::vector<std::string>& locsI=locs[i];
1193 PyObject *elt=PyTuple_New(2);
1194 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1195 int sz2=ret[i].size();
1196 PyObject *elt2=PyList_New(sz2);
1197 for(int j=0;j<sz2;j++)
1199 PyObject *elt3=PyTuple_New(4);
1200 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1201 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));
1202 PyTuple_SetItem(elt3,1,elt4);
1203 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1204 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1205 PyList_SetItem(elt2,j,elt3);
1207 PyTuple_SetItem(elt,1,elt2);
1208 PyList_SetItem(ret2,i,elt);
1213 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1215 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1216 std::size_t sz=ret.size();
1217 PyObject *retPy=PyList_New(sz);
1218 for(std::size_t i=0;i<sz;i++)
1219 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1225 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1228 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1229 static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1230 static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1231 static MEDFileField1TS *New();
1232 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1233 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1234 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1235 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1236 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1238 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1239 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1240 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1241 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1244 MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1246 return MEDFileField1TS::New(fileName);
1249 MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1251 return MEDFileField1TS::New(fileName,fieldName);
1254 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1256 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1261 return MEDFileField1TS::New();
1264 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1266 const DataArrayDouble *arr=0;
1268 arr=field->getArray();
1269 self->copyTinyInfoFrom(field,arr);
1272 std::string __str__() const throw(INTERP_KERNEL::Exception)
1274 return self->simpleRepr();
1277 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1279 DataArrayInt *ret1=0;
1280 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1281 PyObject *ret=PyTuple_New(2);
1282 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1283 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1287 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1289 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1290 std::vector< std::vector<TypeOfField> > typesF;
1291 std::vector< std::vector<std::string> > pfls;
1292 std::vector< std::vector<std::string> > locs;
1293 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1295 PyObject *ret2=PyList_New(sz);
1296 for(int i=0;i<sz;i++)
1298 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1299 const std::vector<TypeOfField>& typesFI=typesF[i];
1300 const std::vector<std::string>& pflsI=pfls[i];
1301 const std::vector<std::string>& locsI=locs[i];
1302 PyObject *elt=PyTuple_New(2);
1303 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1304 int sz2=ret[i].size();
1305 PyObject *elt2=PyList_New(sz2);
1306 for(int j=0;j<sz2;j++)
1308 PyObject *elt3=PyTuple_New(4);
1309 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1310 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1311 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1312 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1313 PyList_SetItem(elt2,j,elt3);
1315 PyTuple_SetItem(elt,1,elt2);
1316 PyList_SetItem(ret2,i,elt);
1321 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1323 DataArrayDouble *ret=self->getUndergroundDataArray();
1329 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1331 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1332 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1335 PyObject *ret=PyTuple_New(2);
1336 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1337 std::size_t sz=elt1Cpp.size();
1338 PyObject *elt=PyList_New(sz);
1339 for(std::size_t i=0;i<sz;i++)
1341 PyObject *elt1=PyTuple_New(2);
1342 PyObject *elt2=PyTuple_New(2);
1343 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1344 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1345 PyObject *elt3=PyTuple_New(2);
1346 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1347 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1348 PyTuple_SetItem(elt1,0,elt2);
1349 PyTuple_SetItem(elt1,1,elt3);
1350 PyList_SetItem(elt,i,elt1);
1352 PyTuple_SetItem(ret,1,elt);
1358 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1361 static MEDFileIntField1TS *New();
1362 static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1363 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1364 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1366 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1367 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1370 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1372 return MEDFileIntField1TS::New();
1375 MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1377 return MEDFileIntField1TS::New(fileName);
1380 MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1382 return MEDFileIntField1TS::New(fileName,fieldName);
1385 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1387 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order);
1390 std::string __str__() const throw(INTERP_KERNEL::Exception)
1392 return self->simpleRepr();
1395 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1397 DataArrayInt *ret1=0;
1398 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1399 PyObject *ret=PyTuple_New(2);
1400 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1401 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1405 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1407 DataArrayInt *ret1=0;
1408 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1409 PyObject *ret=PyTuple_New(2);
1410 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1411 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1415 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1417 DataArrayInt *ret1=0;
1418 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1419 PyObject *ret=PyTuple_New(2);
1420 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1421 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1425 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1427 DataArrayInt *ret1=0;
1428 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1429 PyObject *ret=PyTuple_New(2);
1430 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1431 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1435 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1437 DataArrayInt *ret1=0;
1438 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1439 PyObject *ret=PyTuple_New(2);
1440 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1441 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1445 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1447 DataArrayInt *ret1=0;
1448 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1449 PyObject *ret=PyTuple_New(2);
1450 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1451 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1455 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1457 DataArrayInt *ret=self->getUndergroundDataArray();
1465 class MEDFileAnyTypeFieldMultiTSIterator
1470 PyObject *next() throw(INTERP_KERNEL::Exception)
1472 MEDFileAnyTypeField1TS *ret=self->nextt();
1474 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1477 PyErr_SetString(PyExc_StopIteration,"No more data.");
1484 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1487 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1488 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1489 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1490 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1491 std::string getName() const throw(INTERP_KERNEL::Exception);
1492 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1493 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1494 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1495 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1496 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1497 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1498 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1499 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1500 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1501 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1502 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1503 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1505 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1506 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1507 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1508 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1509 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1512 int __len__() const throw(INTERP_KERNEL::Exception)
1514 return self->getNumberOfTS();
1517 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1519 if(elt0 && PyInt_Check(elt0))
1521 int pos=PyInt_AS_LONG(elt0);
1524 else if(elt0 && PyTuple_Check(elt0))
1526 if(PyTuple_Size(elt0)==2)
1528 PyObject *o0=PyTuple_GetItem(elt0,0);
1529 PyObject *o1=PyTuple_GetItem(elt0,1);
1530 if(PyInt_Check(o0) && PyInt_Check(o1))
1532 int iter=PyInt_AS_LONG(o0);
1533 int order=PyInt_AS_LONG(o1);
1534 return self->getPosOfTimeStep(iter,order);
1537 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 !");
1540 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 !");
1542 else if(elt0 && PyFloat_Check(elt0))
1544 double val=PyFloat_AS_DOUBLE(elt0);
1545 return self->getPosGivenTime(val);
1548 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1551 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1553 std::vector< std::pair<int,int> > res=self->getIterations();
1554 PyObject *ret=PyList_New(res.size());
1556 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1558 PyObject *elt=PyTuple_New(2);
1559 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1560 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1561 PyList_SetItem(ret,rk,elt);
1566 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1568 std::vector<double> ret1;
1569 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1570 std::size_t sz=ret.size();
1571 PyObject *ret2=PyList_New(sz);
1572 for(std::size_t i=0;i<sz;i++)
1574 PyObject *elt=PyTuple_New(3);
1575 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1576 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1577 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1578 PyList_SetItem(ret2,i,elt);
1583 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1585 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1586 PyObject *ret2=PyList_New(ret.size());
1587 for(int i=0;i<(int)ret.size();i++)
1589 const std::vector<TypeOfField>& rett=ret[i];
1590 PyObject *ret3=PyList_New(rett.size());
1591 for(int j=0;j<(int)rett.size();j++)
1592 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1593 PyList_SetItem(ret2,i,ret3);
1598 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1600 std::vector<int> ret1;
1601 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1602 PyObject *elt=PyTuple_New(2);
1603 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1604 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1608 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1610 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1611 std::vector< std::vector<TypeOfField> > typesF;
1612 std::vector< std::vector<std::string> > pfls;
1613 std::vector< std::vector<std::string> > locs;
1614 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1616 PyObject *ret2=PyList_New(sz);
1617 for(int i=0;i<sz;i++)
1619 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1620 const std::vector<TypeOfField>& typesFI=typesF[i];
1621 const std::vector<std::string>& pflsI=pfls[i];
1622 const std::vector<std::string>& locsI=locs[i];
1623 PyObject *elt=PyTuple_New(2);
1624 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1625 int sz2=ret[i].size();
1626 PyObject *elt2=PyList_New(sz2);
1627 for(int j=0;j<sz2;j++)
1629 PyObject *elt3=PyTuple_New(4);
1630 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1631 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));
1632 PyTuple_SetItem(elt3,1,elt4);
1633 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1634 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1635 PyList_SetItem(elt2,j,elt3);
1637 PyTuple_SetItem(elt,1,elt2);
1638 PyList_SetItem(ret2,i,elt);
1643 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1645 if(PyList_Check(elts))
1647 int sz=PyList_Size(elts);
1648 std::vector<int> ret(sz);
1649 for(int i=0;i<sz;i++)
1651 PyObject *elt=PyList_GetItem(elts,i);
1652 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1658 std::vector<int> ret(1);
1659 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1664 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1666 if(PySlice_Check(elts))
1668 Py_ssize_t strt=2,stp=2,step=2;
1669 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1670 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1672 self->eraseTimeStepIds2(strt,stp,step);
1675 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1679 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1680 if(!idsToRemove.empty())
1681 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1685 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1689 std::vector<int> pos2;
1690 DataArrayInt *pos3=0;
1691 DataArrayIntTuple *pos4=0;
1692 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1697 self->eraseTimeStepIds(&pos1,&pos1+1);
1704 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1709 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1713 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1717 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1719 return self->iterator();
1722 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1724 if(elt0 && PyList_Check(elt0))
1726 int sz=PyList_Size(elt0);
1727 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1728 int *pt=da->getPointer();
1729 for(int i=0;i<sz;i++,pt++)
1731 PyObject *elt1=PyList_GetItem(elt0,i);
1732 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1734 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1736 else if(elt0 && PySlice_Check(elt0))
1738 Py_ssize_t strt=2,stp=2,step=2;
1739 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1740 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1741 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1743 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1746 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1749 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1751 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1752 return self->changeMeshNames(modifTab);
1755 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1757 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1758 std::size_t sz=ret.size();
1759 PyObject *retPy=PyList_New(sz);
1760 for(std::size_t i=0;i<sz;i++)
1761 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1765 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1767 std::vector<MEDFileAnyTypeField1TS *> tmp;
1768 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1769 self->pushBackTimeSteps(tmp);
1774 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1777 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1778 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1779 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1781 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1782 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1783 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1784 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1785 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1787 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1788 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1791 MEDFileFieldMultiTS()
1793 return MEDFileFieldMultiTS::New();
1796 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1798 return MEDFileFieldMultiTS::New(fileName);
1801 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1803 return MEDFileFieldMultiTS::New(fileName,fieldName);
1806 std::string __str__() const throw(INTERP_KERNEL::Exception)
1808 return self->simpleRepr();
1811 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1813 DataArrayInt *ret1=0;
1814 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1815 PyObject *ret=PyTuple_New(2);
1816 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1817 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1821 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1823 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1824 std::vector< std::vector<TypeOfField> > typesF;
1825 std::vector< std::vector<std::string> > pfls;
1826 std::vector< std::vector<std::string> > locs;
1827 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1829 PyObject *ret2=PyList_New(sz);
1830 for(int i=0;i<sz;i++)
1832 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1833 const std::vector<TypeOfField>& typesFI=typesF[i];
1834 const std::vector<std::string>& pflsI=pfls[i];
1835 const std::vector<std::string>& locsI=locs[i];
1836 PyObject *elt=PyTuple_New(2);
1837 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1838 int sz2=ret[i].size();
1839 PyObject *elt2=PyList_New(sz2);
1840 for(int j=0;j<sz2;j++)
1842 PyObject *elt3=PyTuple_New(4);
1843 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1844 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1845 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1846 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1847 PyList_SetItem(elt2,j,elt3);
1849 PyTuple_SetItem(elt,1,elt2);
1850 PyList_SetItem(ret2,i,elt);
1854 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1856 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1862 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1864 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1865 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1868 PyObject *ret=PyTuple_New(2);
1869 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1870 std::size_t sz=elt1Cpp.size();
1871 PyObject *elt=PyList_New(sz);
1872 for(std::size_t i=0;i<sz;i++)
1874 PyObject *elt1=PyTuple_New(2);
1875 PyObject *elt2=PyTuple_New(2);
1876 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1877 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1878 PyObject *elt3=PyTuple_New(2);
1879 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1880 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1881 PyTuple_SetItem(elt1,0,elt2);
1882 PyTuple_SetItem(elt1,1,elt3);
1883 PyList_SetItem(elt,i,elt1);
1885 PyTuple_SetItem(ret,1,elt);
1891 class MEDFileFieldsIterator
1896 PyObject *next() throw(INTERP_KERNEL::Exception)
1898 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1900 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1903 PyErr_SetString(PyExc_StopIteration,"No more data.");
1910 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1913 static MEDFileIntFieldMultiTS *New();
1914 static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1915 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1917 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1918 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1921 MEDFileIntFieldMultiTS()
1923 return MEDFileIntFieldMultiTS::New();
1926 MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1928 return MEDFileIntFieldMultiTS::New(fileName);
1931 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1933 return MEDFileIntFieldMultiTS::New(fileName,fieldName);
1936 std::string __str__() const throw(INTERP_KERNEL::Exception)
1938 return self->simpleRepr();
1941 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1943 DataArrayInt *ret1=0;
1944 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1945 PyObject *ret=PyTuple_New(2);
1946 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1947 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1951 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1953 DataArrayInt *ret1=0;
1954 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1955 PyObject *ret=PyTuple_New(2);
1956 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1957 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1961 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1963 DataArrayInt *ret1=0;
1964 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1965 PyObject *ret=PyTuple_New(2);
1966 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1967 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1971 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1973 DataArrayInt *ret1=0;
1974 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1975 PyObject *ret=PyTuple_New(2);
1976 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1977 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1981 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1983 DataArrayInt *ret1=0;
1984 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1985 PyObject *ret=PyTuple_New(2);
1986 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1987 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1991 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1993 DataArrayInt *ret1=0;
1994 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1995 PyObject *ret=PyTuple_New(2);
1996 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1997 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2001 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2003 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2011 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2014 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2015 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2016 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2017 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2018 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2019 int getNumberOfFields() const;
2020 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2021 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2023 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2024 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2025 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2026 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2027 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2028 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2029 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2030 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2035 return MEDFileFields::New();
2038 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
2040 return MEDFileFields::New(fileName);
2043 std::string __str__() const throw(INTERP_KERNEL::Exception)
2045 return self->simpleRepr();
2048 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2051 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2052 PyObject *ret=PyTuple_New(2);
2053 PyObject *ret_0=PyList_New(ret0.size());
2055 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2057 PyObject *elt=PyTuple_New(2);
2058 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2059 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2060 PyList_SetItem(ret_0,rk,elt);
2062 PyTuple_SetItem(ret,0,ret_0);
2063 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2064 PyTuple_SetItem(ret,1,ret_1);
2068 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2070 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2071 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2074 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2076 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2077 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2080 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2082 if(obj && PyList_Check(obj))
2084 int sz=PyList_Size(obj);
2085 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2086 int *pt=da->getPointer();
2087 for(int i=0;i<sz;i++,pt++)
2089 PyObject *elt1=PyList_GetItem(obj,i);
2090 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2092 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2095 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2098 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2100 self->setFieldAtPos(obj,field);
2104 int __len__() const throw(INTERP_KERNEL::Exception)
2106 return self->getNumberOfFields();
2109 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2111 return self->iterator();
2114 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2116 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2117 return self->changeMeshNames(modifTab);
2120 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2122 if(elt0 && PyInt_Check(elt0))
2124 return PyInt_AS_LONG(elt0);
2126 else if(elt0 && PyString_Check(elt0))
2127 return self->getPosFromFieldName(PyString_AsString(elt0));
2129 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2132 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2134 if(PyList_Check(elts))
2136 int sz=PyList_Size(elts);
2137 std::vector<int> ret(sz);
2138 for(int i=0;i<sz;i++)
2140 PyObject *elt=PyList_GetItem(elts,i);
2141 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2147 std::vector<int> ret(1);
2148 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2153 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2155 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2156 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2157 self->pushFields(tmp);
2160 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2162 if(elts && PySlice_Check(elts))
2164 Py_ssize_t strt=2,stp=2,step=2;
2165 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2166 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2167 self->destroyFieldsAtPos2(strt,stp,step);
2169 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2173 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2174 if(!idsToRemove.empty())
2175 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2181 class MEDFileParameter1TS : public RefCountObject
2184 void setIteration(int it);
2185 int getIteration() const;
2186 void setOrder(int order);
2187 int getOrder() const;
2188 void setTimeValue(double time);
2189 void setTime(int dt, int it, double time);
2190 double getTime(int& dt, int& it);
2191 double getTimeValue() const;
2194 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2197 void setValue(double val) throw(INTERP_KERNEL::Exception);
2198 double getValue() const throw(INTERP_KERNEL::Exception);
2199 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2202 std::string __str__() const throw(INTERP_KERNEL::Exception)
2204 return self->simpleRepr();
2209 class MEDFileParameterTinyInfo : public MEDFileWritable
2212 void setDescription(const char *name);
2213 const char *getDescription() const;
2214 void setTimeUnit(const char *unit);
2215 const char *getTimeUnit() const;
2218 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2221 static MEDFileParameterDouble1TS *New();
2222 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2223 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2224 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2225 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2226 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2227 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2228 const char *getName() const throw(INTERP_KERNEL::Exception);
2229 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2232 MEDFileParameterDouble1TS()
2234 return MEDFileParameterDouble1TS::New();
2237 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2239 return MEDFileParameterDouble1TS::New(fileName);
2242 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2244 return MEDFileParameterDouble1TS::New(fileName,paramName);
2247 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2249 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2252 std::string __str__() const throw(INTERP_KERNEL::Exception)
2254 return self->simpleRepr();
2257 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2260 bool ret0=self->isEqual(other,eps,what);
2261 PyObject *res=PyList_New(2);
2262 PyObject *ret0Py=ret0?Py_True:Py_False;
2264 PyList_SetItem(res,0,ret0Py);
2265 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2271 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2274 static MEDFileParameterMultiTS *New();
2275 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2276 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2277 const char *getName() const;
2278 void setName(const char *name);
2279 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2280 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2281 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2282 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2283 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2284 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2285 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2288 MEDFileParameterMultiTS()
2290 return MEDFileParameterMultiTS::New();
2293 MEDFileParameterMultiTS(const char *fileName)
2295 return MEDFileParameterMultiTS::New(fileName);
2298 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2300 return MEDFileParameterMultiTS::New(fileName,paramName);
2303 std::string __str__() const throw(INTERP_KERNEL::Exception)
2305 return self->simpleRepr();
2308 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2311 bool ret0=self->isEqual(other,eps,what);
2312 PyObject *res=PyList_New(2);
2313 PyObject *ret0Py=ret0?Py_True:Py_False;
2315 PyList_SetItem(res,0,ret0Py);
2316 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2320 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2324 std::vector<int> pos2;
2325 DataArrayInt *pos3=0;
2326 DataArrayIntTuple *pos4=0;
2327 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2332 self->eraseTimeStepIds(&pos1,&pos1+1);
2339 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2344 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2348 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2352 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2354 if(elt0 && PyInt_Check(elt0))
2356 int pos=PyInt_AS_LONG(elt0);
2359 else if(elt0 && PyTuple_Check(elt0))
2361 if(PyTuple_Size(elt0)==2)
2363 PyObject *o0=PyTuple_GetItem(elt0,0);
2364 PyObject *o1=PyTuple_GetItem(elt0,1);
2365 if(PyInt_Check(o0) && PyInt_Check(o1))
2367 int iter=PyInt_AS_LONG(o0);
2368 int order=PyInt_AS_LONG(o1);
2369 return self->getPosOfTimeStep(iter,order);
2372 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 !");
2375 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 !");
2377 else if(elt0 && PyFloat_Check(elt0))
2379 double val=PyFloat_AS_DOUBLE(elt0);
2380 return self->getPosGivenTime(val);
2383 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2386 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2388 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2394 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2396 if(PyList_Check(elts))
2398 int sz=PyList_Size(elts);
2399 std::vector<int> ret(sz);
2400 for(int i=0;i<sz;i++)
2402 PyObject *elt=PyList_GetItem(elts,i);
2403 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2409 std::vector<int> ret(1);
2410 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2415 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2417 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2418 if(!idsToRemove.empty())
2419 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2422 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2424 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2430 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2432 std::vector< std::pair<int,int> > res=self->getIterations();
2433 PyObject *ret=PyList_New(res.size());
2435 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2437 PyObject *elt=PyTuple_New(2);
2438 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2439 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2440 PyList_SetItem(ret,rk,elt);
2445 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2447 std::vector<double> res2;
2448 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2449 PyObject *ret=PyList_New(res.size());
2451 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2453 PyObject *elt=PyTuple_New(3);
2454 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2455 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2456 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2457 PyList_SetItem(ret,rk,elt);
2464 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2467 static MEDFileParameters *New();
2468 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2469 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2470 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2471 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2472 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2473 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2474 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2475 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2476 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2477 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2478 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2483 return MEDFileParameters::New();
2486 MEDFileParameters(const char *fileName)
2488 return MEDFileParameters::New(fileName);
2491 std::string __str__() const throw(INTERP_KERNEL::Exception)
2493 return self->simpleRepr();
2496 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2498 if(PyInt_Check(obj))
2500 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2505 else if(PyString_Check(obj))
2507 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2513 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2516 int __len__() const throw(INTERP_KERNEL::Exception)
2518 return self->getNumberOfParams();
2521 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2523 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2529 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2531 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2537 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2540 bool ret0=self->isEqual(other,eps,what);
2541 PyObject *res=PyList_New(2);
2542 PyObject *ret0Py=ret0?Py_True:Py_False;
2544 PyList_SetItem(res,0,ret0Py);
2545 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2551 class MEDFileData : public RefCountObject, public MEDFileWritable
2554 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2555 static MEDFileData *New();
2556 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2557 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2558 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2559 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2560 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2561 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2562 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2564 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2565 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2567 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2570 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2572 return MEDFileData::New(fileName);
2577 return MEDFileData::New();
2580 std::string __str__() const throw(INTERP_KERNEL::Exception)
2582 return self->simpleRepr();
2585 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2587 MEDFileMeshes *ret=self->getMeshes();
2593 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2595 MEDFileParameters *ret=self->getParams();
2601 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2603 MEDFileFields *ret=self->getFields();
2609 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2611 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2612 return self->changeMeshNames(modifTab);
2617 class SauvReader : public RefCountObject
2620 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2621 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2624 class SauvWriter : public RefCountObject
2627 static SauvWriter * New();
2628 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2629 void write(const char* fileName) throw(INTERP_KERNEL::Exception);