1 // Copyright (C) 2007-2012 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 %newobject MEDLoader::ReadUMeshFromFamilies;
56 %newobject MEDLoader::ReadUMeshFromGroups;
57 %newobject MEDLoader::ReadUMeshFromFile;
58 %newobject MEDLoader::ReadField;
59 %newobject MEDLoader::ReadFieldCell;
60 %newobject MEDLoader::ReadFieldNode;
61 %newobject MEDLoader::ReadFieldGauss;
62 %newobject MEDLoader::ReadFieldGaussNE;
63 %newobject ParaMEDMEM::MEDFileMesh::New;
64 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
65 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
66 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
67 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
68 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
69 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
70 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
71 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
72 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
73 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
74 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
75 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
76 %newobject ParaMEDMEM::MEDFileUMesh::New;
77 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
78 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
79 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
80 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
81 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
82 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
83 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
84 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
85 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
86 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
87 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
88 %newobject ParaMEDMEM::MEDFileCMesh::New;
89 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
90 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
91 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
92 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
93 %newobject ParaMEDMEM::MEDFileMeshes::New;
94 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
95 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
96 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
97 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
98 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
100 %newobject ParaMEDMEM::MEDFileFields::New;
101 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
102 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
103 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
104 %newobject ParaMEDMEM::MEDFileFields::__getitem__;
105 %newobject ParaMEDMEM::MEDFileFields::__iter__;
106 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
107 %newobject ParaMEDMEM::MEDFileFieldMultiTS::deepCpy;
108 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
109 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
110 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
111 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
112 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
113 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
114 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
115 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
116 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
117 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
118 %newobject ParaMEDMEM::MEDFileField1TS::New;
119 %newobject ParaMEDMEM::MEDFileField1TS::deepCpy;
120 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
121 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
122 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
123 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
124 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
126 %newobject ParaMEDMEM::MEDFileData::New;
127 %newobject ParaMEDMEM::MEDFileData::deepCpy;
128 %newobject ParaMEDMEM::MEDFileData::getMeshes;
129 %newobject ParaMEDMEM::MEDFileData::getFields;
130 %newobject ParaMEDMEM::MEDFileData::getParams;
132 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
133 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
134 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
135 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
136 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
137 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
138 %newobject ParaMEDMEM::MEDFileParameters::New;
139 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
140 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
141 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
142 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
144 %newobject ParaMEDMEM::SauvWriter::New;
145 %newobject ParaMEDMEM::SauvReader::New;
146 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
148 %feature("unref") MEDFileMesh "$this->decrRef();"
149 %feature("unref") MEDFileUMesh "$this->decrRef();"
150 %feature("unref") MEDFileCMesh "$this->decrRef();"
151 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
152 %feature("unref") MEDFileMeshes "$this->decrRef();"
153 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
154 %feature("unref") MEDFileField1TS "$this->decrRef();"
155 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
156 %feature("unref") MEDFileFields "$this->decrRef();"
157 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
158 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
159 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
160 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
161 %feature("unref") MEDFileParameters "$this->decrRef();"
162 %feature("unref") MEDFileData "$this->decrRef();"
163 %feature("unref") SauvReader "$this->decrRef();"
164 %feature("unref") SauvWriter "$this->decrRef();"
169 static void setEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
170 static void setCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
171 static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
172 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
173 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
174 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
175 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
176 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
177 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
178 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
179 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
180 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
181 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
182 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
183 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
184 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
187 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
189 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
190 PyObject *ret=PyList_New(res.size());
192 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
194 PyObject *elt=PyTuple_New(2);
195 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
196 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
197 PyList_SetItem(ret,rk,elt);
202 static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
204 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
205 PyObject *ret=PyList_New(res.size());
207 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
209 PyObject *elt=PyTuple_New(3);
210 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
211 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
212 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
213 PyList_SetItem(ret,rk,elt);
218 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
220 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
221 PyObject *ret=PyList_New(res.size());
223 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
225 PyObject *elt=PyTuple_New(2);
226 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
227 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
228 PyList_SetItem(ret,rk,elt);
232 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
234 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
235 PyObject *ret=PyList_New(res.size());
237 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
239 PyObject *elt=PyTuple_New(2);
240 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
241 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
242 PyList_SetItem(ret,rk,elt);
246 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
248 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
249 PyObject *ret=PyList_New(res.size());
251 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
253 PyObject *elt=PyTuple_New(2);
254 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
255 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
256 PyList_SetItem(ret,rk,elt);
260 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
262 int meshDim,spaceDim,numberOfNodes;
263 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
264 PyObject *ret=PyTuple_New(4);
265 PyObject *elt0=PyList_New(res.size());
267 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
269 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
271 PyObject *elt1=PyList_New(obj2.size());
272 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
274 PyObject *elt2=PyTuple_New(2);
275 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
276 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
277 PyList_SetItem(elt1,j,elt2);
279 PyList_SetItem(elt0,i,elt1);
281 PyTuple_SetItem(ret,0,elt0);
282 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
283 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
284 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
287 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
288 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
290 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
291 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
292 return convertFieldDoubleVecToPy(res);
294 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
296 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
297 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
298 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
300 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
302 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
303 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
304 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
306 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
308 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
309 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
310 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
312 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
314 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
316 PyObject *ret=PyList_New(size);
317 for(int i=0;i<size;i++)
318 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
321 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
323 std::vector<std::string> grps;
324 converPyListToVecString(li,grps);
325 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
327 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
329 std::vector<std::string> fams;
330 converPyListToVecString(li,fams);
331 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
334 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
335 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
336 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
337 static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
338 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
339 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
340 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
341 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
342 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
343 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
344 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
345 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
346 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
351 class MEDFileWritable
354 void copyOptionsFrom(const MEDFileWritable& other) const;
355 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
356 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
357 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
358 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
361 class MEDFileMesh : public RefCountObject, public MEDFileWritable
364 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
365 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
366 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
367 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
368 virtual void clearNonDiscrAttributes() const;
369 void setName(const char *name);
370 const char *getName();
371 void setUnivName(const char *name);
372 const char *getUnivName() const;
373 void setDescription(const char *name);
374 const char *getDescription() const;
375 void setOrder(int order);
376 int getOrder() const;
377 void setIteration(int it);
379 void setTimeValue(double time);
380 void setTime(int dt, int it, double time);
381 double getTimeValue() const;
382 void setTimeUnit(const char *unit);
383 const char *getTimeUnit() const;
384 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
385 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
386 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
387 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
388 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
390 bool existsGroup(const char *groupName) const;
391 bool existsFamily(int famId) const;
392 bool existsFamily(const char *familyName) const;
393 void setFamilyId(const char *familyName, int id);
394 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
395 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
396 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
397 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
398 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
399 void copyFamGrpMapsFrom(const MEDFileMesh& other);
400 const std::map<std::string,int>& getFamilyInfo() const;
401 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
402 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
403 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
404 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
405 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
406 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
407 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
408 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
409 std::vector<std::string> getGroupsNames() const;
410 std::vector<std::string> getFamiliesNames() const;
411 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
412 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
413 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
414 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
415 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
416 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
417 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
418 void setFamilyInfo(const std::map<std::string,int>& info);
419 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
420 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
421 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
422 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
423 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
424 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
425 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
426 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
427 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
428 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
429 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
430 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
431 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
432 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
433 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
434 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
435 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
438 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
439 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
440 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
441 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
442 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
443 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
444 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
445 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
446 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
447 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
450 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
452 return MEDFileMesh::New(fileName);
455 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
457 return MEDFileMesh::New(fileName,mName,dt,it);
460 std::string __str__() const throw(INTERP_KERNEL::Exception)
462 return self->simpleRepr();
465 PyObject *getTime() throw(INTERP_KERNEL::Exception)
468 double tmp0=self->getTime(tmp1,tmp2);
469 PyObject *res = PyList_New(3);
470 PyList_SetItem(res,0,SWIG_From_int(tmp1));
471 PyList_SetItem(res,1,SWIG_From_int(tmp2));
472 PyList_SetItem(res,2,SWIG_From_double(tmp0));
476 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
479 bool ret0=self->isEqual(other,eps,what);
480 PyObject *res=PyList_New(2);
481 PyObject *ret0Py=ret0?Py_True:Py_False;
483 PyList_SetItem(res,0,ret0Py);
484 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
488 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
491 bool ret0=self->areFamsEqual(other,what);
492 PyObject *res=PyList_New(2);
493 PyObject *ret0Py=ret0?Py_True:Py_False;
495 PyList_SetItem(res,0,ret0Py);
496 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
500 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
503 bool ret0=self->areGrpsEqual(other,what);
504 PyObject *res=PyList_New(2);
505 PyObject *ret0Py=ret0?Py_True:Py_False;
507 PyList_SetItem(res,0,ret0Py);
508 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
512 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
514 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
517 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
520 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
522 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
525 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
528 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
531 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
532 PyObject *ret=PyTuple_New(2);
533 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
534 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
538 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
540 DataArrayInt *ret3=0;
541 std::vector<int> ret1,ret2;
542 bool ret0=self->unPolyze(ret1,ret2,ret3);
543 PyObject *ret=PyTuple_New(4);
544 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
546 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
547 for(int j=0;j<(int)ret1.size()/3;j++)
549 PyObject *retLev2=PyList_New(3);
550 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
551 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
552 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
553 PyList_SetItem(retLev1_0,j,retLev2);
555 PyTuple_SetItem(ret,1,retLev1_0);
557 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
558 for(int j=0;j<(int)ret2.size()/3;j++)
560 PyObject *retLev2=PyList_New(3);
561 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
562 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
563 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
564 PyList_SetItem(retLev1_1,j,retLev2);
566 PyTuple_SetItem(ret,2,retLev1_1);
568 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
574 class MEDFileUMesh : public MEDFileMesh
577 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
578 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
579 static MEDFileUMesh *New();
581 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
583 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
584 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
585 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
586 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
587 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
588 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
589 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
590 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
591 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
592 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
593 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
594 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
595 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
596 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
597 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
598 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
599 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
600 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
601 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
602 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
603 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
604 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
605 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
606 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
607 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
608 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
610 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
611 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
612 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
613 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
614 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
615 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
616 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
617 void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
618 void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
619 void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
620 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
621 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
624 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
626 return MEDFileUMesh::New(fileName,mName,dt,it);
629 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
631 return MEDFileUMesh::New(fileName);
636 return MEDFileUMesh::New();
639 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
641 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
644 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
647 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
649 std::vector<const DataArrayInt *> grps;
650 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
651 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
654 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
656 DataArrayDouble *ret=self->getCoords();
662 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
664 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
665 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
666 PyObject *ret=PyTuple_New(3);
667 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
668 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
669 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
675 class MEDFileStructuredMesh : public MEDFileMesh
679 class MEDFileCMesh : public MEDFileStructuredMesh
682 static MEDFileCMesh *New();
683 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
684 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
685 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
690 return MEDFileCMesh::New();
693 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
695 return MEDFileCMesh::New(fileName);
698 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
700 return MEDFileCMesh::New(fileName,mName,dt,it);
703 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
705 const MEDCouplingCMesh *tmp=self->getMesh();
708 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
713 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
716 static MEDFileCurveLinearMesh *New();
717 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
718 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
719 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
722 MEDFileCurveLinearMesh()
724 return MEDFileCurveLinearMesh::New();
727 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
729 return MEDFileCurveLinearMesh::New(fileName);
732 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
734 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
737 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
739 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
742 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
747 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
750 static MEDFileMeshMultiTS *New();
751 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
752 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
753 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
754 const char *getName() const throw(INTERP_KERNEL::Exception);
755 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
756 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
761 return MEDFileMeshMultiTS::New();
764 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
766 return MEDFileMeshMultiTS::New(fileName);
769 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
771 return MEDFileMeshMultiTS::New(fileName,mName);
774 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
776 MEDFileMesh *ret=self->getOneTimeStep();
784 class MEDFileMeshesIterator
789 PyObject *next() throw(INTERP_KERNEL::Exception)
791 MEDFileMesh *ret=self->nextt();
795 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
799 PyErr_SetString(PyExc_StopIteration,"No more data.");
806 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
809 static MEDFileMeshes *New();
810 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
811 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
812 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
813 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
814 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
816 void resize(int newSize) throw(INTERP_KERNEL::Exception);
817 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
818 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
819 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
824 return MEDFileMeshes::New();
827 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
829 return MEDFileMeshes::New(fileName);
832 std::string __str__() const throw(INTERP_KERNEL::Exception)
834 return self->simpleRepr();
837 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
841 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
846 else if(PyString_Check(obj))
848 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
854 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
857 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
859 self->setMeshAtPos(obj,mesh);
863 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
865 return self->iterator();
868 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
870 MEDFileMesh *ret=self->getMeshAtPos(i);
875 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
877 MEDFileMesh *ret=self->getMeshWithName(mname);
885 class MEDFileFieldLoc : public RefCountObject
888 const std::string& getName() const;
889 int getDimension() const;
890 int getNumberOfGaussPoints() const;
891 int getNumberOfPointsInCells() const;
892 const std::vector<double>& getRefCoords() const;
893 const std::vector<double>& getGaussCoords() const;
894 const std::vector<double>& getGaussWeights() const;
895 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
898 std::string __str__() const throw(INTERP_KERNEL::Exception)
905 class MEDFileFieldGlobsReal
908 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
909 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
910 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
911 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
912 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
913 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
914 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
915 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
916 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
917 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
918 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
919 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
920 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
921 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
922 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
923 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
924 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
925 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
926 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
927 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
930 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
932 const DataArrayInt *ret=self->getProfile(pflName);
935 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
938 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
940 const DataArrayInt *ret=self->getProfileFromId(pflId);
943 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
946 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
948 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
950 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
953 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
955 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
957 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
960 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
962 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
963 return convertVecPairVecStToPy(ret);
966 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
968 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
969 return convertVecPairVecStToPy(ret);
972 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
974 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
975 self->changePflsNames(v);
978 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
980 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
981 self->changePflsRefsNamesGen(v);
984 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
986 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
987 self->changePflsNamesInStruct(v);
990 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
992 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
993 self->changeLocsNames(v);
996 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
998 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
999 self->changeLocsRefsNamesGen(v);
1002 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1004 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1005 self->changeLocsNamesInStruct(v);
1010 class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1013 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1014 static MEDFileField1TS *New();
1015 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1016 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1017 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1018 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1019 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1020 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1022 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1023 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1024 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1025 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1026 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1027 MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1029 int getDimension() const throw(INTERP_KERNEL::Exception);
1030 int getIteration() const throw(INTERP_KERNEL::Exception);
1031 int getOrder() const throw(INTERP_KERNEL::Exception);
1032 std::string getName() throw(INTERP_KERNEL::Exception);
1033 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1034 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1035 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1036 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1037 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1038 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1039 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1042 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1044 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1049 return MEDFileField1TS::New();
1052 std::string __str__() const throw(INTERP_KERNEL::Exception)
1054 return self->simpleRepr();
1057 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1059 DataArrayInt *ret1=0;
1060 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1061 PyObject *ret=PyTuple_New(2);
1062 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1063 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1067 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1069 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1072 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1074 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1077 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1080 double tmp0=self->getTime(tmp1,tmp2);
1081 PyObject *res = PyList_New(3);
1082 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1083 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1084 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1088 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1090 std::pair<int,int> res=self->getDtIt();
1091 PyObject *elt=PyTuple_New(2);
1092 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1093 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1097 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1099 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1100 PyObject *ret2=PyList_New(ret.size());
1101 for(int i=0;i<(int)ret.size();i++)
1102 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1106 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1108 std::vector<int> ret1;
1109 int ret0=self->getNonEmptyLevels(mname,ret1);
1110 PyObject *elt=PyTuple_New(2);
1111 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1112 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1116 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1118 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1119 std::vector< std::vector<TypeOfField> > typesF;
1120 std::vector< std::vector<std::string> > pfls;
1121 std::vector< std::vector<std::string> > locs;
1122 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1124 PyObject *ret2=PyList_New(sz);
1125 for(int i=0;i<sz;i++)
1127 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1128 const std::vector<TypeOfField>& typesFI=typesF[i];
1129 const std::vector<std::string>& pflsI=pfls[i];
1130 const std::vector<std::string>& locsI=locs[i];
1131 PyObject *elt=PyTuple_New(2);
1132 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1133 int sz2=ret[i].size();
1134 PyObject *elt2=PyList_New(sz2);
1135 for(int j=0;j<sz2;j++)
1137 PyObject *elt3=PyTuple_New(4);
1138 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1139 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
1140 PyTuple_SetItem(elt3,1,elt4);
1141 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1142 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1143 PyList_SetItem(elt2,j,elt3);
1145 PyTuple_SetItem(elt,1,elt2);
1146 PyList_SetItem(ret2,i,elt);
1151 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1153 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1154 std::vector< std::vector<TypeOfField> > typesF;
1155 std::vector< std::vector<std::string> > pfls;
1156 std::vector< std::vector<std::string> > locs;
1157 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1159 PyObject *ret2=PyList_New(sz);
1160 for(int i=0;i<sz;i++)
1162 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1163 const std::vector<TypeOfField>& typesFI=typesF[i];
1164 const std::vector<std::string>& pflsI=pfls[i];
1165 const std::vector<std::string>& locsI=locs[i];
1166 PyObject *elt=PyTuple_New(2);
1167 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1168 int sz2=ret[i].size();
1169 PyObject *elt2=PyList_New(sz2);
1170 for(int j=0;j<sz2;j++)
1172 PyObject *elt3=PyTuple_New(4);
1173 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1174 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1175 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1176 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1177 PyList_SetItem(elt2,j,elt3);
1179 PyTuple_SetItem(elt,1,elt2);
1180 PyList_SetItem(ret2,i,elt);
1185 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1187 DataArrayDouble *ret=self->getUndergroundDataArray();
1193 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1195 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1196 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1199 PyObject *ret=PyTuple_New(2);
1200 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1201 std::size_t sz=elt1Cpp.size();
1202 PyObject *elt=PyList_New(sz);
1203 for(std::size_t i=0;i<sz;i++)
1205 PyObject *elt1=PyTuple_New(2);
1206 PyObject *elt2=PyTuple_New(2);
1207 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1208 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1209 PyObject *elt3=PyTuple_New(2);
1210 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1211 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1212 PyTuple_SetItem(elt1,0,elt2);
1213 PyTuple_SetItem(elt1,1,elt3);
1214 PyList_SetItem(elt,i,elt1);
1216 PyTuple_SetItem(ret,1,elt);
1220 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1222 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1223 return self->changeMeshNames(modifTab);
1228 class MEDFileFieldMultiTSIterator
1233 PyObject *next() throw(INTERP_KERNEL::Exception)
1235 MEDFileField1TS *ret=self->nextt();
1237 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1240 PyErr_SetString(PyExc_StopIteration,"No more data.");
1247 class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1250 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1251 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1252 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1253 MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1255 MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1256 MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1257 MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1259 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1260 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1261 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1262 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1263 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1264 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1266 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1267 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1269 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1270 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1271 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1272 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1273 std::string getName() const throw(INTERP_KERNEL::Exception);
1274 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1275 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1276 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1277 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1280 MEDFileFieldMultiTS()
1282 return MEDFileFieldMultiTS::New();
1285 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1287 return MEDFileFieldMultiTS::New(fileName);
1290 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1292 return MEDFileFieldMultiTS::New(fileName,fieldName);
1295 std::string __str__() const throw(INTERP_KERNEL::Exception)
1297 return self->simpleRepr();
1300 int __len__() const throw(INTERP_KERNEL::Exception)
1302 return self->getNumberOfTS();
1305 MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1307 if(elt0 && PyInt_Check(elt0))
1309 int pos=PyInt_AS_LONG(elt0);
1310 return self->getTimeStepAtPos(pos);
1312 else if(elt0 && PyTuple_Check(elt0))
1314 if(PyTuple_Size(elt0)==2)
1316 PyObject *o0=PyTuple_GetItem(elt0,0);
1317 PyObject *o1=PyTuple_GetItem(elt0,1);
1318 if(PyInt_Check(o0) && PyInt_Check(o1))
1320 int iter=PyInt_AS_LONG(o0);
1321 int order=PyInt_AS_LONG(o1);
1322 return self->getTimeStep(iter,order);
1325 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1328 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1330 else if(elt0 && PyFloat_Check(elt0))
1332 double val=PyFloat_AS_DOUBLE(elt0);
1333 return self->getTimeStepGivenTime(val);
1336 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1339 MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1341 return self->iterator();
1344 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1346 DataArrayInt *ret1=0;
1347 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1348 PyObject *ret=PyTuple_New(2);
1349 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1350 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1354 PyObject *getIterations() const
1356 std::vector< std::pair<int,int> > res=self->getIterations();
1357 PyObject *ret=PyList_New(res.size());
1359 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1361 PyObject *elt=PyTuple_New(2);
1362 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1363 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1364 PyList_SetItem(ret,rk,elt);
1369 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1371 std::vector<double> ret1;
1372 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1373 std::size_t sz=ret.size();
1374 PyObject *ret2=PyList_New(sz);
1375 for(std::size_t i=0;i<sz;i++)
1377 PyObject *elt=PyTuple_New(3);
1378 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1379 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1380 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1381 PyList_SetItem(ret2,i,elt);
1386 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1388 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1389 PyObject *ret2=PyList_New(ret.size());
1390 for(int i=0;i<(int)ret.size();i++)
1392 const std::vector<TypeOfField>& rett=ret[i];
1393 PyObject *ret3=PyList_New(rett.size());
1394 for(int j=0;j<(int)rett.size();j++)
1395 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1396 PyList_SetItem(ret2,i,ret3);
1401 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1403 std::vector<int> ret1;
1404 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1405 PyObject *elt=PyTuple_New(2);
1406 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1407 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1411 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1413 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1414 std::vector< std::vector<TypeOfField> > typesF;
1415 std::vector< std::vector<std::string> > pfls;
1416 std::vector< std::vector<std::string> > locs;
1417 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1419 PyObject *ret2=PyList_New(sz);
1420 for(int i=0;i<sz;i++)
1422 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1423 const std::vector<TypeOfField>& typesFI=typesF[i];
1424 const std::vector<std::string>& pflsI=pfls[i];
1425 const std::vector<std::string>& locsI=locs[i];
1426 PyObject *elt=PyTuple_New(2);
1427 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1428 int sz2=ret[i].size();
1429 PyObject *elt2=PyList_New(sz2);
1430 for(int j=0;j<sz2;j++)
1432 PyObject *elt3=PyTuple_New(4);
1433 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1434 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
1435 PyTuple_SetItem(elt3,1,elt4);
1436 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1437 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1438 PyList_SetItem(elt2,j,elt3);
1440 PyTuple_SetItem(elt,1,elt2);
1441 PyList_SetItem(ret2,i,elt);
1446 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1448 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1449 std::vector< std::vector<TypeOfField> > typesF;
1450 std::vector< std::vector<std::string> > pfls;
1451 std::vector< std::vector<std::string> > locs;
1452 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1454 PyObject *ret2=PyList_New(sz);
1455 for(int i=0;i<sz;i++)
1457 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1458 const std::vector<TypeOfField>& typesFI=typesF[i];
1459 const std::vector<std::string>& pflsI=pfls[i];
1460 const std::vector<std::string>& locsI=locs[i];
1461 PyObject *elt=PyTuple_New(2);
1462 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1463 int sz2=ret[i].size();
1464 PyObject *elt2=PyList_New(sz2);
1465 for(int j=0;j<sz2;j++)
1467 PyObject *elt3=PyTuple_New(4);
1468 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1469 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1470 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1471 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1472 PyList_SetItem(elt2,j,elt3);
1474 PyTuple_SetItem(elt,1,elt2);
1475 PyList_SetItem(ret2,i,elt);
1479 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1481 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1486 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1488 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1489 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1492 PyObject *ret=PyTuple_New(2);
1493 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1494 std::size_t sz=elt1Cpp.size();
1495 PyObject *elt=PyList_New(sz);
1496 for(std::size_t i=0;i<sz;i++)
1498 PyObject *elt1=PyTuple_New(2);
1499 PyObject *elt2=PyTuple_New(2);
1500 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1501 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1502 PyObject *elt3=PyTuple_New(2);
1503 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1504 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1505 PyTuple_SetItem(elt1,0,elt2);
1506 PyTuple_SetItem(elt1,1,elt3);
1507 PyList_SetItem(elt,i,elt1);
1509 PyTuple_SetItem(ret,1,elt);
1513 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1515 if(elt0 && PyInt_Check(elt0))
1517 int pos=PyInt_AS_LONG(elt0);
1520 else if(elt0 && PyTuple_Check(elt0))
1522 if(PyTuple_Size(elt0)==2)
1524 PyObject *o0=PyTuple_GetItem(elt0,0);
1525 PyObject *o1=PyTuple_GetItem(elt0,1);
1526 if(PyInt_Check(o0) && PyInt_Check(o1))
1528 int iter=PyInt_AS_LONG(o0);
1529 int order=PyInt_AS_LONG(o1);
1530 return self->getPosOfTimeStep(iter,order);
1533 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1536 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1538 else if(elt0 && PyFloat_Check(elt0))
1540 double val=PyFloat_AS_DOUBLE(elt0);
1541 return self->getPosGivenTime(val);
1544 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1547 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1549 if(PyList_Check(elts))
1551 int sz=PyList_Size(elts);
1552 std::vector<int> ret(sz);
1553 for(int i=0;i<sz;i++)
1555 PyObject *elt=PyList_GetItem(elts,i);
1556 ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1562 std::vector<int> ret(1);
1563 ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1568 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1570 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1571 if(!idsToRemove.empty())
1572 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1575 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1579 std::vector<int> pos2;
1580 DataArrayInt *pos3=0;
1581 DataArrayIntTuple *pos4=0;
1582 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1587 self->eraseTimeStepIds(&pos1,&pos1+1);
1594 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1599 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1603 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1607 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1609 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1610 return self->changeMeshNames(modifTab);
1615 class MEDFileFieldsIterator
1620 PyObject *next() throw(INTERP_KERNEL::Exception)
1622 MEDFileFieldMultiTS *ret=self->nextt();
1624 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1627 PyErr_SetString(PyExc_StopIteration,"No more data.");
1634 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1637 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1638 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1639 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
1640 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1641 int getNumberOfFields() const;
1642 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1643 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1645 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1646 void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1647 void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1648 MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1649 MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1650 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1655 return MEDFileFields::New();
1658 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1660 return MEDFileFields::New(fileName);
1663 std::string __str__() const throw(INTERP_KERNEL::Exception)
1665 return self->simpleRepr();
1668 MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1670 if(PyInt_Check(obj))
1672 return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1674 else if(PyString_Check(obj))
1676 return self->getFieldWithName(PyString_AsString(obj));
1679 throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1682 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1684 self->setFieldAtPos(obj,field);
1688 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1690 return self->iterator();
1693 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1695 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1696 return self->changeMeshNames(modifTab);
1701 class MEDFileParameter1TS : public RefCountObject
1704 void setIteration(int it);
1705 int getIteration() const;
1706 void setOrder(int order);
1707 int getOrder() const;
1708 void setTimeValue(double time);
1709 void setTime(int dt, int it, double time);
1710 double getTime(int& dt, int& it);
1711 double getTimeValue() const;
1714 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
1717 void setValue(double val) throw(INTERP_KERNEL::Exception);
1718 double getValue() const throw(INTERP_KERNEL::Exception);
1719 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1722 std::string __str__() const throw(INTERP_KERNEL::Exception)
1724 return self->simpleRepr();
1729 class MEDFileParameterTinyInfo : public MEDFileWritable
1732 void setDescription(const char *name);
1733 const char *getDescription() const;
1734 void setTimeUnit(const char *unit);
1735 const char *getTimeUnit() const;
1738 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
1741 static MEDFileParameterDouble1TS *New();
1742 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1743 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
1744 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
1745 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1746 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1747 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1748 const char *getName() const throw(INTERP_KERNEL::Exception);
1749 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1752 MEDFileParameterDouble1TS()
1754 return MEDFileParameterDouble1TS::New();
1757 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1759 return MEDFileParameterDouble1TS::New(fileName);
1762 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
1764 return MEDFileParameterDouble1TS::New(fileName,paramName);
1767 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
1769 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
1772 std::string __str__() const throw(INTERP_KERNEL::Exception)
1774 return self->simpleRepr();
1777 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
1780 bool ret0=self->isEqual(other,eps,what);
1781 PyObject *res=PyList_New(2);
1782 PyObject *ret0Py=ret0?Py_True:Py_False;
1784 PyList_SetItem(res,0,ret0Py);
1785 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1791 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
1794 static MEDFileParameterMultiTS *New();
1795 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1796 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
1797 const char *getName() const;
1798 void setName(const char *name);
1799 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1800 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1801 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1802 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
1803 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1804 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1805 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1808 MEDFileParameterMultiTS()
1810 return MEDFileParameterMultiTS::New();
1813 MEDFileParameterMultiTS(const char *fileName)
1815 return MEDFileParameterMultiTS::New(fileName);
1818 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
1820 return MEDFileParameterMultiTS::New(fileName,paramName);
1823 std::string __str__() const throw(INTERP_KERNEL::Exception)
1825 return self->simpleRepr();
1828 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
1831 bool ret0=self->isEqual(other,eps,what);
1832 PyObject *res=PyList_New(2);
1833 PyObject *ret0Py=ret0?Py_True:Py_False;
1835 PyList_SetItem(res,0,ret0Py);
1836 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1840 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
1844 std::vector<int> pos2;
1845 DataArrayInt *pos3=0;
1846 DataArrayIntTuple *pos4=0;
1847 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
1852 self->eraseTimeStepIds(&pos1,&pos1+1);
1859 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1864 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1868 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1872 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1874 if(elt0 && PyInt_Check(elt0))
1876 int pos=PyInt_AS_LONG(elt0);
1879 else if(elt0 && PyTuple_Check(elt0))
1881 if(PyTuple_Size(elt0)==2)
1883 PyObject *o0=PyTuple_GetItem(elt0,0);
1884 PyObject *o1=PyTuple_GetItem(elt0,1);
1885 if(PyInt_Check(o0) && PyInt_Check(o1))
1887 int iter=PyInt_AS_LONG(o0);
1888 int order=PyInt_AS_LONG(o1);
1889 return self->getPosOfTimeStep(iter,order);
1892 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1895 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1897 else if(elt0 && PyFloat_Check(elt0))
1899 double val=PyFloat_AS_DOUBLE(elt0);
1900 return self->getPosGivenTime(val);
1903 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1906 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1908 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
1914 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1916 if(PyList_Check(elts))
1918 int sz=PyList_Size(elts);
1919 std::vector<int> ret(sz);
1920 for(int i=0;i<sz;i++)
1922 PyObject *elt=PyList_GetItem(elts,i);
1923 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
1929 std::vector<int> ret(1);
1930 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
1935 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1937 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
1938 if(!idsToRemove.empty())
1939 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1942 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
1944 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
1950 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1952 std::vector< std::pair<int,int> > res=self->getIterations();
1953 PyObject *ret=PyList_New(res.size());
1955 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1957 PyObject *elt=PyTuple_New(2);
1958 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1959 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1960 PyList_SetItem(ret,rk,elt);
1965 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1967 std::vector<double> res2;
1968 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
1969 PyObject *ret=PyList_New(res.size());
1971 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1973 PyObject *elt=PyTuple_New(3);
1974 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1975 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1976 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
1977 PyList_SetItem(ret,rk,elt);
1984 class MEDFileParameters : public RefCountObject, public MEDFileWritable
1987 static MEDFileParameters *New();
1988 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1989 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
1990 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1991 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
1992 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1993 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1994 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
1995 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
1996 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
1997 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
1998 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2003 return MEDFileParameters::New();
2006 MEDFileParameters(const char *fileName)
2008 return MEDFileParameters::New(fileName);
2011 std::string __str__() const throw(INTERP_KERNEL::Exception)
2013 return self->simpleRepr();
2016 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2018 if(PyInt_Check(obj))
2020 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2025 else if(PyString_Check(obj))
2027 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2033 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2036 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2038 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2044 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2046 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2052 PyObject *isEqual(const MEDFileParameters *other, double eps) const
2055 bool ret0=self->isEqual(other,eps,what);
2056 PyObject *res=PyList_New(2);
2057 PyObject *ret0Py=ret0?Py_True:Py_False;
2059 PyList_SetItem(res,0,ret0Py);
2060 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2066 class MEDFileData : public RefCountObject, public MEDFileWritable
2069 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2070 static MEDFileData *New();
2071 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2072 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2073 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2074 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2075 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2076 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2077 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2079 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2080 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2082 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2085 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2087 return MEDFileData::New(fileName);
2092 return MEDFileData::New();
2095 std::string __str__() const throw(INTERP_KERNEL::Exception)
2097 return self->simpleRepr();
2100 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2102 MEDFileMeshes *ret=self->getMeshes();
2108 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2110 MEDFileParameters *ret=self->getParams();
2116 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2118 MEDFileFields *ret=self->getFields();
2124 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2126 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2127 return self->changeMeshNames(modifTab);
2132 class SauvReader : public RefCountObject
2135 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2136 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2139 class SauvWriter : public RefCountObject
2142 static SauvWriter * New();
2143 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2144 void write(const char* fileName) throw(INTERP_KERNEL::Exception);