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 %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 *fieldName) throw(INTERP_KERNEL::Exception)
204 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,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 void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
441 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
442 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
443 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
444 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
445 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
446 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
447 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
448 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
451 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
453 return MEDFileMesh::New(fileName);
456 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
458 return MEDFileMesh::New(fileName,mName,dt,it);
461 std::string __str__() const throw(INTERP_KERNEL::Exception)
463 return self->simpleRepr();
466 PyObject *getTime() throw(INTERP_KERNEL::Exception)
469 double tmp0=self->getTime(tmp1,tmp2);
470 PyObject *res = PyList_New(3);
471 PyList_SetItem(res,0,SWIG_From_int(tmp1));
472 PyList_SetItem(res,1,SWIG_From_int(tmp2));
473 PyList_SetItem(res,2,SWIG_From_double(tmp0));
477 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
480 bool ret0=self->isEqual(other,eps,what);
481 PyObject *res=PyList_New(2);
482 PyObject *ret0Py=ret0?Py_True:Py_False;
484 PyList_SetItem(res,0,ret0Py);
485 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
489 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
492 bool ret0=self->areFamsEqual(other,what);
493 PyObject *res=PyList_New(2);
494 PyObject *ret0Py=ret0?Py_True:Py_False;
496 PyList_SetItem(res,0,ret0Py);
497 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
501 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
504 bool ret0=self->areGrpsEqual(other,what);
505 PyObject *res=PyList_New(2);
506 PyObject *ret0Py=ret0?Py_True:Py_False;
508 PyList_SetItem(res,0,ret0Py);
509 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
513 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
515 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
518 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
521 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
523 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
526 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
529 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
531 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
534 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
537 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
540 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
541 PyObject *ret=PyTuple_New(2);
542 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
543 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
547 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
549 DataArrayInt *ret3=0;
550 std::vector<int> ret1,ret2;
551 bool ret0=self->unPolyze(ret1,ret2,ret3);
552 PyObject *ret=PyTuple_New(4);
553 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
555 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
556 for(int j=0;j<(int)ret1.size()/3;j++)
558 PyObject *retLev2=PyList_New(3);
559 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
560 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
561 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
562 PyList_SetItem(retLev1_0,j,retLev2);
564 PyTuple_SetItem(ret,1,retLev1_0);
566 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
567 for(int j=0;j<(int)ret2.size()/3;j++)
569 PyObject *retLev2=PyList_New(3);
570 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
571 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
572 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
573 PyList_SetItem(retLev1_1,j,retLev2);
575 PyTuple_SetItem(ret,2,retLev1_1);
577 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
583 class MEDFileUMesh : public MEDFileMesh
586 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
587 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
588 static MEDFileUMesh *New();
590 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
592 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
593 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
594 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
595 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
596 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
597 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
598 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
599 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
600 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
601 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
602 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
603 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
604 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
605 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
606 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
607 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
608 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
609 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
610 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
611 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
612 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
613 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
614 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
615 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
616 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
617 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
619 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
620 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
621 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
622 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
623 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
624 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
625 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
626 void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
627 void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
628 void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
629 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
630 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
633 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
635 return MEDFileUMesh::New(fileName,mName,dt,it);
638 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
640 return MEDFileUMesh::New(fileName);
645 return MEDFileUMesh::New();
648 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
650 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
653 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
656 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
658 std::vector<const DataArrayInt *> grps;
659 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
660 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
663 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
665 DataArrayDouble *ret=self->getCoords();
671 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
673 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
674 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
675 PyObject *ret=PyTuple_New(3);
676 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
677 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
678 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
684 class MEDFileStructuredMesh : public MEDFileMesh
688 class MEDFileCMesh : public MEDFileStructuredMesh
691 static MEDFileCMesh *New();
692 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
693 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
694 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
699 return MEDFileCMesh::New();
702 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
704 return MEDFileCMesh::New(fileName);
707 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
709 return MEDFileCMesh::New(fileName,mName,dt,it);
712 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
714 const MEDCouplingCMesh *tmp=self->getMesh();
717 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
722 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
725 static MEDFileCurveLinearMesh *New();
726 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
727 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
728 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
731 MEDFileCurveLinearMesh()
733 return MEDFileCurveLinearMesh::New();
736 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
738 return MEDFileCurveLinearMesh::New(fileName);
741 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
743 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
746 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
748 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
751 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
756 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
759 static MEDFileMeshMultiTS *New();
760 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
761 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
762 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
763 const char *getName() const throw(INTERP_KERNEL::Exception);
764 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
765 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
770 return MEDFileMeshMultiTS::New();
773 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
775 return MEDFileMeshMultiTS::New(fileName);
778 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
780 return MEDFileMeshMultiTS::New(fileName,mName);
783 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
785 MEDFileMesh *ret=self->getOneTimeStep();
793 class MEDFileMeshesIterator
798 PyObject *next() throw(INTERP_KERNEL::Exception)
800 MEDFileMesh *ret=self->nextt();
804 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
808 PyErr_SetString(PyExc_StopIteration,"No more data.");
815 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
818 static MEDFileMeshes *New();
819 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
820 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
821 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
822 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
823 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
825 void resize(int newSize) throw(INTERP_KERNEL::Exception);
826 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
827 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
828 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
833 return MEDFileMeshes::New();
836 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
838 return MEDFileMeshes::New(fileName);
841 std::string __str__() const throw(INTERP_KERNEL::Exception)
843 return self->simpleRepr();
846 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
850 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
855 else if(PyString_Check(obj))
857 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
863 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
866 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
868 self->setMeshAtPos(obj,mesh);
872 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
874 return self->iterator();
877 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
879 MEDFileMesh *ret=self->getMeshAtPos(i);
884 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
886 MEDFileMesh *ret=self->getMeshWithName(mname);
894 class MEDFileFieldLoc : public RefCountObject
897 const std::string& getName() const;
898 int getDimension() const;
899 int getNumberOfGaussPoints() const;
900 int getNumberOfPointsInCells() const;
901 const std::vector<double>& getRefCoords() const;
902 const std::vector<double>& getGaussCoords() const;
903 const std::vector<double>& getGaussWeights() const;
904 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
907 std::string __str__() const throw(INTERP_KERNEL::Exception)
914 class MEDFileFieldGlobsReal
917 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
918 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
919 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
920 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
921 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
922 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
923 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
924 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
925 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
926 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
927 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
928 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
929 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
930 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
931 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
932 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
933 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
934 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
935 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
936 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
939 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
941 const DataArrayInt *ret=self->getProfile(pflName);
944 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
947 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
949 const DataArrayInt *ret=self->getProfileFromId(pflId);
952 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
955 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
957 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
960 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
963 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
965 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
968 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
971 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
973 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
974 return convertVecPairVecStToPy(ret);
977 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
979 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
980 return convertVecPairVecStToPy(ret);
983 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
985 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
986 self->changePflsNames(v);
989 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
991 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
992 self->changePflsRefsNamesGen(v);
995 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
997 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
998 self->changePflsNamesInStruct(v);
1001 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1003 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1004 self->changeLocsNames(v);
1007 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1009 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1010 self->changeLocsRefsNamesGen(v);
1013 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1015 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1016 self->changeLocsNamesInStruct(v);
1021 class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1024 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1025 static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1026 static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1027 static MEDFileField1TS *New();
1028 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1029 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1030 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1031 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1032 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1033 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1035 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1036 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1037 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1038 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1039 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1040 MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1042 int getDimension() const throw(INTERP_KERNEL::Exception);
1043 int getIteration() const throw(INTERP_KERNEL::Exception);
1044 int getOrder() const throw(INTERP_KERNEL::Exception);
1045 std::string getName() throw(INTERP_KERNEL::Exception);
1046 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1047 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1048 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1049 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1050 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1051 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1052 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1055 MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1057 return MEDFileField1TS::New(fileName);
1060 MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1062 return MEDFileField1TS::New(fileName,fieldName);
1065 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1067 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1072 return MEDFileField1TS::New();
1075 std::string __str__() const throw(INTERP_KERNEL::Exception)
1077 return self->simpleRepr();
1080 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1082 DataArrayInt *ret1=0;
1083 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1084 PyObject *ret=PyTuple_New(2);
1085 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1086 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1090 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1092 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1095 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1097 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1100 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1103 double tmp0=self->getTime(tmp1,tmp2);
1104 PyObject *res = PyList_New(3);
1105 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1106 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1107 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1111 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1113 std::pair<int,int> res=self->getDtIt();
1114 PyObject *elt=PyTuple_New(2);
1115 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1116 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1120 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1122 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1123 PyObject *ret2=PyList_New(ret.size());
1124 for(int i=0;i<(int)ret.size();i++)
1125 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1129 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1131 std::vector<int> ret1;
1132 int ret0=self->getNonEmptyLevels(mname,ret1);
1133 PyObject *elt=PyTuple_New(2);
1134 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1135 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1139 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1141 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1142 std::vector< std::vector<TypeOfField> > typesF;
1143 std::vector< std::vector<std::string> > pfls;
1144 std::vector< std::vector<std::string> > locs;
1145 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1147 PyObject *ret2=PyList_New(sz);
1148 for(int i=0;i<sz;i++)
1150 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1151 const std::vector<TypeOfField>& typesFI=typesF[i];
1152 const std::vector<std::string>& pflsI=pfls[i];
1153 const std::vector<std::string>& locsI=locs[i];
1154 PyObject *elt=PyTuple_New(2);
1155 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1156 int sz2=ret[i].size();
1157 PyObject *elt2=PyList_New(sz2);
1158 for(int j=0;j<sz2;j++)
1160 PyObject *elt3=PyTuple_New(4);
1161 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1162 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
1163 PyTuple_SetItem(elt3,1,elt4);
1164 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1165 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1166 PyList_SetItem(elt2,j,elt3);
1168 PyTuple_SetItem(elt,1,elt2);
1169 PyList_SetItem(ret2,i,elt);
1174 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1176 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1177 std::vector< std::vector<TypeOfField> > typesF;
1178 std::vector< std::vector<std::string> > pfls;
1179 std::vector< std::vector<std::string> > locs;
1180 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1182 PyObject *ret2=PyList_New(sz);
1183 for(int i=0;i<sz;i++)
1185 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1186 const std::vector<TypeOfField>& typesFI=typesF[i];
1187 const std::vector<std::string>& pflsI=pfls[i];
1188 const std::vector<std::string>& locsI=locs[i];
1189 PyObject *elt=PyTuple_New(2);
1190 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1191 int sz2=ret[i].size();
1192 PyObject *elt2=PyList_New(sz2);
1193 for(int j=0;j<sz2;j++)
1195 PyObject *elt3=PyTuple_New(4);
1196 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1197 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1198 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1199 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1200 PyList_SetItem(elt2,j,elt3);
1202 PyTuple_SetItem(elt,1,elt2);
1203 PyList_SetItem(ret2,i,elt);
1208 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1210 DataArrayDouble *ret=self->getUndergroundDataArray();
1216 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1218 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1219 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1222 PyObject *ret=PyTuple_New(2);
1223 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1224 std::size_t sz=elt1Cpp.size();
1225 PyObject *elt=PyList_New(sz);
1226 for(std::size_t i=0;i<sz;i++)
1228 PyObject *elt1=PyTuple_New(2);
1229 PyObject *elt2=PyTuple_New(2);
1230 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1231 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1232 PyObject *elt3=PyTuple_New(2);
1233 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1234 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1235 PyTuple_SetItem(elt1,0,elt2);
1236 PyTuple_SetItem(elt1,1,elt3);
1237 PyList_SetItem(elt,i,elt1);
1239 PyTuple_SetItem(ret,1,elt);
1243 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1245 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1246 return self->changeMeshNames(modifTab);
1251 class MEDFileFieldMultiTSIterator
1256 PyObject *next() throw(INTERP_KERNEL::Exception)
1258 MEDFileField1TS *ret=self->nextt();
1260 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1263 PyErr_SetString(PyExc_StopIteration,"No more data.");
1270 class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1273 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1274 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1275 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1276 MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1278 MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1279 MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1280 MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1282 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1283 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1284 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1285 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1286 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1287 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1289 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1290 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1292 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1293 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1294 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1295 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1296 std::string getName() const throw(INTERP_KERNEL::Exception);
1297 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1298 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1299 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1300 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1303 MEDFileFieldMultiTS()
1305 return MEDFileFieldMultiTS::New();
1308 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1310 return MEDFileFieldMultiTS::New(fileName);
1313 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1315 return MEDFileFieldMultiTS::New(fileName,fieldName);
1318 std::string __str__() const throw(INTERP_KERNEL::Exception)
1320 return self->simpleRepr();
1323 int __len__() const throw(INTERP_KERNEL::Exception)
1325 return self->getNumberOfTS();
1328 MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1330 if(elt0 && PyInt_Check(elt0))
1332 int pos=PyInt_AS_LONG(elt0);
1333 return self->getTimeStepAtPos(pos);
1335 else if(elt0 && PyTuple_Check(elt0))
1337 if(PyTuple_Size(elt0)==2)
1339 PyObject *o0=PyTuple_GetItem(elt0,0);
1340 PyObject *o1=PyTuple_GetItem(elt0,1);
1341 if(PyInt_Check(o0) && PyInt_Check(o1))
1343 int iter=PyInt_AS_LONG(o0);
1344 int order=PyInt_AS_LONG(o1);
1345 return self->getTimeStep(iter,order);
1348 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1351 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1353 else if(elt0 && PyFloat_Check(elt0))
1355 double val=PyFloat_AS_DOUBLE(elt0);
1356 return self->getTimeStepGivenTime(val);
1359 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1362 MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1364 return self->iterator();
1367 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1369 DataArrayInt *ret1=0;
1370 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1371 PyObject *ret=PyTuple_New(2);
1372 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1373 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1377 PyObject *getIterations() const
1379 std::vector< std::pair<int,int> > res=self->getIterations();
1380 PyObject *ret=PyList_New(res.size());
1382 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1384 PyObject *elt=PyTuple_New(2);
1385 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1386 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1387 PyList_SetItem(ret,rk,elt);
1392 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1394 std::vector<double> ret1;
1395 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1396 std::size_t sz=ret.size();
1397 PyObject *ret2=PyList_New(sz);
1398 for(std::size_t i=0;i<sz;i++)
1400 PyObject *elt=PyTuple_New(3);
1401 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1402 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1403 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1404 PyList_SetItem(ret2,i,elt);
1409 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1411 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1412 PyObject *ret2=PyList_New(ret.size());
1413 for(int i=0;i<(int)ret.size();i++)
1415 const std::vector<TypeOfField>& rett=ret[i];
1416 PyObject *ret3=PyList_New(rett.size());
1417 for(int j=0;j<(int)rett.size();j++)
1418 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1419 PyList_SetItem(ret2,i,ret3);
1424 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1426 std::vector<int> ret1;
1427 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1428 PyObject *elt=PyTuple_New(2);
1429 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1430 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1434 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1436 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1437 std::vector< std::vector<TypeOfField> > typesF;
1438 std::vector< std::vector<std::string> > pfls;
1439 std::vector< std::vector<std::string> > locs;
1440 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1442 PyObject *ret2=PyList_New(sz);
1443 for(int i=0;i<sz;i++)
1445 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1446 const std::vector<TypeOfField>& typesFI=typesF[i];
1447 const std::vector<std::string>& pflsI=pfls[i];
1448 const std::vector<std::string>& locsI=locs[i];
1449 PyObject *elt=PyTuple_New(2);
1450 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1451 int sz2=ret[i].size();
1452 PyObject *elt2=PyList_New(sz2);
1453 for(int j=0;j<sz2;j++)
1455 PyObject *elt3=PyTuple_New(4);
1456 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1457 PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
1458 PyTuple_SetItem(elt3,1,elt4);
1459 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1460 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1461 PyList_SetItem(elt2,j,elt3);
1463 PyTuple_SetItem(elt,1,elt2);
1464 PyList_SetItem(ret2,i,elt);
1469 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1471 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1472 std::vector< std::vector<TypeOfField> > typesF;
1473 std::vector< std::vector<std::string> > pfls;
1474 std::vector< std::vector<std::string> > locs;
1475 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1477 PyObject *ret2=PyList_New(sz);
1478 for(int i=0;i<sz;i++)
1480 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1481 const std::vector<TypeOfField>& typesFI=typesF[i];
1482 const std::vector<std::string>& pflsI=pfls[i];
1483 const std::vector<std::string>& locsI=locs[i];
1484 PyObject *elt=PyTuple_New(2);
1485 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1486 int sz2=ret[i].size();
1487 PyObject *elt2=PyList_New(sz2);
1488 for(int j=0;j<sz2;j++)
1490 PyObject *elt3=PyTuple_New(4);
1491 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1492 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1493 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1494 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1495 PyList_SetItem(elt2,j,elt3);
1497 PyTuple_SetItem(elt,1,elt2);
1498 PyList_SetItem(ret2,i,elt);
1502 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1504 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1509 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1511 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1512 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1515 PyObject *ret=PyTuple_New(2);
1516 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1517 std::size_t sz=elt1Cpp.size();
1518 PyObject *elt=PyList_New(sz);
1519 for(std::size_t i=0;i<sz;i++)
1521 PyObject *elt1=PyTuple_New(2);
1522 PyObject *elt2=PyTuple_New(2);
1523 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1524 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1525 PyObject *elt3=PyTuple_New(2);
1526 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1527 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1528 PyTuple_SetItem(elt1,0,elt2);
1529 PyTuple_SetItem(elt1,1,elt3);
1530 PyList_SetItem(elt,i,elt1);
1532 PyTuple_SetItem(ret,1,elt);
1536 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1538 if(elt0 && PyInt_Check(elt0))
1540 int pos=PyInt_AS_LONG(elt0);
1543 else if(elt0 && PyTuple_Check(elt0))
1545 if(PyTuple_Size(elt0)==2)
1547 PyObject *o0=PyTuple_GetItem(elt0,0);
1548 PyObject *o1=PyTuple_GetItem(elt0,1);
1549 if(PyInt_Check(o0) && PyInt_Check(o1))
1551 int iter=PyInt_AS_LONG(o0);
1552 int order=PyInt_AS_LONG(o1);
1553 return self->getPosOfTimeStep(iter,order);
1556 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1559 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1561 else if(elt0 && PyFloat_Check(elt0))
1563 double val=PyFloat_AS_DOUBLE(elt0);
1564 return self->getPosGivenTime(val);
1567 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1570 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1572 if(PyList_Check(elts))
1574 int sz=PyList_Size(elts);
1575 std::vector<int> ret(sz);
1576 for(int i=0;i<sz;i++)
1578 PyObject *elt=PyList_GetItem(elts,i);
1579 ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1585 std::vector<int> ret(1);
1586 ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1591 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1593 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1594 if(!idsToRemove.empty())
1595 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1598 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1602 std::vector<int> pos2;
1603 DataArrayInt *pos3=0;
1604 DataArrayIntTuple *pos4=0;
1605 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1610 self->eraseTimeStepIds(&pos1,&pos1+1);
1617 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1622 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1626 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1630 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1632 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1633 return self->changeMeshNames(modifTab);
1638 class MEDFileFieldsIterator
1643 PyObject *next() throw(INTERP_KERNEL::Exception)
1645 MEDFileFieldMultiTS *ret=self->nextt();
1647 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1650 PyErr_SetString(PyExc_StopIteration,"No more data.");
1657 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1660 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1661 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1662 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
1663 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1664 int getNumberOfFields() const;
1665 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1666 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1668 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1669 void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1670 void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1671 MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1672 MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1673 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1678 return MEDFileFields::New();
1681 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1683 return MEDFileFields::New(fileName);
1686 std::string __str__() const throw(INTERP_KERNEL::Exception)
1688 return self->simpleRepr();
1691 MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1693 if(PyInt_Check(obj))
1695 return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1697 else if(PyString_Check(obj))
1699 return self->getFieldWithName(PyString_AsString(obj));
1702 throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1705 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1707 self->setFieldAtPos(obj,field);
1711 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1713 return self->iterator();
1716 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1718 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1719 return self->changeMeshNames(modifTab);
1724 class MEDFileParameter1TS : public RefCountObject
1727 void setIteration(int it);
1728 int getIteration() const;
1729 void setOrder(int order);
1730 int getOrder() const;
1731 void setTimeValue(double time);
1732 void setTime(int dt, int it, double time);
1733 double getTime(int& dt, int& it);
1734 double getTimeValue() const;
1737 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
1740 void setValue(double val) throw(INTERP_KERNEL::Exception);
1741 double getValue() const throw(INTERP_KERNEL::Exception);
1742 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1745 std::string __str__() const throw(INTERP_KERNEL::Exception)
1747 return self->simpleRepr();
1752 class MEDFileParameterTinyInfo : public MEDFileWritable
1755 void setDescription(const char *name);
1756 const char *getDescription() const;
1757 void setTimeUnit(const char *unit);
1758 const char *getTimeUnit() const;
1761 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
1764 static MEDFileParameterDouble1TS *New();
1765 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1766 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
1767 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
1768 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1769 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1770 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1771 const char *getName() const throw(INTERP_KERNEL::Exception);
1772 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1775 MEDFileParameterDouble1TS()
1777 return MEDFileParameterDouble1TS::New();
1780 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1782 return MEDFileParameterDouble1TS::New(fileName);
1785 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
1787 return MEDFileParameterDouble1TS::New(fileName,paramName);
1790 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
1792 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
1795 std::string __str__() const throw(INTERP_KERNEL::Exception)
1797 return self->simpleRepr();
1800 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
1803 bool ret0=self->isEqual(other,eps,what);
1804 PyObject *res=PyList_New(2);
1805 PyObject *ret0Py=ret0?Py_True:Py_False;
1807 PyList_SetItem(res,0,ret0Py);
1808 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1814 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
1817 static MEDFileParameterMultiTS *New();
1818 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1819 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
1820 const char *getName() const;
1821 void setName(const char *name);
1822 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1823 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1824 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
1825 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
1826 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1827 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1828 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1831 MEDFileParameterMultiTS()
1833 return MEDFileParameterMultiTS::New();
1836 MEDFileParameterMultiTS(const char *fileName)
1838 return MEDFileParameterMultiTS::New(fileName);
1841 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
1843 return MEDFileParameterMultiTS::New(fileName,paramName);
1846 std::string __str__() const throw(INTERP_KERNEL::Exception)
1848 return self->simpleRepr();
1851 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
1854 bool ret0=self->isEqual(other,eps,what);
1855 PyObject *res=PyList_New(2);
1856 PyObject *ret0Py=ret0?Py_True:Py_False;
1858 PyList_SetItem(res,0,ret0Py);
1859 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
1863 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
1867 std::vector<int> pos2;
1868 DataArrayInt *pos3=0;
1869 DataArrayIntTuple *pos4=0;
1870 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
1875 self->eraseTimeStepIds(&pos1,&pos1+1);
1882 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1887 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1891 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1895 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1897 if(elt0 && PyInt_Check(elt0))
1899 int pos=PyInt_AS_LONG(elt0);
1902 else if(elt0 && PyTuple_Check(elt0))
1904 if(PyTuple_Size(elt0)==2)
1906 PyObject *o0=PyTuple_GetItem(elt0,0);
1907 PyObject *o1=PyTuple_GetItem(elt0,1);
1908 if(PyInt_Check(o0) && PyInt_Check(o1))
1910 int iter=PyInt_AS_LONG(o0);
1911 int order=PyInt_AS_LONG(o1);
1912 return self->getPosOfTimeStep(iter,order);
1915 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1918 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1920 else if(elt0 && PyFloat_Check(elt0))
1922 double val=PyFloat_AS_DOUBLE(elt0);
1923 return self->getPosGivenTime(val);
1926 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1929 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1931 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
1937 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1939 if(PyList_Check(elts))
1941 int sz=PyList_Size(elts);
1942 std::vector<int> ret(sz);
1943 for(int i=0;i<sz;i++)
1945 PyObject *elt=PyList_GetItem(elts,i);
1946 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
1952 std::vector<int> ret(1);
1953 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
1958 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1960 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
1961 if(!idsToRemove.empty())
1962 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1965 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
1967 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
1973 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1975 std::vector< std::pair<int,int> > res=self->getIterations();
1976 PyObject *ret=PyList_New(res.size());
1978 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1980 PyObject *elt=PyTuple_New(2);
1981 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1982 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1983 PyList_SetItem(ret,rk,elt);
1988 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1990 std::vector<double> res2;
1991 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
1992 PyObject *ret=PyList_New(res.size());
1994 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1996 PyObject *elt=PyTuple_New(3);
1997 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1998 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1999 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2000 PyList_SetItem(ret,rk,elt);
2007 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2010 static MEDFileParameters *New();
2011 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2012 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2013 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2014 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2015 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2016 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2017 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2018 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2019 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2020 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2021 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2026 return MEDFileParameters::New();
2029 MEDFileParameters(const char *fileName)
2031 return MEDFileParameters::New(fileName);
2034 std::string __str__() const throw(INTERP_KERNEL::Exception)
2036 return self->simpleRepr();
2039 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2041 if(PyInt_Check(obj))
2043 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2048 else if(PyString_Check(obj))
2050 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2056 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2059 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2061 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2067 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2069 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2075 PyObject *isEqual(const MEDFileParameters *other, double eps) const
2078 bool ret0=self->isEqual(other,eps,what);
2079 PyObject *res=PyList_New(2);
2080 PyObject *ret0Py=ret0?Py_True:Py_False;
2082 PyList_SetItem(res,0,ret0Py);
2083 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2089 class MEDFileData : public RefCountObject, public MEDFileWritable
2092 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2093 static MEDFileData *New();
2094 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2095 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2096 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2097 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2098 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2099 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2100 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2102 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2103 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2105 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2108 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2110 return MEDFileData::New(fileName);
2115 return MEDFileData::New();
2118 std::string __str__() const throw(INTERP_KERNEL::Exception)
2120 return self->simpleRepr();
2123 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2125 MEDFileMeshes *ret=self->getMeshes();
2131 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2133 MEDFileParameters *ret=self->getParams();
2139 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2141 MEDFileFields *ret=self->getFields();
2147 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2149 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2150 return self->changeMeshNames(modifTab);
2155 class SauvReader : public RefCountObject
2158 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2159 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2162 class SauvWriter : public RefCountObject
2165 static SauvWriter * New();
2166 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2167 void write(const char* fileName) throw(INTERP_KERNEL::Exception);