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
22 #define MEDCOUPLING_EXPORT
23 #define MEDLOADER_EXPORT
25 %include "MEDCouplingCommon.i"
28 #include "MEDLoader.hxx"
29 #include "MEDFileMesh.hxx"
30 #include "MEDFileField.hxx"
31 #include "MEDFileData.hxx"
32 #include "MEDLoaderTypemaps.i"
33 #include "SauvReader.hxx"
34 #include "SauvWriter.hxx"
36 using namespace ParaMEDMEM;
39 #if SWIG_VERSION >= 0x010329
40 %template() std::vector<std::string>;
43 %typemap(out) ParaMEDMEM::MEDFileMesh*
45 $result=convertMEDFileMesh($1,$owner);
48 %newobject MEDLoader::ReadUMeshFromFamilies;
49 %newobject MEDLoader::ReadUMeshFromGroups;
50 %newobject MEDLoader::ReadUMeshFromFile;
51 %newobject MEDLoader::ReadField;
52 %newobject MEDLoader::ReadFieldCell;
53 %newobject MEDLoader::ReadFieldNode;
54 %newobject MEDLoader::ReadFieldGauss;
55 %newobject MEDLoader::ReadFieldGaussNE;
56 %newobject ParaMEDMEM::MEDFileMesh::New;
57 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
58 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
59 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
60 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
61 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
62 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
63 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
64 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
65 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
66 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
67 %newobject ParaMEDMEM::MEDFileUMesh::New;
68 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
69 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
70 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
71 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
72 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
73 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
74 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
75 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
76 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
77 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
78 %newobject ParaMEDMEM::MEDFileCMesh::New;
79 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
80 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
81 %newobject ParaMEDMEM::MEDFileMeshes::New;
82 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
83 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
84 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
85 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
87 %newobject ParaMEDMEM::MEDFileFields::New;
88 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
89 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
90 %newobject ParaMEDMEM::MEDFileFields::__getitem__;
91 %newobject ParaMEDMEM::MEDFileFields::__iter__;
92 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
93 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
94 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
95 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
96 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
97 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
98 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
99 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
100 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
101 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
102 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
103 %newobject ParaMEDMEM::MEDFileField1TS::New;
104 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
105 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
106 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
107 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
108 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
110 %newobject ParaMEDMEM::MEDFileData::New;
111 %newobject ParaMEDMEM::MEDFileData::getMeshes;
112 %newobject ParaMEDMEM::MEDFileData::getFields;
114 %newobject ParaMEDMEM::SauvWriter::New;
115 %newobject ParaMEDMEM::SauvReader::New;
116 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
118 %feature("unref") MEDFileMesh "$this->decrRef();"
119 %feature("unref") MEDFileUMesh "$this->decrRef();"
120 %feature("unref") MEDFileCMesh "$this->decrRef();"
121 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
122 %feature("unref") MEDFileMeshes "$this->decrRef();"
123 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
124 %feature("unref") MEDFileField1TS "$this->decrRef();"
125 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
126 %feature("unref") MEDFileFields "$this->decrRef();"
127 %feature("unref") MEDFileData "$this->decrRef();"
128 %feature("unref") SauvReader "$this->decrRef();"
129 %feature("unref") SauvWriter "$this->decrRef();"
134 static void setEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
135 static void setCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
136 static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
137 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
138 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
139 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
140 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
141 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
142 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
143 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
144 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
145 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
146 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
147 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
148 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
149 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
152 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
154 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
155 PyObject *ret=PyList_New(res.size());
157 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
159 PyObject *elt=PyTuple_New(2);
160 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
161 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
162 PyList_SetItem(ret,rk,elt);
167 static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
169 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
170 PyObject *ret=PyList_New(res.size());
172 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
174 PyObject *elt=PyTuple_New(3);
175 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
176 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
177 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
178 PyList_SetItem(ret,rk,elt);
183 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
185 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
186 PyObject *ret=PyList_New(res.size());
188 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
190 PyObject *elt=PyTuple_New(2);
191 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
192 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
193 PyList_SetItem(ret,rk,elt);
197 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
199 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
200 PyObject *ret=PyList_New(res.size());
202 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
204 PyObject *elt=PyTuple_New(2);
205 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
206 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
207 PyList_SetItem(ret,rk,elt);
211 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
213 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
214 PyObject *ret=PyList_New(res.size());
216 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
218 PyObject *elt=PyTuple_New(2);
219 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
220 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
221 PyList_SetItem(ret,rk,elt);
225 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
227 int meshDim,spaceDim,numberOfNodes;
228 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
229 PyObject *ret=PyTuple_New(4);
230 PyObject *elt0=PyList_New(res.size());
232 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
234 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
236 PyObject *elt1=PyList_New(obj2.size());
237 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
239 PyObject *elt2=PyTuple_New(2);
240 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
241 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
242 PyList_SetItem(elt1,j,elt2);
244 PyList_SetItem(elt0,i,elt1);
246 PyTuple_SetItem(ret,0,elt0);
247 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
248 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
249 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
252 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
253 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
255 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
256 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
257 return convertFieldDoubleVecToPy(res);
259 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
261 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
262 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
263 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
265 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
267 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
268 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
269 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
271 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
273 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
274 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
275 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
277 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
279 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
281 PyObject *ret=PyList_New(size);
282 for(int i=0;i<size;i++)
283 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
286 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
288 std::vector<std::string> grps;
289 converPyListToVecString(li,grps);
290 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
292 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
294 std::vector<std::string> fams;
295 converPyListToVecString(li,fams);
296 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
299 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
300 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
301 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
302 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);
303 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
304 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
305 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
306 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
307 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
308 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
309 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
310 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
311 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
316 class MEDFileWritable
319 void copyOptionsFrom(const MEDFileWritable& other) const;
320 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
321 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
322 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
323 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
326 class MEDFileMesh : public RefCountObject, public MEDFileWritable
329 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
330 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1);
331 virtual void clearNonDiscrAttributes() const;
332 void setName(const char *name);
333 const char *getName();
334 void setUnivName(const char *name);
335 const char *getUnivName() const;
336 void setDescription(const char *name);
337 const char *getDescription() const;
338 void setOrder(int order);
339 int getOrder() const;
340 void setIteration(int it);
342 void setTimeValue(double time);
343 void setTime(int dt, int it, double time);
344 double getTimeValue() const;
345 void setTimeUnit(const char *unit);
346 const char *getTimeUnit() const;
347 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
348 std::vector<int> getNonEmptyLevels() const;
349 std::vector<int> getNonEmptyLevelsExt() const;
350 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
351 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
353 bool existsGroup(const char *groupName) const;
354 bool existsFamily(int famId) const;
355 bool existsFamily(const char *familyName) const;
356 void setFamilyId(const char *familyName, int id);
357 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
358 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
359 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
360 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
361 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
362 void copyFamGrpMapsFrom(const MEDFileMesh& other);
363 const std::map<std::string,int>& getFamilyInfo() const;
364 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
365 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
366 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
367 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
368 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
369 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
370 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
371 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
372 std::vector<std::string> getGroupsNames() const;
373 std::vector<std::string> getFamiliesNames() const;
374 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
375 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
376 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
377 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
378 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
379 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
380 void setFamilyInfo(const std::map<std::string,int>& info);
381 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
382 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
383 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
384 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
385 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
386 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
387 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
388 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
389 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
390 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
391 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
392 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
393 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
395 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
396 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
397 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
398 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
399 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
400 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
401 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
402 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
403 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
404 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
405 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
408 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
410 return MEDFileMesh::New(fileName);
413 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1)
415 return MEDFileMesh::New(fileName,mName,dt,it);
418 std::string __str__() const throw(INTERP_KERNEL::Exception)
420 return self->simpleRepr();
423 PyObject *getTime() throw(INTERP_KERNEL::Exception)
426 double tmp0=self->getTime(tmp1,tmp2);
427 PyObject *res = PyList_New(3);
428 PyList_SetItem(res,0,SWIG_From_int(tmp1));
429 PyList_SetItem(res,1,SWIG_From_int(tmp2));
430 PyList_SetItem(res,2,SWIG_From_double(tmp0));
434 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
437 bool ret0=self->isEqual(other,eps,what);
438 PyObject *res=PyList_New(2);
439 PyObject *ret0Py=ret0?Py_True:Py_False;
441 PyList_SetItem(res,0,ret0Py);
442 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
446 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
449 bool ret0=self->areFamsEqual(other,what);
450 PyObject *res=PyList_New(2);
451 PyObject *ret0Py=ret0?Py_True:Py_False;
453 PyList_SetItem(res,0,ret0Py);
454 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
458 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
461 bool ret0=self->areGrpsEqual(other,what);
462 PyObject *res=PyList_New(2);
463 PyObject *ret0Py=ret0?Py_True:Py_False;
465 PyList_SetItem(res,0,ret0Py);
466 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
470 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
472 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
475 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
478 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
480 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
483 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
486 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
489 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
490 PyObject *ret=PyTuple_New(2);
491 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
492 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
496 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
498 DataArrayInt *ret3=0;
499 std::vector<int> ret1,ret2;
500 bool ret0=self->unPolyze(ret1,ret2,ret3);
501 PyObject *ret=PyTuple_New(4);
502 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
504 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
505 for(int j=0;j<(int)ret1.size()/3;j++)
507 PyObject *retLev2=PyList_New(3);
508 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
509 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
510 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
511 PyList_SetItem(retLev1_0,j,retLev2);
513 PyTuple_SetItem(ret,1,retLev1_0);
515 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
516 for(int j=0;j<(int)ret2.size()/3;j++)
518 PyObject *retLev2=PyList_New(3);
519 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
520 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
521 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
522 PyList_SetItem(retLev1_1,j,retLev2);
524 PyTuple_SetItem(ret,2,retLev1_1);
526 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
532 class MEDFileUMesh : public MEDFileMesh
535 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
536 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
537 static MEDFileUMesh *New();
539 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
541 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
542 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
543 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
544 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
545 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
546 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
547 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
548 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
549 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
550 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
551 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
552 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
553 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
554 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
555 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
556 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
557 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
558 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
559 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
560 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
561 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
562 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
563 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
564 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
565 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
566 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
568 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
569 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
570 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
571 void addNodeGroup(const std::string& name, const std::vector<int>& ids) throw(INTERP_KERNEL::Exception);
572 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
573 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
574 void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
575 void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
576 void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
577 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
580 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
582 return MEDFileUMesh::New(fileName,mName,dt,it);
585 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
587 return MEDFileUMesh::New(fileName);
592 return MEDFileUMesh::New();
595 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
597 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
600 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
603 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
605 std::vector<const DataArrayInt *> grps;
606 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
607 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
610 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
612 DataArrayDouble *ret=self->getCoords();
618 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
620 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
621 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
622 PyObject *ret=PyTuple_New(3);
623 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
624 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
625 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
631 class MEDFileCMesh : public MEDFileMesh
634 static MEDFileCMesh *New();
635 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
636 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
637 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
642 return MEDFileCMesh::New();
645 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
647 return MEDFileCMesh::New(fileName);
650 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
652 return MEDFileCMesh::New(fileName,mName,dt,it);
655 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
657 const MEDCouplingCMesh *tmp=self->getMesh();
660 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
665 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
668 static MEDFileMeshMultiTS *New();
669 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
670 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
671 const char *getName() const throw(INTERP_KERNEL::Exception);
672 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
673 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
678 return MEDFileMeshMultiTS::New();
681 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
683 return MEDFileMeshMultiTS::New(fileName);
686 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
688 return MEDFileMeshMultiTS::New(fileName,mName);
691 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
693 MEDFileMesh *ret=self->getOneTimeStep();
701 class MEDFileMeshesIterator
706 PyObject *next() throw(INTERP_KERNEL::Exception)
708 MEDFileMesh *ret=self->nextt();
712 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
716 PyErr_SetString(PyExc_StopIteration,"No more data.");
723 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
726 static MEDFileMeshes *New();
727 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
728 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
729 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
730 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
732 void resize(int newSize) throw(INTERP_KERNEL::Exception);
733 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
734 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
735 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
740 return MEDFileMeshes::New();
743 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
745 return MEDFileMeshes::New(fileName);
748 std::string __str__() const
750 return self->simpleRepr();
753 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
757 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
762 else if(PyString_Check(obj))
764 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
770 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
773 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
775 self->setMeshAtPos(obj,mesh);
779 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
781 return self->iterator();
784 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
786 MEDFileMesh *ret=self->getMeshAtPos(i);
791 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
793 MEDFileMesh *ret=self->getMeshWithName(mname);
801 class MEDFileFieldLoc : public RefCountObject
804 const std::string& getName() const;
805 int getDimension() const;
806 int getNumberOfGaussPoints() const;
807 int getNumberOfPointsInCells() const;
808 const std::vector<double>& getRefCoords() const;
809 const std::vector<double>& getGaussCoords() const;
810 const std::vector<double>& getGaussWeights() const;
811 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
814 std::string __str__() const throw(INTERP_KERNEL::Exception)
821 class MEDFileFieldGlobsReal
824 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
825 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
826 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
827 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
828 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
829 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
830 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
831 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
832 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
833 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
834 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
835 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
836 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
837 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
838 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
839 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
840 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
841 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
842 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
845 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
847 const DataArrayInt *ret=self->getProfile(pflName);
850 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
853 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
855 const DataArrayInt *ret=self->getProfileFromId(pflId);
858 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
861 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
863 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
865 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
868 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
870 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
872 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
875 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
877 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
878 return convertVecPairVecStToPy(ret);
881 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
883 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
884 return convertVecPairVecStToPy(ret);
887 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
889 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
890 self->changePflsNames(v);
893 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
895 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
896 self->changePflsRefsNamesGen(v);
899 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
901 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
902 self->changePflsNamesInStruct(v);
905 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
907 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
908 self->changeLocsNames(v);
911 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
913 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
914 self->changeLocsRefsNamesGen(v);
917 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
919 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
920 self->changeLocsNamesInStruct(v);
925 class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
928 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
929 static MEDFileField1TS *New();
930 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
931 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
932 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
933 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
934 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
935 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
937 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
938 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
939 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
940 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
941 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
943 int getDimension() const throw(INTERP_KERNEL::Exception);
944 int getIteration() const throw(INTERP_KERNEL::Exception);
945 int getOrder() const throw(INTERP_KERNEL::Exception);
946 std::string getName() throw(INTERP_KERNEL::Exception);
947 void setName(const char *name) throw(INTERP_KERNEL::Exception);
948 std::string getMeshName() throw(INTERP_KERNEL::Exception);
949 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
950 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
951 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
952 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
953 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
956 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
958 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
963 return MEDFileField1TS::New();
966 std::string __str__() const throw(INTERP_KERNEL::Exception)
968 return self->simpleRepr();
971 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
973 DataArrayInt *ret1=0;
974 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
975 PyObject *ret=PyTuple_New(2);
976 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
977 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
981 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
983 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
986 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
988 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
991 PyObject *getTime() throw(INTERP_KERNEL::Exception)
994 double tmp0=self->getTime(tmp1,tmp2);
995 PyObject *res = PyList_New(3);
996 PyList_SetItem(res,0,SWIG_From_int(tmp1));
997 PyList_SetItem(res,1,SWIG_From_int(tmp2));
998 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1002 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1004 std::pair<int,int> res=self->getDtIt();
1005 PyObject *elt=PyTuple_New(2);
1006 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1007 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1011 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1013 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1014 PyObject *ret2=PyList_New(ret.size());
1015 for(int i=0;i<(int)ret.size();i++)
1016 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1020 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1022 std::vector<int> ret1;
1023 int ret0=self->getNonEmptyLevels(mname,ret1);
1024 PyObject *elt=PyTuple_New(2);
1025 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1026 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1030 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1032 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1033 std::vector< std::vector<TypeOfField> > typesF;
1034 std::vector< std::vector<std::string> > pfls;
1035 std::vector< std::vector<std::string> > locs;
1036 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1038 PyObject *ret2=PyList_New(sz);
1039 for(int i=0;i<sz;i++)
1041 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1042 const std::vector<TypeOfField>& typesFI=typesF[i];
1043 const std::vector<std::string>& pflsI=pfls[i];
1044 const std::vector<std::string>& locsI=locs[i];
1045 PyObject *elt=PyTuple_New(2);
1046 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1047 int sz2=ret[i].size();
1048 PyObject *elt2=PyList_New(sz2);
1049 for(int j=0;j<sz2;j++)
1051 PyObject *elt3=PyTuple_New(4);
1052 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1053 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));
1054 PyTuple_SetItem(elt3,1,elt4);
1055 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1056 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1057 PyList_SetItem(elt2,j,elt3);
1059 PyTuple_SetItem(elt,1,elt2);
1060 PyList_SetItem(ret2,i,elt);
1065 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1067 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1068 std::vector< std::vector<TypeOfField> > typesF;
1069 std::vector< std::vector<std::string> > pfls;
1070 std::vector< std::vector<std::string> > locs;
1071 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1073 PyObject *ret2=PyList_New(sz);
1074 for(int i=0;i<sz;i++)
1076 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1077 const std::vector<TypeOfField>& typesFI=typesF[i];
1078 const std::vector<std::string>& pflsI=pfls[i];
1079 const std::vector<std::string>& locsI=locs[i];
1080 PyObject *elt=PyTuple_New(2);
1081 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1082 int sz2=ret[i].size();
1083 PyObject *elt2=PyList_New(sz2);
1084 for(int j=0;j<sz2;j++)
1086 PyObject *elt3=PyTuple_New(4);
1087 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1088 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1089 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1090 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1091 PyList_SetItem(elt2,j,elt3);
1093 PyTuple_SetItem(elt,1,elt2);
1094 PyList_SetItem(ret2,i,elt);
1099 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1101 DataArrayDouble *ret=self->getUndergroundDataArray();
1107 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1109 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1110 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1113 PyObject *ret=PyTuple_New(2);
1114 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1115 std::size_t sz=elt1Cpp.size();
1116 PyObject *elt=PyList_New(sz);
1117 for(std::size_t i=0;i<sz;i++)
1119 PyObject *elt1=PyTuple_New(2);
1120 PyObject *elt2=PyTuple_New(2);
1121 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1122 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1123 PyObject *elt3=PyTuple_New(2);
1124 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1125 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1126 PyTuple_SetItem(elt1,0,elt2);
1127 PyTuple_SetItem(elt1,1,elt3);
1128 PyList_SetItem(elt,i,elt1);
1130 PyTuple_SetItem(ret,1,elt);
1134 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1136 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1137 return self->changeMeshNames(modifTab);
1142 class MEDFileFieldMultiTSIterator
1147 PyObject *next() throw(INTERP_KERNEL::Exception)
1149 MEDFileField1TS *ret=self->nextt();
1151 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1154 PyErr_SetString(PyExc_StopIteration,"No more data.");
1161 class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1164 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1165 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1166 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1168 MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1169 MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1170 MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1172 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1173 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1174 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1175 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1176 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1177 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1179 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1180 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1182 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1183 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1184 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1185 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1186 std::string getName() const throw(INTERP_KERNEL::Exception);
1187 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1188 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1189 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1190 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1193 MEDFileFieldMultiTS()
1195 return MEDFileFieldMultiTS::New();
1198 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1200 return MEDFileFieldMultiTS::New(fileName);
1203 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1205 return MEDFileFieldMultiTS::New(fileName,fieldName);
1208 std::string __str__() const throw(INTERP_KERNEL::Exception)
1210 return self->simpleRepr();
1213 MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1215 if(elt0 && PyInt_Check(elt0))
1217 int pos=PyInt_AS_LONG(elt0);
1218 return self->getTimeStepAtPos(pos);
1220 else if(elt0 && PyTuple_Check(elt0))
1222 if(PyTuple_Size(elt0)==2)
1224 PyObject *o0=PyTuple_GetItem(elt0,0);
1225 PyObject *o1=PyTuple_GetItem(elt0,1);
1226 if(PyInt_Check(o0) && PyInt_Check(o1))
1228 int iter=PyInt_AS_LONG(o0);
1229 int order=PyInt_AS_LONG(o1);
1230 return self->getTimeStep(iter,order);
1233 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 !");
1236 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 !");
1238 else if(elt0 && PyFloat_Check(elt0))
1240 double val=PyFloat_AS_DOUBLE(elt0);
1241 return self->getTimeStepGivenTime(val);
1244 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1247 MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1249 return self->iterator();
1252 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1254 DataArrayInt *ret1=0;
1255 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1256 PyObject *ret=PyTuple_New(2);
1257 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1258 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1262 PyObject *getIterations() const
1264 std::vector< std::pair<int,int> > res=self->getIterations();
1265 PyObject *ret=PyList_New(res.size());
1267 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1269 PyObject *elt=PyTuple_New(2);
1270 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1271 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1272 PyList_SetItem(ret,rk,elt);
1277 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1279 std::vector<double> ret1;
1280 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1281 std::size_t sz=ret.size();
1282 PyObject *ret2=PyList_New(sz);
1283 for(std::size_t i=0;i<sz;i++)
1285 PyObject *elt=PyTuple_New(3);
1286 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1287 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1288 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1289 PyList_SetItem(ret2,i,elt);
1294 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1296 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1297 PyObject *ret2=PyList_New(ret.size());
1298 for(int i=0;i<(int)ret.size();i++)
1300 const std::vector<TypeOfField>& rett=ret[i];
1301 PyObject *ret3=PyList_New(rett.size());
1302 for(int j=0;j<(int)rett.size();j++)
1303 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1304 PyList_SetItem(ret2,i,ret3);
1309 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1311 std::vector<int> ret1;
1312 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1313 PyObject *elt=PyTuple_New(2);
1314 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1315 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1319 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1321 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1322 std::vector< std::vector<TypeOfField> > typesF;
1323 std::vector< std::vector<std::string> > pfls;
1324 std::vector< std::vector<std::string> > locs;
1325 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1327 PyObject *ret2=PyList_New(sz);
1328 for(int i=0;i<sz;i++)
1330 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1331 const std::vector<TypeOfField>& typesFI=typesF[i];
1332 const std::vector<std::string>& pflsI=pfls[i];
1333 const std::vector<std::string>& locsI=locs[i];
1334 PyObject *elt=PyTuple_New(2);
1335 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1336 int sz2=ret[i].size();
1337 PyObject *elt2=PyList_New(sz2);
1338 for(int j=0;j<sz2;j++)
1340 PyObject *elt3=PyTuple_New(4);
1341 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1342 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));
1343 PyTuple_SetItem(elt3,1,elt4);
1344 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1345 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1346 PyList_SetItem(elt2,j,elt3);
1348 PyTuple_SetItem(elt,1,elt2);
1349 PyList_SetItem(ret2,i,elt);
1354 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1356 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1357 std::vector< std::vector<TypeOfField> > typesF;
1358 std::vector< std::vector<std::string> > pfls;
1359 std::vector< std::vector<std::string> > locs;
1360 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1362 PyObject *ret2=PyList_New(sz);
1363 for(int i=0;i<sz;i++)
1365 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1366 const std::vector<TypeOfField>& typesFI=typesF[i];
1367 const std::vector<std::string>& pflsI=pfls[i];
1368 const std::vector<std::string>& locsI=locs[i];
1369 PyObject *elt=PyTuple_New(2);
1370 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1371 int sz2=ret[i].size();
1372 PyObject *elt2=PyList_New(sz2);
1373 for(int j=0;j<sz2;j++)
1375 PyObject *elt3=PyTuple_New(4);
1376 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1377 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1378 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1379 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1380 PyList_SetItem(elt2,j,elt3);
1382 PyTuple_SetItem(elt,1,elt2);
1383 PyList_SetItem(ret2,i,elt);
1387 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1389 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1394 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1396 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1397 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1400 PyObject *ret=PyTuple_New(2);
1401 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1402 std::size_t sz=elt1Cpp.size();
1403 PyObject *elt=PyList_New(sz);
1404 for(std::size_t i=0;i<sz;i++)
1406 PyObject *elt1=PyTuple_New(2);
1407 PyObject *elt2=PyTuple_New(2);
1408 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1409 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1410 PyObject *elt3=PyTuple_New(2);
1411 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1412 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1413 PyTuple_SetItem(elt1,0,elt2);
1414 PyTuple_SetItem(elt1,1,elt3);
1415 PyList_SetItem(elt,i,elt1);
1417 PyTuple_SetItem(ret,1,elt);
1421 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1423 if(elt0 && PyInt_Check(elt0))
1425 int pos=PyInt_AS_LONG(elt0);
1428 else if(elt0 && PyTuple_Check(elt0))
1430 if(PyTuple_Size(elt0)==2)
1432 PyObject *o0=PyTuple_GetItem(elt0,0);
1433 PyObject *o1=PyTuple_GetItem(elt0,1);
1434 if(PyInt_Check(o0) && PyInt_Check(o1))
1436 int iter=PyInt_AS_LONG(o0);
1437 int order=PyInt_AS_LONG(o1);
1438 return self->getPosOfTimeStep(iter,order);
1441 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 !");
1444 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 !");
1446 else if(elt0 && PyFloat_Check(elt0))
1448 double val=PyFloat_AS_DOUBLE(elt0);
1449 return self->getPosGivenTime(val);
1452 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1455 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1457 if(PyList_Check(elts))
1459 int sz=PyList_Size(elts);
1460 std::vector<int> ret(sz);
1461 for(int i=0;i<sz;i++)
1463 PyObject *elt=PyList_GetItem(elts,i);
1464 ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1470 std::vector<int> ret(1);
1471 ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1476 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1478 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1479 if(!idsToRemove.empty())
1480 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1483 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1487 std::vector<int> pos2;
1488 DataArrayInt *pos3=0;
1489 DataArrayIntTuple *pos4=0;
1490 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1495 self->eraseTimeStepIds(&pos1,&pos1+1);
1502 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1507 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1511 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1515 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1517 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1518 return self->changeMeshNames(modifTab);
1523 class MEDFileFieldsIterator
1528 PyObject *next() throw(INTERP_KERNEL::Exception)
1530 MEDFileFieldMultiTS *ret=self->nextt();
1532 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1535 PyErr_SetString(PyExc_StopIteration,"No more data.");
1542 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1545 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1546 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1547 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1548 int getNumberOfFields() const;
1549 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1550 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1552 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1553 void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1554 void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1555 MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1556 MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1557 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1562 return MEDFileFields::New();
1565 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1567 return MEDFileFields::New(fileName);
1570 std::string __str__() const throw(INTERP_KERNEL::Exception)
1572 return self->simpleRepr();
1575 MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1577 if(PyInt_Check(obj))
1579 return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1581 else if(PyString_Check(obj))
1583 return self->getFieldWithName(PyString_AsString(obj));
1586 throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1589 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1591 self->setFieldAtPos(obj,field);
1595 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1597 return self->iterator();
1600 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1602 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1603 return self->changeMeshNames(modifTab);
1608 class MEDFileData : public RefCountObject, public MEDFileWritable
1611 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1612 static MEDFileData *New();
1613 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
1614 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
1615 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
1616 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
1618 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
1619 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
1621 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1624 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
1626 return MEDFileData::New(fileName);
1631 return MEDFileData::New();
1634 std::string __str__() const throw(INTERP_KERNEL::Exception)
1636 return self->simpleRepr();
1639 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
1641 MEDFileMeshes *ret=self->getMeshes();
1647 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
1649 MEDFileFields *ret=self->getFields();
1655 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1657 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1658 return self->changeMeshNames(modifTab);
1663 class SauvReader : public RefCountObject
1666 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
1667 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
1670 class SauvWriter : public RefCountObject
1673 static SauvWriter * New();
1674 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
1675 void write(const char* fileName) throw(INTERP_KERNEL::Exception);