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::getGenMeshAtLevel;
59 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
60 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
61 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
62 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
63 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
64 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
65 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
66 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
67 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
68 %newobject ParaMEDMEM::MEDFileUMesh::New;
69 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
70 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
71 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
72 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
73 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
74 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
75 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
76 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
77 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
78 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
79 %newobject ParaMEDMEM::MEDFileCMesh::New;
80 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
81 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
82 %newobject ParaMEDMEM::MEDFileMeshes::New;
83 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
84 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
85 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
86 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
88 %newobject ParaMEDMEM::MEDFileFields::New;
89 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
90 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
91 %newobject ParaMEDMEM::MEDFileFields::__getitem__;
92 %newobject ParaMEDMEM::MEDFileFields::__iter__;
93 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
94 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
95 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
96 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
97 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
98 %newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
99 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
100 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
101 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
102 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
103 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
104 %newobject ParaMEDMEM::MEDFileField1TS::New;
105 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
106 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
107 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
108 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
109 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
111 %newobject ParaMEDMEM::MEDFileData::New;
112 %newobject ParaMEDMEM::MEDFileData::getMeshes;
113 %newobject ParaMEDMEM::MEDFileData::getFields;
115 %newobject ParaMEDMEM::SauvWriter::New;
116 %newobject ParaMEDMEM::SauvReader::New;
117 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
119 %feature("unref") MEDFileMesh "$this->decrRef();"
120 %feature("unref") MEDFileUMesh "$this->decrRef();"
121 %feature("unref") MEDFileCMesh "$this->decrRef();"
122 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
123 %feature("unref") MEDFileMeshes "$this->decrRef();"
124 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
125 %feature("unref") MEDFileField1TS "$this->decrRef();"
126 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
127 %feature("unref") MEDFileFields "$this->decrRef();"
128 %feature("unref") MEDFileData "$this->decrRef();"
129 %feature("unref") SauvReader "$this->decrRef();"
130 %feature("unref") SauvWriter "$this->decrRef();"
135 static void setEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
136 static void setCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
137 static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
138 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
139 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
140 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
141 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
142 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
143 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
144 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
145 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
146 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
147 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
148 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
149 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
150 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
153 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
155 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
156 PyObject *ret=PyList_New(res.size());
158 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
160 PyObject *elt=PyTuple_New(2);
161 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
162 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
163 PyList_SetItem(ret,rk,elt);
168 static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
170 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
171 PyObject *ret=PyList_New(res.size());
173 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
175 PyObject *elt=PyTuple_New(3);
176 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
177 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
178 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
179 PyList_SetItem(ret,rk,elt);
184 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
186 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
187 PyObject *ret=PyList_New(res.size());
189 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
191 PyObject *elt=PyTuple_New(2);
192 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
193 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
194 PyList_SetItem(ret,rk,elt);
198 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
200 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
201 PyObject *ret=PyList_New(res.size());
203 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
205 PyObject *elt=PyTuple_New(2);
206 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
207 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
208 PyList_SetItem(ret,rk,elt);
212 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
214 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
215 PyObject *ret=PyList_New(res.size());
217 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
219 PyObject *elt=PyTuple_New(2);
220 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
221 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
222 PyList_SetItem(ret,rk,elt);
226 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
228 int meshDim,spaceDim,numberOfNodes;
229 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
230 PyObject *ret=PyTuple_New(4);
231 PyObject *elt0=PyList_New(res.size());
233 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
235 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
237 PyObject *elt1=PyList_New(obj2.size());
238 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
240 PyObject *elt2=PyTuple_New(2);
241 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
242 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
243 PyList_SetItem(elt1,j,elt2);
245 PyList_SetItem(elt0,i,elt1);
247 PyTuple_SetItem(ret,0,elt0);
248 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
249 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
250 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
253 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
254 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
256 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
257 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
258 return convertFieldDoubleVecToPy(res);
260 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
262 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
263 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
264 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
266 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
268 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
269 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
270 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
272 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
274 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
275 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
276 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
278 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
280 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
282 PyObject *ret=PyList_New(size);
283 for(int i=0;i<size;i++)
284 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
287 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
289 std::vector<std::string> grps;
290 converPyListToVecString(li,grps);
291 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
293 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
295 std::vector<std::string> fams;
296 converPyListToVecString(li,fams);
297 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
300 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
301 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
302 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
303 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);
304 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
305 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
306 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
307 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
308 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
309 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
310 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
311 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
312 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
317 class MEDFileWritable
320 void copyOptionsFrom(const MEDFileWritable& other) const;
321 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
322 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
323 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
324 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
327 class MEDFileMesh : public RefCountObject, public MEDFileWritable
330 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
331 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1);
332 virtual void clearNonDiscrAttributes() const;
333 void setName(const char *name);
334 const char *getName();
335 void setUnivName(const char *name);
336 const char *getUnivName() const;
337 void setDescription(const char *name);
338 const char *getDescription() const;
339 void setOrder(int order);
340 int getOrder() const;
341 void setIteration(int it);
343 void setTimeValue(double time);
344 void setTime(int dt, int it, double time);
345 double getTimeValue() const;
346 void setTimeUnit(const char *unit);
347 const char *getTimeUnit() const;
348 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
349 std::vector<int> getNonEmptyLevels() const;
350 std::vector<int> getNonEmptyLevelsExt() const;
351 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
352 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
354 bool existsGroup(const char *groupName) const;
355 bool existsFamily(int famId) const;
356 bool existsFamily(const char *familyName) const;
357 void setFamilyId(const char *familyName, int id);
358 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
359 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
360 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
361 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
362 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
363 void copyFamGrpMapsFrom(const MEDFileMesh& other);
364 const std::map<std::string,int>& getFamilyInfo() const;
365 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
366 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
367 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
368 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
369 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
370 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
371 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
372 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
373 std::vector<std::string> getGroupsNames() const;
374 std::vector<std::string> getFamiliesNames() const;
375 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
376 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
377 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
378 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
379 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
380 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
381 void setFamilyInfo(const std::map<std::string,int>& info);
382 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
383 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
384 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
385 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
386 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
387 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
388 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
389 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
390 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
391 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
392 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
393 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
394 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
396 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
397 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
398 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
399 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
400 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
401 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
402 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
403 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
404 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
405 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
406 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
409 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
411 return MEDFileMesh::New(fileName);
414 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1)
416 return MEDFileMesh::New(fileName,mName,dt,it);
419 std::string __str__() const throw(INTERP_KERNEL::Exception)
421 return self->simpleRepr();
424 PyObject *getTime() throw(INTERP_KERNEL::Exception)
427 double tmp0=self->getTime(tmp1,tmp2);
428 PyObject *res = PyList_New(3);
429 PyList_SetItem(res,0,SWIG_From_int(tmp1));
430 PyList_SetItem(res,1,SWIG_From_int(tmp2));
431 PyList_SetItem(res,2,SWIG_From_double(tmp0));
435 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
438 bool ret0=self->isEqual(other,eps,what);
439 PyObject *res=PyList_New(2);
440 PyObject *ret0Py=ret0?Py_True:Py_False;
442 PyList_SetItem(res,0,ret0Py);
443 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
447 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
450 bool ret0=self->areFamsEqual(other,what);
451 PyObject *res=PyList_New(2);
452 PyObject *ret0Py=ret0?Py_True:Py_False;
454 PyList_SetItem(res,0,ret0Py);
455 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
459 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
462 bool ret0=self->areGrpsEqual(other,what);
463 PyObject *res=PyList_New(2);
464 PyObject *ret0Py=ret0?Py_True:Py_False;
466 PyList_SetItem(res,0,ret0Py);
467 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
471 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
473 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
476 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
479 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
481 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
484 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
487 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
490 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
491 PyObject *ret=PyTuple_New(2);
492 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
493 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
497 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
499 DataArrayInt *ret3=0;
500 std::vector<int> ret1,ret2;
501 bool ret0=self->unPolyze(ret1,ret2,ret3);
502 PyObject *ret=PyTuple_New(4);
503 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
505 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
506 for(int j=0;j<(int)ret1.size()/3;j++)
508 PyObject *retLev2=PyList_New(3);
509 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
510 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
511 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
512 PyList_SetItem(retLev1_0,j,retLev2);
514 PyTuple_SetItem(ret,1,retLev1_0);
516 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
517 for(int j=0;j<(int)ret2.size()/3;j++)
519 PyObject *retLev2=PyList_New(3);
520 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
521 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
522 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
523 PyList_SetItem(retLev1_1,j,retLev2);
525 PyTuple_SetItem(ret,2,retLev1_1);
527 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
533 class MEDFileUMesh : public MEDFileMesh
536 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
537 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
538 static MEDFileUMesh *New();
540 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
542 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
543 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
544 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
545 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
546 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
547 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
548 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
549 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
550 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
551 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
552 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
553 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
554 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
555 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
556 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
557 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
558 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
559 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
560 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
561 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
562 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
563 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
564 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
565 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
566 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
567 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
569 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
570 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
571 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
572 void addNodeGroup(const std::string& name, const std::vector<int>& ids) throw(INTERP_KERNEL::Exception);
573 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
574 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
575 void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
576 void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
577 void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
578 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
581 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
583 return MEDFileUMesh::New(fileName,mName,dt,it);
586 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
588 return MEDFileUMesh::New(fileName);
593 return MEDFileUMesh::New();
596 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
598 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
601 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
604 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
606 std::vector<const DataArrayInt *> grps;
607 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
608 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
611 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
613 DataArrayDouble *ret=self->getCoords();
619 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
621 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
622 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
623 PyObject *ret=PyTuple_New(3);
624 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
625 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
626 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
632 class MEDFileCMesh : public MEDFileMesh
635 static MEDFileCMesh *New();
636 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
637 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
638 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
643 return MEDFileCMesh::New();
646 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
648 return MEDFileCMesh::New(fileName);
651 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
653 return MEDFileCMesh::New(fileName,mName,dt,it);
656 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
658 const MEDCouplingCMesh *tmp=self->getMesh();
661 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
666 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
669 static MEDFileMeshMultiTS *New();
670 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
671 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
672 const char *getName() const throw(INTERP_KERNEL::Exception);
673 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
674 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
679 return MEDFileMeshMultiTS::New();
682 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
684 return MEDFileMeshMultiTS::New(fileName);
687 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
689 return MEDFileMeshMultiTS::New(fileName,mName);
692 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
694 MEDFileMesh *ret=self->getOneTimeStep();
702 class MEDFileMeshesIterator
707 PyObject *next() throw(INTERP_KERNEL::Exception)
709 MEDFileMesh *ret=self->nextt();
713 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
717 PyErr_SetString(PyExc_StopIteration,"No more data.");
724 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
727 static MEDFileMeshes *New();
728 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
729 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
730 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
731 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
733 void resize(int newSize) throw(INTERP_KERNEL::Exception);
734 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
735 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
736 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
741 return MEDFileMeshes::New();
744 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
746 return MEDFileMeshes::New(fileName);
749 std::string __str__() const
751 return self->simpleRepr();
754 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
758 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
763 else if(PyString_Check(obj))
765 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
771 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
774 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
776 self->setMeshAtPos(obj,mesh);
780 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
782 return self->iterator();
785 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
787 MEDFileMesh *ret=self->getMeshAtPos(i);
792 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
794 MEDFileMesh *ret=self->getMeshWithName(mname);
802 class MEDFileFieldLoc : public RefCountObject
805 const std::string& getName() const;
806 int getDimension() const;
807 int getNumberOfGaussPoints() const;
808 int getNumberOfPointsInCells() const;
809 const std::vector<double>& getRefCoords() const;
810 const std::vector<double>& getGaussCoords() const;
811 const std::vector<double>& getGaussWeights() const;
812 bool isEqual(const MEDFileFieldLoc& other, double eps) const;
815 std::string __str__() const throw(INTERP_KERNEL::Exception)
822 class MEDFileFieldGlobsReal
825 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
826 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
827 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
828 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
829 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
830 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
831 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
832 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
833 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
834 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
835 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
836 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
837 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
838 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
839 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
840 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
841 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
842 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
843 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
846 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
848 const DataArrayInt *ret=self->getProfile(pflName);
851 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
854 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
856 const DataArrayInt *ret=self->getProfileFromId(pflId);
859 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
862 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
864 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
866 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
869 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
871 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
873 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
876 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
878 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
879 return convertVecPairVecStToPy(ret);
882 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
884 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
885 return convertVecPairVecStToPy(ret);
888 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
890 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
891 self->changePflsNames(v);
894 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
896 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
897 self->changePflsRefsNamesGen(v);
900 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
902 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
903 self->changePflsNamesInStruct(v);
906 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
908 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
909 self->changeLocsNames(v);
912 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
914 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
915 self->changeLocsRefsNamesGen(v);
918 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
920 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
921 self->changeLocsNamesInStruct(v);
926 class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
929 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
930 static MEDFileField1TS *New();
931 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
932 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
933 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
934 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
935 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
936 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
938 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
939 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
940 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
941 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
942 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
944 int getDimension() const throw(INTERP_KERNEL::Exception);
945 int getIteration() const throw(INTERP_KERNEL::Exception);
946 int getOrder() const throw(INTERP_KERNEL::Exception);
947 std::string getName() throw(INTERP_KERNEL::Exception);
948 void setName(const char *name) throw(INTERP_KERNEL::Exception);
949 std::string getMeshName() throw(INTERP_KERNEL::Exception);
950 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
951 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
952 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
953 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
954 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
957 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
959 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
964 return MEDFileField1TS::New();
967 std::string __str__() const throw(INTERP_KERNEL::Exception)
969 return self->simpleRepr();
972 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
974 DataArrayInt *ret1=0;
975 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
976 PyObject *ret=PyTuple_New(2);
977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
978 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
982 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
984 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
987 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
989 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
992 PyObject *getTime() throw(INTERP_KERNEL::Exception)
995 double tmp0=self->getTime(tmp1,tmp2);
996 PyObject *res = PyList_New(3);
997 PyList_SetItem(res,0,SWIG_From_int(tmp1));
998 PyList_SetItem(res,1,SWIG_From_int(tmp2));
999 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1003 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1005 std::pair<int,int> res=self->getDtIt();
1006 PyObject *elt=PyTuple_New(2);
1007 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1008 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1012 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1014 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1015 PyObject *ret2=PyList_New(ret.size());
1016 for(int i=0;i<(int)ret.size();i++)
1017 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1021 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1023 std::vector<int> ret1;
1024 int ret0=self->getNonEmptyLevels(mname,ret1);
1025 PyObject *elt=PyTuple_New(2);
1026 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1027 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1031 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1033 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1034 std::vector< std::vector<TypeOfField> > typesF;
1035 std::vector< std::vector<std::string> > pfls;
1036 std::vector< std::vector<std::string> > locs;
1037 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1039 PyObject *ret2=PyList_New(sz);
1040 for(int i=0;i<sz;i++)
1042 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1043 const std::vector<TypeOfField>& typesFI=typesF[i];
1044 const std::vector<std::string>& pflsI=pfls[i];
1045 const std::vector<std::string>& locsI=locs[i];
1046 PyObject *elt=PyTuple_New(2);
1047 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1048 int sz2=ret[i].size();
1049 PyObject *elt2=PyList_New(sz2);
1050 for(int j=0;j<sz2;j++)
1052 PyObject *elt3=PyTuple_New(4);
1053 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1054 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));
1055 PyTuple_SetItem(elt3,1,elt4);
1056 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1057 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1058 PyList_SetItem(elt2,j,elt3);
1060 PyTuple_SetItem(elt,1,elt2);
1061 PyList_SetItem(ret2,i,elt);
1066 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1068 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1069 std::vector< std::vector<TypeOfField> > typesF;
1070 std::vector< std::vector<std::string> > pfls;
1071 std::vector< std::vector<std::string> > locs;
1072 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1074 PyObject *ret2=PyList_New(sz);
1075 for(int i=0;i<sz;i++)
1077 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1078 const std::vector<TypeOfField>& typesFI=typesF[i];
1079 const std::vector<std::string>& pflsI=pfls[i];
1080 const std::vector<std::string>& locsI=locs[i];
1081 PyObject *elt=PyTuple_New(2);
1082 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1083 int sz2=ret[i].size();
1084 PyObject *elt2=PyList_New(sz2);
1085 for(int j=0;j<sz2;j++)
1087 PyObject *elt3=PyTuple_New(4);
1088 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1089 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1090 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1091 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1092 PyList_SetItem(elt2,j,elt3);
1094 PyTuple_SetItem(elt,1,elt2);
1095 PyList_SetItem(ret2,i,elt);
1100 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1102 DataArrayDouble *ret=self->getUndergroundDataArray();
1108 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1110 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1111 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1114 PyObject *ret=PyTuple_New(2);
1115 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1116 std::size_t sz=elt1Cpp.size();
1117 PyObject *elt=PyList_New(sz);
1118 for(std::size_t i=0;i<sz;i++)
1120 PyObject *elt1=PyTuple_New(2);
1121 PyObject *elt2=PyTuple_New(2);
1122 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1123 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1124 PyObject *elt3=PyTuple_New(2);
1125 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1126 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1127 PyTuple_SetItem(elt1,0,elt2);
1128 PyTuple_SetItem(elt1,1,elt3);
1129 PyList_SetItem(elt,i,elt1);
1131 PyTuple_SetItem(ret,1,elt);
1135 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1137 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1138 return self->changeMeshNames(modifTab);
1143 class MEDFileFieldMultiTSIterator
1148 PyObject *next() throw(INTERP_KERNEL::Exception)
1150 MEDFileField1TS *ret=self->nextt();
1152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
1155 PyErr_SetString(PyExc_StopIteration,"No more data.");
1162 class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1165 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1166 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1167 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1169 MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1170 MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1171 MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1173 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1174 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1175 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1176 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1177 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1178 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1180 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1181 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1183 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1184 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1185 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1186 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1187 std::string getName() const throw(INTERP_KERNEL::Exception);
1188 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1189 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1190 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1191 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1194 MEDFileFieldMultiTS()
1196 return MEDFileFieldMultiTS::New();
1199 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1201 return MEDFileFieldMultiTS::New(fileName);
1204 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1206 return MEDFileFieldMultiTS::New(fileName,fieldName);
1209 std::string __str__() const throw(INTERP_KERNEL::Exception)
1211 return self->simpleRepr();
1214 MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1216 if(elt0 && PyInt_Check(elt0))
1218 int pos=PyInt_AS_LONG(elt0);
1219 return self->getTimeStepAtPos(pos);
1221 else if(elt0 && PyTuple_Check(elt0))
1223 if(PyTuple_Size(elt0)==2)
1225 PyObject *o0=PyTuple_GetItem(elt0,0);
1226 PyObject *o1=PyTuple_GetItem(elt0,1);
1227 if(PyInt_Check(o0) && PyInt_Check(o1))
1229 int iter=PyInt_AS_LONG(o0);
1230 int order=PyInt_AS_LONG(o1);
1231 return self->getTimeStep(iter,order);
1234 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 !");
1237 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 !");
1239 else if(elt0 && PyFloat_Check(elt0))
1241 double val=PyFloat_AS_DOUBLE(elt0);
1242 return self->getTimeStepGivenTime(val);
1245 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1248 MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1250 return self->iterator();
1253 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1255 DataArrayInt *ret1=0;
1256 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1257 PyObject *ret=PyTuple_New(2);
1258 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1259 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1263 PyObject *getIterations() const
1265 std::vector< std::pair<int,int> > res=self->getIterations();
1266 PyObject *ret=PyList_New(res.size());
1268 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1270 PyObject *elt=PyTuple_New(2);
1271 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1272 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1273 PyList_SetItem(ret,rk,elt);
1278 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1280 std::vector<double> ret1;
1281 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1282 std::size_t sz=ret.size();
1283 PyObject *ret2=PyList_New(sz);
1284 for(std::size_t i=0;i<sz;i++)
1286 PyObject *elt=PyTuple_New(3);
1287 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1288 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1289 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1290 PyList_SetItem(ret2,i,elt);
1295 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1297 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1298 PyObject *ret2=PyList_New(ret.size());
1299 for(int i=0;i<(int)ret.size();i++)
1301 const std::vector<TypeOfField>& rett=ret[i];
1302 PyObject *ret3=PyList_New(rett.size());
1303 for(int j=0;j<(int)rett.size();j++)
1304 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1305 PyList_SetItem(ret2,i,ret3);
1310 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1312 std::vector<int> ret1;
1313 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1314 PyObject *elt=PyTuple_New(2);
1315 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1316 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1320 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1322 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1323 std::vector< std::vector<TypeOfField> > typesF;
1324 std::vector< std::vector<std::string> > pfls;
1325 std::vector< std::vector<std::string> > locs;
1326 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1328 PyObject *ret2=PyList_New(sz);
1329 for(int i=0;i<sz;i++)
1331 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1332 const std::vector<TypeOfField>& typesFI=typesF[i];
1333 const std::vector<std::string>& pflsI=pfls[i];
1334 const std::vector<std::string>& locsI=locs[i];
1335 PyObject *elt=PyTuple_New(2);
1336 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1337 int sz2=ret[i].size();
1338 PyObject *elt2=PyList_New(sz2);
1339 for(int j=0;j<sz2;j++)
1341 PyObject *elt3=PyTuple_New(4);
1342 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1343 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));
1344 PyTuple_SetItem(elt3,1,elt4);
1345 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1346 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1347 PyList_SetItem(elt2,j,elt3);
1349 PyTuple_SetItem(elt,1,elt2);
1350 PyList_SetItem(ret2,i,elt);
1355 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1357 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1358 std::vector< std::vector<TypeOfField> > typesF;
1359 std::vector< std::vector<std::string> > pfls;
1360 std::vector< std::vector<std::string> > locs;
1361 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1363 PyObject *ret2=PyList_New(sz);
1364 for(int i=0;i<sz;i++)
1366 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1367 const std::vector<TypeOfField>& typesFI=typesF[i];
1368 const std::vector<std::string>& pflsI=pfls[i];
1369 const std::vector<std::string>& locsI=locs[i];
1370 PyObject *elt=PyTuple_New(2);
1371 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1372 int sz2=ret[i].size();
1373 PyObject *elt2=PyList_New(sz2);
1374 for(int j=0;j<sz2;j++)
1376 PyObject *elt3=PyTuple_New(4);
1377 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1378 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1379 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1380 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1381 PyList_SetItem(elt2,j,elt3);
1383 PyTuple_SetItem(elt,1,elt2);
1384 PyList_SetItem(ret2,i,elt);
1388 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1390 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1395 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1397 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1398 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1401 PyObject *ret=PyTuple_New(2);
1402 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1403 std::size_t sz=elt1Cpp.size();
1404 PyObject *elt=PyList_New(sz);
1405 for(std::size_t i=0;i<sz;i++)
1407 PyObject *elt1=PyTuple_New(2);
1408 PyObject *elt2=PyTuple_New(2);
1409 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1410 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1411 PyObject *elt3=PyTuple_New(2);
1412 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1413 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1414 PyTuple_SetItem(elt1,0,elt2);
1415 PyTuple_SetItem(elt1,1,elt3);
1416 PyList_SetItem(elt,i,elt1);
1418 PyTuple_SetItem(ret,1,elt);
1422 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1424 if(elt0 && PyInt_Check(elt0))
1426 int pos=PyInt_AS_LONG(elt0);
1429 else if(elt0 && PyTuple_Check(elt0))
1431 if(PyTuple_Size(elt0)==2)
1433 PyObject *o0=PyTuple_GetItem(elt0,0);
1434 PyObject *o1=PyTuple_GetItem(elt0,1);
1435 if(PyInt_Check(o0) && PyInt_Check(o1))
1437 int iter=PyInt_AS_LONG(o0);
1438 int order=PyInt_AS_LONG(o1);
1439 return self->getPosOfTimeStep(iter,order);
1442 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 !");
1445 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 !");
1447 else if(elt0 && PyFloat_Check(elt0))
1449 double val=PyFloat_AS_DOUBLE(elt0);
1450 return self->getPosGivenTime(val);
1453 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1456 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1458 if(PyList_Check(elts))
1460 int sz=PyList_Size(elts);
1461 std::vector<int> ret(sz);
1462 for(int i=0;i<sz;i++)
1464 PyObject *elt=PyList_GetItem(elts,i);
1465 ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
1471 std::vector<int> ret(1);
1472 ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
1477 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1479 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
1480 if(!idsToRemove.empty())
1481 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1484 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1488 std::vector<int> pos2;
1489 DataArrayInt *pos3=0;
1490 DataArrayIntTuple *pos4=0;
1491 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1496 self->eraseTimeStepIds(&pos1,&pos1+1);
1503 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1508 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1512 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1516 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1518 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1519 return self->changeMeshNames(modifTab);
1524 class MEDFileFieldsIterator
1529 PyObject *next() throw(INTERP_KERNEL::Exception)
1531 MEDFileFieldMultiTS *ret=self->nextt();
1533 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
1536 PyErr_SetString(PyExc_StopIteration,"No more data.");
1543 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1546 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
1547 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1548 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1549 int getNumberOfFields() const;
1550 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1551 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1553 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1554 void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1555 void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1556 MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1557 MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1558 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1563 return MEDFileFields::New();
1566 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
1568 return MEDFileFields::New(fileName);
1571 std::string __str__() const throw(INTERP_KERNEL::Exception)
1573 return self->simpleRepr();
1576 MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1578 if(PyInt_Check(obj))
1580 return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
1582 else if(PyString_Check(obj))
1584 return self->getFieldWithName(PyString_AsString(obj));
1587 throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
1590 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
1592 self->setFieldAtPos(obj,field);
1596 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
1598 return self->iterator();
1601 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1603 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1604 return self->changeMeshNames(modifTab);
1609 class MEDFileData : public RefCountObject, public MEDFileWritable
1612 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1613 static MEDFileData *New();
1614 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
1615 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
1616 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
1617 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
1619 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
1620 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
1622 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1625 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
1627 return MEDFileData::New(fileName);
1632 return MEDFileData::New();
1635 std::string __str__() const throw(INTERP_KERNEL::Exception)
1637 return self->simpleRepr();
1640 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
1642 MEDFileMeshes *ret=self->getMeshes();
1648 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
1650 MEDFileFields *ret=self->getFields();
1656 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1658 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1659 return self->changeMeshNames(modifTab);
1664 class SauvReader : public RefCountObject
1667 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
1668 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
1671 class SauvWriter : public RefCountObject
1674 static SauvWriter * New();
1675 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
1676 void write(const char* fileName) throw(INTERP_KERNEL::Exception);