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 "MEDFileData.hxx"
33 #include "MEDLoaderTypemaps.i"
34 #include "SauvReader.hxx"
35 #include "SauvWriter.hxx"
37 using namespace ParaMEDMEM;
40 #if SWIG_VERSION >= 0x010329
41 %template() std::vector<std::string>;
44 %typemap(out) ParaMEDMEM::MEDFileMesh*
46 $result=convertMEDFileMesh($1,$owner);
49 %newobject MEDLoader::ReadUMeshFromFamilies;
50 %newobject MEDLoader::ReadUMeshFromGroups;
51 %newobject MEDLoader::ReadUMeshFromFile;
52 %newobject MEDLoader::ReadField;
53 %newobject MEDLoader::ReadFieldCell;
54 %newobject MEDLoader::ReadFieldNode;
55 %newobject MEDLoader::ReadFieldGauss;
56 %newobject MEDLoader::ReadFieldGaussNE;
57 %newobject ParaMEDMEM::MEDFileMesh::New;
58 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
59 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
60 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
61 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
62 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
63 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
64 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
65 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
66 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
67 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
68 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
69 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
70 %newobject ParaMEDMEM::MEDFileUMesh::New;
71 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
72 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
73 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
74 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
75 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
76 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
77 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
78 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
79 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
80 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
81 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
82 %newobject ParaMEDMEM::MEDFileCMesh::New;
83 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
84 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
85 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
86 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
87 %newobject ParaMEDMEM::MEDFileMeshes::New;
88 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
89 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
90 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
91 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
92 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
94 %newobject ParaMEDMEM::MEDFileFields::New;
95 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
96 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
97 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
98 %newobject ParaMEDMEM::MEDFileFields::__getitem__;
99 %newobject ParaMEDMEM::MEDFileFields::__iter__;
100 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
101 %newobject ParaMEDMEM::MEDFileFieldMultiTS::deepCpy;
102 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
103 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
104 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
105 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
106 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
107 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
108 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
109 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
110 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
111 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
112 %newobject ParaMEDMEM::MEDFileField1TS::New;
113 %newobject ParaMEDMEM::MEDFileField1TS::deepCpy;
114 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
115 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
116 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
117 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
118 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
120 %newobject ParaMEDMEM::MEDFileData::New;
121 %newobject ParaMEDMEM::MEDFileData::deepCpy;
122 %newobject ParaMEDMEM::MEDFileData::getMeshes;
123 %newobject ParaMEDMEM::MEDFileData::getFields;
125 %newobject ParaMEDMEM::SauvWriter::New;
126 %newobject ParaMEDMEM::SauvReader::New;
127 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
129 %feature("unref") MEDFileMesh "$this->decrRef();"
130 %feature("unref") MEDFileUMesh "$this->decrRef();"
131 %feature("unref") MEDFileCMesh "$this->decrRef();"
132 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
133 %feature("unref") MEDFileMeshes "$this->decrRef();"
134 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
135 %feature("unref") MEDFileField1TS "$this->decrRef();"
136 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
137 %feature("unref") MEDFileFields "$this->decrRef();"
138 %feature("unref") MEDFileData "$this->decrRef();"
139 %feature("unref") SauvReader "$this->decrRef();"
140 %feature("unref") SauvWriter "$this->decrRef();"
145 static void setEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
146 static void setCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
147 static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
148 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
149 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
150 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
151 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
152 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
153 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
154 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
155 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
156 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
157 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
158 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
159 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
160 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
163 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
165 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
166 PyObject *ret=PyList_New(res.size());
168 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
170 PyObject *elt=PyTuple_New(2);
171 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
172 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
173 PyList_SetItem(ret,rk,elt);
178 static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
180 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
181 PyObject *ret=PyList_New(res.size());
183 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
185 PyObject *elt=PyTuple_New(3);
186 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
187 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
188 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
189 PyList_SetItem(ret,rk,elt);
194 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
196 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
197 PyObject *ret=PyList_New(res.size());
199 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
201 PyObject *elt=PyTuple_New(2);
202 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
203 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
204 PyList_SetItem(ret,rk,elt);
208 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
210 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
211 PyObject *ret=PyList_New(res.size());
213 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
215 PyObject *elt=PyTuple_New(2);
216 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
217 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
218 PyList_SetItem(ret,rk,elt);
222 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
224 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
225 PyObject *ret=PyList_New(res.size());
227 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
229 PyObject *elt=PyTuple_New(2);
230 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
231 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
232 PyList_SetItem(ret,rk,elt);
236 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
238 int meshDim,spaceDim,numberOfNodes;
239 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
240 PyObject *ret=PyTuple_New(4);
241 PyObject *elt0=PyList_New(res.size());
243 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
245 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
247 PyObject *elt1=PyList_New(obj2.size());
248 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
250 PyObject *elt2=PyTuple_New(2);
251 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
252 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
253 PyList_SetItem(elt1,j,elt2);
255 PyList_SetItem(elt0,i,elt1);
257 PyTuple_SetItem(ret,0,elt0);
258 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
259 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
260 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
263 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
264 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
266 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
267 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
268 return convertFieldDoubleVecToPy(res);
270 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
272 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
273 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
274 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
276 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
278 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
279 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
280 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
282 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
284 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
285 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
286 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
288 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
290 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
292 PyObject *ret=PyList_New(size);
293 for(int i=0;i<size;i++)
294 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
297 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
299 std::vector<std::string> grps;
300 converPyListToVecString(li,grps);
301 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
303 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
305 std::vector<std::string> fams;
306 converPyListToVecString(li,fams);
307 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
310 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
311 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
312 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
313 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);
314 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
315 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
316 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
317 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
318 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
319 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
320 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
321 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
322 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
327 class MEDFileWritable
330 void copyOptionsFrom(const MEDFileWritable& other) const;
331 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
332 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
333 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
334 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
337 class MEDFileMesh : public RefCountObject, public MEDFileWritable
340 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
341 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1);
342 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
343 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
344 virtual void clearNonDiscrAttributes() const;
345 void setName(const char *name);
346 const char *getName();
347 void setUnivName(const char *name);
348 const char *getUnivName() const;
349 void setDescription(const char *name);
350 const char *getDescription() const;
351 void setOrder(int order);
352 int getOrder() const;
353 void setIteration(int it);
355 void setTimeValue(double time);
356 void setTime(int dt, int it, double time);
357 double getTimeValue() const;
358 void setTimeUnit(const char *unit);
359 const char *getTimeUnit() const;
360 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
361 std::vector<int> getNonEmptyLevels() const;
362 std::vector<int> getNonEmptyLevelsExt() const;
363 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
364 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
366 bool existsGroup(const char *groupName) const;
367 bool existsFamily(int famId) const;
368 bool existsFamily(const char *familyName) const;
369 void setFamilyId(const char *familyName, int id);
370 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
371 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
372 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
373 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
374 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
375 void copyFamGrpMapsFrom(const MEDFileMesh& other);
376 const std::map<std::string,int>& getFamilyInfo() const;
377 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
378 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
379 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
380 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
381 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
382 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
383 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
384 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
385 std::vector<std::string> getGroupsNames() const;
386 std::vector<std::string> getFamiliesNames() const;
387 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
388 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
389 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
390 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
391 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
392 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
393 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
394 void setFamilyInfo(const std::map<std::string,int>& info);
395 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
396 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
397 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
398 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
399 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
400 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
401 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
402 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
403 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
404 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
405 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
406 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
407 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
408 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
409 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
410 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
411 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
413 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
414 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
415 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
416 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
417 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
418 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
419 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
420 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
421 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
426 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
428 return MEDFileMesh::New(fileName);
431 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1)
433 return MEDFileMesh::New(fileName,mName,dt,it);
436 std::string __str__() const throw(INTERP_KERNEL::Exception)
438 return self->simpleRepr();
441 PyObject *getTime() throw(INTERP_KERNEL::Exception)
444 double tmp0=self->getTime(tmp1,tmp2);
445 PyObject *res = PyList_New(3);
446 PyList_SetItem(res,0,SWIG_From_int(tmp1));
447 PyList_SetItem(res,1,SWIG_From_int(tmp2));
448 PyList_SetItem(res,2,SWIG_From_double(tmp0));
452 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
455 bool ret0=self->isEqual(other,eps,what);
456 PyObject *res=PyList_New(2);
457 PyObject *ret0Py=ret0?Py_True:Py_False;
459 PyList_SetItem(res,0,ret0Py);
460 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
464 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
467 bool ret0=self->areFamsEqual(other,what);
468 PyObject *res=PyList_New(2);
469 PyObject *ret0Py=ret0?Py_True:Py_False;
471 PyList_SetItem(res,0,ret0Py);
472 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
476 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
479 bool ret0=self->areGrpsEqual(other,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 *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
490 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
493 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
496 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
498 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
501 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
504 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
507 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
508 PyObject *ret=PyTuple_New(2);
509 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
510 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
514 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
516 DataArrayInt *ret3=0;
517 std::vector<int> ret1,ret2;
518 bool ret0=self->unPolyze(ret1,ret2,ret3);
519 PyObject *ret=PyTuple_New(4);
520 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
522 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
523 for(int j=0;j<(int)ret1.size()/3;j++)
525 PyObject *retLev2=PyList_New(3);
526 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
527 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
528 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
529 PyList_SetItem(retLev1_0,j,retLev2);
531 PyTuple_SetItem(ret,1,retLev1_0);
533 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
534 for(int j=0;j<(int)ret2.size()/3;j++)
536 PyObject *retLev2=PyList_New(3);
537 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
538 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
539 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
540 PyList_SetItem(retLev1_1,j,retLev2);
542 PyTuple_SetItem(ret,2,retLev1_1);
544 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
550 class MEDFileUMesh : public MEDFileMesh
553 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
554 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
555 static MEDFileUMesh *New();
557 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
559 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
560 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
561 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
562 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
563 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
564 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
565 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
566 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
567 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
568 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
569 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
570 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
571 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
572 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
573 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
574 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
575 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
576 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
577 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
578 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
579 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
580 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
581 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
582 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
583 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
584 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
586 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
587 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
588 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
589 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
590 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
591 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
592 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
593 void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
594 void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
595 void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
596 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
597 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
600 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
602 return MEDFileUMesh::New(fileName,mName,dt,it);
605 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
607 return MEDFileUMesh::New(fileName);
612 return MEDFileUMesh::New();
615 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
617 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
620 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
623 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
625 std::vector<const DataArrayInt *> grps;
626 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
627 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
630 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
632 DataArrayDouble *ret=self->getCoords();
638 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
640 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
641 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
642 PyObject *ret=PyTuple_New(3);
643 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
644 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
645 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
651 class MEDFileStructuredMesh : public MEDFileMesh
655 class MEDFileCMesh : public MEDFileStructuredMesh
658 static MEDFileCMesh *New();
659 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
660 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
661 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
666 return MEDFileCMesh::New();
669 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
671 return MEDFileCMesh::New(fileName);
674 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
676 return MEDFileCMesh::New(fileName,mName,dt,it);
679 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
681 const MEDCouplingCMesh *tmp=self->getMesh();
684 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
689 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
692 static MEDFileCurveLinearMesh *New();
693 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
694 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
695 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
698 MEDFileCurveLinearMesh()
700 return MEDFileCurveLinearMesh::New();
703 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
705 return MEDFileCurveLinearMesh::New(fileName);
708 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
710 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
713 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
715 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
718 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
723 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
726 static MEDFileMeshMultiTS *New();
727 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
728 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
729 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
730 const char *getName() const throw(INTERP_KERNEL::Exception);
731 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
732 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
737 return MEDFileMeshMultiTS::New();
740 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
742 return MEDFileMeshMultiTS::New(fileName);
745 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
747 return MEDFileMeshMultiTS::New(fileName,mName);
750 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
752 MEDFileMesh *ret=self->getOneTimeStep();
760 class MEDFileMeshesIterator
765 PyObject *next() throw(INTERP_KERNEL::Exception)
767 MEDFileMesh *ret=self->nextt();
771 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
775 PyErr_SetString(PyExc_StopIteration,"No more data.");
782 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
785 static MEDFileMeshes *New();
786 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
787 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
788 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
789 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
790 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
792 void resize(int newSize) throw(INTERP_KERNEL::Exception);
793 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
794 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
795 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
800 return MEDFileMeshes::New();
803 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
805 return MEDFileMeshes::New(fileName);
808 std::string __str__() const
810 return self->simpleRepr();
813 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
817 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
822 else if(PyString_Check(obj))
824 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
830 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
833 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
835 self->setMeshAtPos(obj,mesh);
839 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
841 return self->iterator();
844 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
846 MEDFileMesh *ret=self->getMeshAtPos(i);
851 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
853 MEDFileMesh *ret=self->getMeshWithName(mname);
861 class MEDFileFieldLoc : public RefCountObject
864 const std::string& getName() const;
865 int getDimension() const;
866 int getNumberOfGaussPoints() const;
867 int getNumberOfPointsInCells() const;
868 const std::vector<double>& getRefCoords() const;
869 const std::vector<double>& getGaussCoords() const;
870 const std::vector<double>& getGaussWeights() const;
871 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
874 std::string __str__() const throw(INTERP_KERNEL::Exception)
881 class MEDFileFieldGlobsReal
884 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
885 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
886 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
887 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
888 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
889 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
890 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
891 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
892 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
893 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
894 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
895 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
896 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
897 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
898 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
899 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
900 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
901 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
902 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
903 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
906 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
908 const DataArrayInt *ret=self->getProfile(pflName);
911 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
914 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
916 const DataArrayInt *ret=self->getProfileFromId(pflId);
919 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
922 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
924 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
926 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
929 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
931 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
933 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
936 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
938 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
939 return convertVecPairVecStToPy(ret);
942 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
944 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
945 return convertVecPairVecStToPy(ret);
948 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
950 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
951 self->changePflsNames(v);
954 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
956 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
957 self->changePflsRefsNamesGen(v);
960 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
962 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
963 self->changePflsNamesInStruct(v);
966 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
968 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
969 self->changeLocsNames(v);
972 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
974 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
975 self->changeLocsRefsNamesGen(v);
978 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
980 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
981 self->changeLocsNamesInStruct(v);
986 class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
989 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
990 static MEDFileField1TS *New();
991 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
992 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
993 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
994 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
995 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
996 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
998 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
999 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1000 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1001 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1002 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1003 MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1005 int getDimension() const throw(INTERP_KERNEL::Exception);
1006 int getIteration() const throw(INTERP_KERNEL::Exception);
1007 int getOrder() const throw(INTERP_KERNEL::Exception);
1008 std::string getName() throw(INTERP_KERNEL::Exception);
1009 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1010 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1011 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1012 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1013 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1014 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1015 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1018 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1020 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1025 return MEDFileField1TS::New();
1028 std::string __str__() const throw(INTERP_KERNEL::Exception)
1030 return self->simpleRepr();
1033 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1035 DataArrayInt *ret1=0;
1036 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1037 PyObject *ret=PyTuple_New(2);
1038 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1039 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1043 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1045 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1048 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1050 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1053 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1056 double tmp0=self->getTime(tmp1,tmp2);
1057 PyObject *res = PyList_New(3);
1058 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1059 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1060 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1064 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1066 std::pair<int,int> res=self->getDtIt();
1067 PyObject *elt=PyTuple_New(2);
1068 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1069 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1073 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1075 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1076 PyObject *ret2=PyList_New(ret.size());
1077 for(int i=0;i<(int)ret.size();i++)
1078 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1082 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1084 std::vector<int> ret1;
1085 int ret0=self->getNonEmptyLevels(mname,ret1);
1086 PyObject *elt=PyTuple_New(2);
1087 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1088 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1092 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1094 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1095 std::vector< std::vector<TypeOfField> > typesF;
1096 std::vector< std::vector<std::string> > pfls;
1097 std::vector< std::vector<std::string> > locs;
1098 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1100 PyObject *ret2=PyList_New(sz);
1101 for(int i=0;i<sz;i++)
1103 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1104 const std::vector<TypeOfField>& typesFI=typesF[i];
1105 const std::vector<std::string>& pflsI=pfls[i];
1106 const std::vector<std::string>& locsI=locs[i];
1107 PyObject *elt=PyTuple_New(2);
1108 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1109 int sz2=ret[i].size();
1110 PyObject *elt2=PyList_New(sz2);
1111 for(int j=0;j<sz2;j++)
1113 PyObject *elt3=PyTuple_New(4);
1114 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1115 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));
1116 PyTuple_SetItem(elt3,1,elt4);
1117 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1118 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1119 PyList_SetItem(elt2,j,elt3);
1121 PyTuple_SetItem(elt,1,elt2);
1122 PyList_SetItem(ret2,i,elt);
1127 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1129 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1130 std::vector< std::vector<TypeOfField> > typesF;
1131 std::vector< std::vector<std::string> > pfls;
1132 std::vector< std::vector<std::string> > locs;
1133 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1135 PyObject *ret2=PyList_New(sz);
1136 for(int i=0;i<sz;i++)
1138 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1139 const std::vector<TypeOfField>& typesFI=typesF[i];
1140 const std::vector<std::string>& pflsI=pfls[i];
1141 const std::vector<std::string>& locsI=locs[i];
1142 PyObject *elt=PyTuple_New(2);
1143 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1144 int sz2=ret[i].size();
1145 PyObject *elt2=PyList_New(sz2);
1146 for(int j=0;j<sz2;j++)
1148 PyObject *elt3=PyTuple_New(4);
1149 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1150 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1151 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1152 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1153 PyList_SetItem(elt2,j,elt3);
1155 PyTuple_SetItem(elt,1,elt2);
1156 PyList_SetItem(ret2,i,elt);
1161 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1163 DataArrayDouble *ret=self->getUndergroundDataArray();
1169 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1171 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1172 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1175 PyObject *ret=PyTuple_New(2);
1176 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1177 std::size_t sz=elt1Cpp.size();
1178 PyObject *elt=PyList_New(sz);
1179 for(std::size_t i=0;i<sz;i++)
1181 PyObject *elt1=PyTuple_New(2);
1182 PyObject *elt2=PyTuple_New(2);
1183 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1184 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1185 PyObject *elt3=PyTuple_New(2);
1186 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1187 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1188 PyTuple_SetItem(elt1,0,elt2);
1189 PyTuple_SetItem(elt1,1,elt3);
1190 PyList_SetItem(elt,i,elt1);
1192 PyTuple_SetItem(ret,1,elt);
1196 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1198 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1199 return self->changeMeshNames(modifTab);
1204 class MEDFileFieldMultiTSIterator
1209 PyObject *next() throw(INTERP_KERNEL::Exception)
1211 MEDFileField1TS *ret=self->nextt();
1213 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1216 PyErr_SetString(PyExc_StopIteration,"No more data.");
1223 class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1226 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1227 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1228 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1229 MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1231 MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1232 MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1233 MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1235 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1236 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1237 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1238 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1239 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1240 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1242 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1243 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1245 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1246 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1247 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1248 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1249 std::string getName() const throw(INTERP_KERNEL::Exception);
1250 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1251 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1252 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1253 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1256 MEDFileFieldMultiTS()
1258 return MEDFileFieldMultiTS::New();
1261 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1263 return MEDFileFieldMultiTS::New(fileName);
1266 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1268 return MEDFileFieldMultiTS::New(fileName,fieldName);
1271 std::string __str__() const throw(INTERP_KERNEL::Exception)
1273 return self->simpleRepr();
1276 int __len__() const throw(INTERP_KERNEL::Exception)
1278 return self->getNumberOfTS();
1281 MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1283 if(elt0 && PyInt_Check(elt0))
1285 int pos=PyInt_AS_LONG(elt0);
1286 return self->getTimeStepAtPos(pos);
1288 else if(elt0 && PyTuple_Check(elt0))
1290 if(PyTuple_Size(elt0)==2)
1292 PyObject *o0=PyTuple_GetItem(elt0,0);
1293 PyObject *o1=PyTuple_GetItem(elt0,1);
1294 if(PyInt_Check(o0) && PyInt_Check(o1))
1296 int iter=PyInt_AS_LONG(o0);
1297 int order=PyInt_AS_LONG(o1);
1298 return self->getTimeStep(iter,order);
1301 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 !");
1304 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 !");
1306 else if(elt0 && PyFloat_Check(elt0))
1308 double val=PyFloat_AS_DOUBLE(elt0);
1309 return self->getTimeStepGivenTime(val);
1312 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1315 MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1317 return self->iterator();
1320 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1322 DataArrayInt *ret1=0;
1323 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1324 PyObject *ret=PyTuple_New(2);
1325 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1326 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1330 PyObject *getIterations() const
1332 std::vector< std::pair<int,int> > res=self->getIterations();
1333 PyObject *ret=PyList_New(res.size());
1335 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1337 PyObject *elt=PyTuple_New(2);
1338 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1339 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1340 PyList_SetItem(ret,rk,elt);
1345 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1347 std::vector<double> ret1;
1348 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1349 std::size_t sz=ret.size();
1350 PyObject *ret2=PyList_New(sz);
1351 for(std::size_t i=0;i<sz;i++)
1353 PyObject *elt=PyTuple_New(3);
1354 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1355 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1356 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1357 PyList_SetItem(ret2,i,elt);
1362 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1364 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1365 PyObject *ret2=PyList_New(ret.size());
1366 for(int i=0;i<(int)ret.size();i++)
1368 const std::vector<TypeOfField>& rett=ret[i];
1369 PyObject *ret3=PyList_New(rett.size());
1370 for(int j=0;j<(int)rett.size();j++)
1371 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1372 PyList_SetItem(ret2,i,ret3);
1377 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1379 std::vector<int> ret1;
1380 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1381 PyObject *elt=PyTuple_New(2);
1382 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1383 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1387 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1389 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1390 std::vector< std::vector<TypeOfField> > typesF;
1391 std::vector< std::vector<std::string> > pfls;
1392 std::vector< std::vector<std::string> > locs;
1393 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1395 PyObject *ret2=PyList_New(sz);
1396 for(int i=0;i<sz;i++)
1398 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1399 const std::vector<TypeOfField>& typesFI=typesF[i];
1400 const std::vector<std::string>& pflsI=pfls[i];
1401 const std::vector<std::string>& locsI=locs[i];
1402 PyObject *elt=PyTuple_New(2);
1403 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1404 int sz2=ret[i].size();
1405 PyObject *elt2=PyList_New(sz2);
1406 for(int j=0;j<sz2;j++)
1408 PyObject *elt3=PyTuple_New(4);
1409 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1410 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));
1411 PyTuple_SetItem(elt3,1,elt4);
1412 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1413 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1414 PyList_SetItem(elt2,j,elt3);
1416 PyTuple_SetItem(elt,1,elt2);
1417 PyList_SetItem(ret2,i,elt);
1422 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1424 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1425 std::vector< std::vector<TypeOfField> > typesF;
1426 std::vector< std::vector<std::string> > pfls;
1427 std::vector< std::vector<std::string> > locs;
1428 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1430 PyObject *ret2=PyList_New(sz);
1431 for(int i=0;i<sz;i++)
1433 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1434 const std::vector<TypeOfField>& typesFI=typesF[i];
1435 const std::vector<std::string>& pflsI=pfls[i];
1436 const std::vector<std::string>& locsI=locs[i];
1437 PyObject *elt=PyTuple_New(2);
1438 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1439 int sz2=ret[i].size();
1440 PyObject *elt2=PyList_New(sz2);
1441 for(int j=0;j<sz2;j++)
1443 PyObject *elt3=PyTuple_New(4);
1444 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1445 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1446 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1447 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1448 PyList_SetItem(elt2,j,elt3);
1450 PyTuple_SetItem(elt,1,elt2);
1451 PyList_SetItem(ret2,i,elt);
1455 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1457 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1462 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1464 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1465 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1468 PyObject *ret=PyTuple_New(2);
1469 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1470 std::size_t sz=elt1Cpp.size();
1471 PyObject *elt=PyList_New(sz);
1472 for(std::size_t i=0;i<sz;i++)
1474 PyObject *elt1=PyTuple_New(2);
1475 PyObject *elt2=PyTuple_New(2);
1476 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1477 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1478 PyObject *elt3=PyTuple_New(2);
1479 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1480 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1481 PyTuple_SetItem(elt1,0,elt2);
1482 PyTuple_SetItem(elt1,1,elt3);
1483 PyList_SetItem(elt,i,elt1);
1485 PyTuple_SetItem(ret,1,elt);
1489 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1491 if(elt0 && PyInt_Check(elt0))
1493 int pos=PyInt_AS_LONG(elt0);
1496 else if(elt0 && PyTuple_Check(elt0))
1498 if(PyTuple_Size(elt0)==2)
1500 PyObject *o0=PyTuple_GetItem(elt0,0);
1501 PyObject *o1=PyTuple_GetItem(elt0,1);
1502 if(PyInt_Check(o0) && PyInt_Check(o1))
1504 int iter=PyInt_AS_LONG(o0);
1505 int order=PyInt_AS_LONG(o1);
1506 return self->getPosOfTimeStep(iter,order);
1509 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 !");
1512 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 !");
1514 else if(elt0 && PyFloat_Check(elt0))
1516 double val=PyFloat_AS_DOUBLE(elt0);
1517 return self->getPosGivenTime(val);
1520 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1523 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1525 if(PyList_Check(elts))
1527 int sz=PyList_Size(elts);
1528 std::vector<int> ret(sz);
1529 for(int i=0;i<sz;i++)
1531 PyObject *elt=PyList_GetItem(elts,i);
1532 ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1538 std::vector<int> ret(1);
1539 ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1544 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1546 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1547 if(!idsToRemove.empty())
1548 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1551 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1555 std::vector<int> pos2;
1556 DataArrayInt *pos3=0;
1557 DataArrayIntTuple *pos4=0;
1558 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1563 self->eraseTimeStepIds(&pos1,&pos1+1);
1570 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1575 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1579 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1583 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1585 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1586 return self->changeMeshNames(modifTab);
1591 class MEDFileFieldsIterator
1596 PyObject *next() throw(INTERP_KERNEL::Exception)
1598 MEDFileFieldMultiTS *ret=self->nextt();
1600 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1603 PyErr_SetString(PyExc_StopIteration,"No more data.");
1610 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1613 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1614 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1615 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
1616 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1617 int getNumberOfFields() const;
1618 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1619 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1621 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1622 void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1623 void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1624 MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1625 MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1626 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1631 return MEDFileFields::New();
1634 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1636 return MEDFileFields::New(fileName);
1639 std::string __str__() const throw(INTERP_KERNEL::Exception)
1641 return self->simpleRepr();
1644 MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1646 if(PyInt_Check(obj))
1648 return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1650 else if(PyString_Check(obj))
1652 return self->getFieldWithName(PyString_AsString(obj));
1655 throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1658 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1660 self->setFieldAtPos(obj,field);
1664 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1666 return self->iterator();
1669 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1671 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1672 return self->changeMeshNames(modifTab);
1677 class MEDFileData : public RefCountObject, public MEDFileWritable
1680 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1681 static MEDFileData *New();
1682 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
1683 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
1684 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
1685 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
1686 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
1688 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
1689 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
1691 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1694 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
1696 return MEDFileData::New(fileName);
1701 return MEDFileData::New();
1704 std::string __str__() const throw(INTERP_KERNEL::Exception)
1706 return self->simpleRepr();
1709 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
1711 MEDFileMeshes *ret=self->getMeshes();
1717 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
1719 MEDFileFields *ret=self->getFields();
1725 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1727 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1728 return self->changeMeshNames(modifTab);
1733 class SauvReader : public RefCountObject
1736 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
1737 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
1740 class SauvWriter : public RefCountObject
1743 static SauvWriter * New();
1744 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
1745 void write(const char* fileName) throw(INTERP_KERNEL::Exception);