1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
23 #define MEDCOUPLING_EXPORT
24 #define MEDLOADER_EXPORT
26 %include "MEDCouplingCommon.i"
29 #include "MEDLoader.hxx"
30 #include "MEDFileMesh.hxx"
31 #include "MEDFileField.hxx"
32 #include "MEDFileParameter.hxx"
33 #include "MEDFileData.hxx"
34 #include "MEDLoaderTypemaps.i"
35 #include "SauvReader.hxx"
36 #include "SauvWriter.hxx"
38 using namespace ParaMEDMEM;
41 #if SWIG_VERSION >= 0x010329
42 %template() std::vector<std::string>;
45 %typemap(out) ParaMEDMEM::MEDFileMesh*
47 $result=convertMEDFileMesh($1,$owner);
50 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
52 $result=convertMEDFileParameter1TS($1,$owner);
55 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
57 $result=convertMEDFileFieldMultiTS($1,$owner);
60 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
62 $result=convertMEDFileField1TS($1,$owner);
65 %newobject MEDLoader::ReadUMeshFromFamilies;
66 %newobject MEDLoader::ReadUMeshFromGroups;
67 %newobject MEDLoader::ReadUMeshFromFile;
68 %newobject MEDLoader::ReadField;
69 %newobject MEDLoader::ReadFieldCell;
70 %newobject MEDLoader::ReadFieldNode;
71 %newobject MEDLoader::ReadFieldGauss;
72 %newobject MEDLoader::ReadFieldGaussNE;
73 %newobject ParaMEDMEM::MEDFileMesh::New;
74 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
75 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
76 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
77 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
78 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
79 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
80 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
81 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
82 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
83 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
84 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
85 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
86 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
87 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
88 %newobject ParaMEDMEM::MEDFileUMesh::New;
89 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
90 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
91 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
92 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
93 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
94 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
95 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
96 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
98 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
99 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
100 %newobject ParaMEDMEM::MEDFileCMesh::New;
101 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
102 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
103 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
104 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
105 %newobject ParaMEDMEM::MEDFileMeshes::New;
106 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
107 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
108 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
109 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
110 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
112 %newobject ParaMEDMEM::MEDFileFields::New;
113 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
114 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
115 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
116 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
117 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
118 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
119 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
120 %newobject ParaMEDMEM::MEDFileFields::__iter__;
122 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
123 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
124 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
125 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
126 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
127 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
128 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
129 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
130 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
131 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
132 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
133 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
134 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
135 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
136 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
137 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
138 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
140 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
141 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
142 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
143 %newobject ParaMEDMEM::MEDFileField1TS::New;
144 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
145 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
146 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
147 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
148 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
149 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
150 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
151 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
152 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
154 %newobject ParaMEDMEM::MEDFileData::New;
155 %newobject ParaMEDMEM::MEDFileData::deepCpy;
156 %newobject ParaMEDMEM::MEDFileData::getMeshes;
157 %newobject ParaMEDMEM::MEDFileData::getFields;
158 %newobject ParaMEDMEM::MEDFileData::getParams;
160 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
161 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
162 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
163 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
164 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
165 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
166 %newobject ParaMEDMEM::MEDFileParameters::New;
167 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
168 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
169 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
170 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
172 %newobject ParaMEDMEM::SauvWriter::New;
173 %newobject ParaMEDMEM::SauvReader::New;
174 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
176 %feature("unref") MEDFileMesh "$this->decrRef();"
177 %feature("unref") MEDFileUMesh "$this->decrRef();"
178 %feature("unref") MEDFileCMesh "$this->decrRef();"
179 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
180 %feature("unref") MEDFileMeshes "$this->decrRef();"
181 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
182 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
183 %feature("unref") MEDFileField1TS "$this->decrRef();"
184 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
185 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
186 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
187 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
188 %feature("unref") MEDFileFields "$this->decrRef();"
189 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
190 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
191 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
192 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
193 %feature("unref") MEDFileParameters "$this->decrRef();"
194 %feature("unref") MEDFileData "$this->decrRef();"
195 %feature("unref") SauvReader "$this->decrRef();"
196 %feature("unref") SauvWriter "$this->decrRef();"
201 static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
202 static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
203 static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
204 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
205 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
206 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
207 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
208 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
209 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
210 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
211 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
212 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
213 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
214 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
215 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
216 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
219 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
221 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
222 PyObject *ret=PyList_New(res.size());
224 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
226 PyObject *elt=PyTuple_New(2);
227 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
228 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
229 PyList_SetItem(ret,rk,elt);
234 static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
236 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
237 PyObject *ret=PyList_New(res.size());
239 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
241 PyObject *elt=PyTuple_New(3);
242 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
243 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
244 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
245 PyList_SetItem(ret,rk,elt);
250 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
252 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
253 PyObject *ret=PyList_New(res.size());
255 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
257 PyObject *elt=PyTuple_New(2);
258 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
259 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
260 PyList_SetItem(ret,rk,elt);
264 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
266 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
267 PyObject *ret=PyList_New(res.size());
269 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
271 PyObject *elt=PyTuple_New(2);
272 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
273 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
274 PyList_SetItem(ret,rk,elt);
278 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
280 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
281 PyObject *ret=PyList_New(res.size());
283 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
285 PyObject *elt=PyTuple_New(2);
286 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
287 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
288 PyList_SetItem(ret,rk,elt);
292 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
294 int meshDim,spaceDim,numberOfNodes;
295 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
296 PyObject *ret=PyTuple_New(4);
297 PyObject *elt0=PyList_New(res.size());
299 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
301 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
303 PyObject *elt1=PyList_New(obj2.size());
304 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
306 PyObject *elt2=PyTuple_New(2);
307 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
308 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
309 PyList_SetItem(elt1,j,elt2);
311 PyList_SetItem(elt0,i,elt1);
313 PyTuple_SetItem(ret,0,elt0);
314 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
315 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
316 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
319 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
320 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
322 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
323 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
324 return convertFieldDoubleVecToPy(res);
326 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
328 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
329 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
330 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
332 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
334 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
335 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
336 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
338 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
340 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
341 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
342 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
344 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
346 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
348 PyObject *ret=PyList_New(size);
349 for(int i=0;i<size;i++)
350 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
353 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
355 std::vector<std::string> grps;
356 converPyListToVecString(li,grps);
357 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
359 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
361 std::vector<std::string> fams;
362 converPyListToVecString(li,fams);
363 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
366 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
367 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
368 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
369 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);
370 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
371 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
372 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
373 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
374 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
375 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
376 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
377 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
378 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
383 class MEDFileWritable
386 void copyOptionsFrom(const MEDFileWritable& other) const;
387 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
388 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
389 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
390 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
393 class MEDFileMesh : public RefCountObject, public MEDFileWritable
396 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
397 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
398 virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
399 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
400 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
401 virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
402 void setName(const char *name);
403 const char *getName();
404 const char *getUnivName() const;
405 bool getUnivNameWrStatus() const;
406 void setUnivNameWrStatus(bool newStatus);
407 void setDescription(const char *name);
408 const char *getDescription() const;
409 void setOrder(int order);
410 int getOrder() const;
411 void setIteration(int it);
413 void setTimeValue(double time);
414 void setTime(int dt, int it, double time);
415 double getTimeValue() const;
416 void setTimeUnit(const char *unit);
417 const char *getTimeUnit() const;
418 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
419 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
420 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
421 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
422 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
423 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
424 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
425 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
427 bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
428 bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
429 bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
430 void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
431 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
432 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
433 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
434 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
435 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
436 void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
437 const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
438 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
439 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
440 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
441 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
442 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
443 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
444 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
445 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
446 std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
447 std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
448 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
449 std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
450 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
451 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
452 std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
453 std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
454 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
455 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
456 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
457 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
458 void setFamilyInfo(const std::map<std::string,int>& info);
459 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
460 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
461 int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
462 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
463 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
464 int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
465 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
466 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
467 virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
468 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
469 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
470 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
471 DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
472 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
473 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
474 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
475 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
476 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
477 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
478 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
479 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
481 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
482 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
483 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
484 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
485 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
486 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
487 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
488 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
489 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
490 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
491 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
492 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
495 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
497 return MEDFileMesh::New(fileName);
500 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
502 return MEDFileMesh::New(fileName,mName,dt,it);
505 std::string __str__() const throw(INTERP_KERNEL::Exception)
507 return self->simpleRepr();
510 PyObject *getTime() throw(INTERP_KERNEL::Exception)
513 double tmp0=self->getTime(tmp1,tmp2);
514 PyObject *res = PyList_New(3);
515 PyList_SetItem(res,0,SWIG_From_int(tmp1));
516 PyList_SetItem(res,1,SWIG_From_int(tmp2));
517 PyList_SetItem(res,2,SWIG_From_double(tmp0));
521 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
524 bool ret0=self->isEqual(other,eps,what);
525 PyObject *res=PyList_New(2);
526 PyObject *ret0Py=ret0?Py_True:Py_False;
528 PyList_SetItem(res,0,ret0Py);
529 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
533 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
536 bool ret0=self->areFamsEqual(other,what);
537 PyObject *res=PyList_New(2);
538 PyObject *ret0Py=ret0?Py_True:Py_False;
540 PyList_SetItem(res,0,ret0Py);
541 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
545 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
548 bool ret0=self->areGrpsEqual(other,what);
549 PyObject *res=PyList_New(2);
550 PyObject *ret0Py=ret0?Py_True:Py_False;
552 PyList_SetItem(res,0,ret0Py);
553 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
557 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
559 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
562 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
565 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
567 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
570 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
573 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
575 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
578 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
581 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
584 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
585 PyObject *ret=PyTuple_New(2);
586 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
587 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
591 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
593 DataArrayInt *ret3=0;
594 std::vector<int> ret1,ret2;
595 bool ret0=self->unPolyze(ret1,ret2,ret3);
596 PyObject *ret=PyTuple_New(4);
597 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
599 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
600 for(int j=0;j<(int)ret1.size()/3;j++)
602 PyObject *retLev2=PyList_New(3);
603 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
604 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
605 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
606 PyList_SetItem(retLev1_0,j,retLev2);
608 PyTuple_SetItem(ret,1,retLev1_0);
610 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
611 for(int j=0;j<(int)ret2.size()/3;j++)
613 PyObject *retLev2=PyList_New(3);
614 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
615 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
616 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
617 PyList_SetItem(retLev1_1,j,retLev2);
619 PyTuple_SetItem(ret,2,retLev1_1);
621 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
627 class MEDFileUMesh : public MEDFileMesh
630 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
631 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
632 static MEDFileUMesh *New();
634 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
636 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
637 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
638 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
639 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
640 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
641 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
642 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
643 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
644 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
645 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
646 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
647 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
648 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
649 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
650 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
651 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
652 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
653 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
654 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
655 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
656 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
657 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
658 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
659 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
660 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
661 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
663 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
664 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
665 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
666 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
667 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
668 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
669 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
670 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
671 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
674 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
676 return MEDFileUMesh::New(fileName,mName,dt,it);
679 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
681 return MEDFileUMesh::New(fileName);
686 return MEDFileUMesh::New();
689 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
691 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
694 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
697 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
699 std::vector<const DataArrayInt *> grps;
700 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
701 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
704 void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
706 std::vector<const MEDCouplingUMesh *> ms;
707 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
708 self->setMeshes(ms,renum);
711 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
713 std::vector<const MEDCouplingUMesh *> ms;
714 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
715 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
718 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
720 std::vector<const MEDCouplingUMesh *> ms;
721 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
722 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
725 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
727 DataArrayDouble *ret=self->getCoords();
733 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
735 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
736 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
737 PyObject *ret=PyTuple_New(3);
738 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
739 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
740 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
746 class MEDFileStructuredMesh : public MEDFileMesh
750 class MEDFileCMesh : public MEDFileStructuredMesh
753 static MEDFileCMesh *New();
754 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
755 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
756 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
761 return MEDFileCMesh::New();
764 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
766 return MEDFileCMesh::New(fileName);
769 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
771 return MEDFileCMesh::New(fileName,mName,dt,it);
774 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
776 const MEDCouplingCMesh *tmp=self->getMesh();
779 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
784 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
787 static MEDFileCurveLinearMesh *New();
788 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
789 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
790 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
793 MEDFileCurveLinearMesh()
795 return MEDFileCurveLinearMesh::New();
798 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
800 return MEDFileCurveLinearMesh::New(fileName);
803 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
805 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
808 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
810 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
813 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
818 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
821 static MEDFileMeshMultiTS *New();
822 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
823 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
824 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
825 const char *getName() const throw(INTERP_KERNEL::Exception);
826 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
827 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
832 return MEDFileMeshMultiTS::New();
835 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
837 return MEDFileMeshMultiTS::New(fileName);
840 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
842 return MEDFileMeshMultiTS::New(fileName,mName);
845 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
847 MEDFileMesh *ret=self->getOneTimeStep();
855 class MEDFileMeshesIterator
860 PyObject *next() throw(INTERP_KERNEL::Exception)
862 MEDFileMesh *ret=self->nextt();
866 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
870 PyErr_SetString(PyExc_StopIteration,"No more data.");
877 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
880 static MEDFileMeshes *New();
881 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
882 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
883 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
884 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
885 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
887 void resize(int newSize) throw(INTERP_KERNEL::Exception);
888 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
889 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
890 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
895 return MEDFileMeshes::New();
898 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
900 return MEDFileMeshes::New(fileName);
903 std::string __str__() const throw(INTERP_KERNEL::Exception)
905 return self->simpleRepr();
908 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
912 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
917 else if(PyString_Check(obj))
919 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
925 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
928 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
930 self->setMeshAtPos(obj,mesh);
934 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
936 return self->iterator();
939 int __len__() const throw(INTERP_KERNEL::Exception)
941 return self->getNumberOfMeshes();
944 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
946 MEDFileMesh *ret=self->getMeshAtPos(i);
951 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
953 MEDFileMesh *ret=self->getMeshWithName(mname);
961 class MEDFileFieldLoc : public RefCountObject
964 const std::string& getName() const;
965 int getDimension() const;
966 int getNumberOfGaussPoints() const;
967 int getNumberOfPointsInCells() const;
968 const std::vector<double>& getRefCoords() const;
969 const std::vector<double>& getGaussCoords() const;
970 const std::vector<double>& getGaussWeights() const;
971 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
974 std::string __str__() const throw(INTERP_KERNEL::Exception)
981 class MEDFileFieldGlobsReal
985 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
986 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
987 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
988 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
989 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
990 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
991 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
992 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
993 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
994 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
995 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
996 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
997 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
998 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
999 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
1000 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
1001 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1002 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1003 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1004 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1005 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1006 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1007 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1008 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1009 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1010 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
1013 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
1015 const DataArrayInt *ret=self->getProfile(pflName);
1018 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1021 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1023 const DataArrayInt *ret=self->getProfileFromId(pflId);
1026 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1029 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1031 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1034 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1037 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1039 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1042 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1045 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1047 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1048 return convertVecPairVecStToPy(ret);
1051 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1053 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1054 return convertVecPairVecStToPy(ret);
1057 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1059 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1060 self->changePflsNames(v);
1063 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1065 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1066 self->changePflsRefsNamesGen(v);
1069 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1071 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1072 self->changePflsNamesInStruct(v);
1075 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1077 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1078 self->changeLocsNames(v);
1081 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1083 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1084 self->changeLocsRefsNamesGen(v);
1087 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1089 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1090 self->changeLocsNamesInStruct(v);
1093 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1095 std::ostringstream oss;
1096 self->simpleReprGlobs(oss);
1102 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1105 static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1106 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1107 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1108 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1109 int getDimension() const throw(INTERP_KERNEL::Exception);
1110 int getIteration() const throw(INTERP_KERNEL::Exception);
1111 int getOrder() const throw(INTERP_KERNEL::Exception);
1112 std::string getName() throw(INTERP_KERNEL::Exception);
1113 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1114 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1115 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1116 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1117 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1118 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1119 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1120 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1121 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1122 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1123 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1124 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1127 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1130 double tmp0=self->getTime(tmp1,tmp2);
1131 PyObject *res = PyList_New(3);
1132 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1133 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1134 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1138 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1140 std::pair<int,int> res=self->getDtIt();
1141 PyObject *elt=PyTuple_New(2);
1142 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1143 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1147 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1149 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1152 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1154 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1157 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1159 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1160 return self->changeMeshNames(modifTab);
1163 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1165 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1166 PyObject *ret2=PyList_New(ret.size());
1167 for(int i=0;i<(int)ret.size();i++)
1168 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1172 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1174 std::vector<int> ret1;
1175 int ret0=self->getNonEmptyLevels(mname,ret1);
1176 PyObject *elt=PyTuple_New(2);
1177 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1178 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1182 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1184 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1185 std::vector< std::vector<TypeOfField> > typesF;
1186 std::vector< std::vector<std::string> > pfls;
1187 std::vector< std::vector<std::string> > locs;
1188 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1190 PyObject *ret2=PyList_New(sz);
1191 for(int i=0;i<sz;i++)
1193 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1194 const std::vector<TypeOfField>& typesFI=typesF[i];
1195 const std::vector<std::string>& pflsI=pfls[i];
1196 const std::vector<std::string>& locsI=locs[i];
1197 PyObject *elt=PyTuple_New(2);
1198 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1199 int sz2=ret[i].size();
1200 PyObject *elt2=PyList_New(sz2);
1201 for(int j=0;j<sz2;j++)
1203 PyObject *elt3=PyTuple_New(4);
1204 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1205 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));
1206 PyTuple_SetItem(elt3,1,elt4);
1207 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1208 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1209 PyList_SetItem(elt2,j,elt3);
1211 PyTuple_SetItem(elt,1,elt2);
1212 PyList_SetItem(ret2,i,elt);
1217 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1219 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1220 std::size_t sz=ret.size();
1221 PyObject *retPy=PyList_New(sz);
1222 for(std::size_t i=0;i<sz;i++)
1223 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1229 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1232 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1233 static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1234 static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1235 static MEDFileField1TS *New();
1236 ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1237 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1238 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1239 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1240 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1241 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1243 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1244 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1245 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1246 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1249 MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1251 return MEDFileField1TS::New(fileName,loadAll);
1254 MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1256 return MEDFileField1TS::New(fileName,fieldName,loadAll);
1259 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1261 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1266 return MEDFileField1TS::New();
1269 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1271 const DataArrayDouble *arr=0;
1273 arr=field->getArray();
1274 self->copyTinyInfoFrom(field,arr);
1277 std::string __str__() const throw(INTERP_KERNEL::Exception)
1279 return self->simpleRepr();
1282 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1284 DataArrayInt *ret1=0;
1285 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1286 PyObject *ret=PyTuple_New(2);
1287 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1288 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1292 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1294 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1295 std::vector< std::vector<TypeOfField> > typesF;
1296 std::vector< std::vector<std::string> > pfls;
1297 std::vector< std::vector<std::string> > locs;
1298 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1300 PyObject *ret2=PyList_New(sz);
1301 for(int i=0;i<sz;i++)
1303 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1304 const std::vector<TypeOfField>& typesFI=typesF[i];
1305 const std::vector<std::string>& pflsI=pfls[i];
1306 const std::vector<std::string>& locsI=locs[i];
1307 PyObject *elt=PyTuple_New(2);
1308 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1309 int sz2=ret[i].size();
1310 PyObject *elt2=PyList_New(sz2);
1311 for(int j=0;j<sz2;j++)
1313 PyObject *elt3=PyTuple_New(4);
1314 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1315 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1316 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1317 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1318 PyList_SetItem(elt2,j,elt3);
1320 PyTuple_SetItem(elt,1,elt2);
1321 PyList_SetItem(ret2,i,elt);
1326 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1328 DataArrayDouble *ret=self->getUndergroundDataArray();
1334 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1336 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1337 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1340 PyObject *ret=PyTuple_New(2);
1341 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1342 std::size_t sz=elt1Cpp.size();
1343 PyObject *elt=PyList_New(sz);
1344 for(std::size_t i=0;i<sz;i++)
1346 PyObject *elt1=PyTuple_New(2);
1347 PyObject *elt2=PyTuple_New(2);
1348 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1349 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1350 PyObject *elt3=PyTuple_New(2);
1351 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1352 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1353 PyTuple_SetItem(elt1,0,elt2);
1354 PyTuple_SetItem(elt1,1,elt3);
1355 PyList_SetItem(elt,i,elt1);
1357 PyTuple_SetItem(ret,1,elt);
1363 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1366 static MEDFileIntField1TS *New();
1367 static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1368 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1369 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1370 ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1372 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1373 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1376 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1378 return MEDFileIntField1TS::New();
1381 MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1383 return MEDFileIntField1TS::New(fileName,loadAll);
1386 MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1388 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1391 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1393 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1396 std::string __str__() const throw(INTERP_KERNEL::Exception)
1398 return self->simpleRepr();
1401 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1403 DataArrayInt *ret1=0;
1404 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1405 PyObject *ret=PyTuple_New(2);
1406 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1407 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1411 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1413 DataArrayInt *ret1=0;
1414 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1415 PyObject *ret=PyTuple_New(2);
1416 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1417 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1421 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1423 DataArrayInt *ret1=0;
1424 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1425 PyObject *ret=PyTuple_New(2);
1426 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1427 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1431 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1433 DataArrayInt *ret1=0;
1434 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1435 PyObject *ret=PyTuple_New(2);
1436 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1437 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1441 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1443 DataArrayInt *ret1=0;
1444 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1445 PyObject *ret=PyTuple_New(2);
1446 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1447 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1451 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1453 DataArrayInt *ret1=0;
1454 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1455 PyObject *ret=PyTuple_New(2);
1456 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1457 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1461 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1463 DataArrayInt *ret=self->getUndergroundDataArray();
1471 class MEDFileAnyTypeFieldMultiTSIterator
1476 PyObject *next() throw(INTERP_KERNEL::Exception)
1478 MEDFileAnyTypeField1TS *ret=self->nextt();
1480 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1483 PyErr_SetString(PyExc_StopIteration,"No more data.");
1490 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1493 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1494 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1495 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1496 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1497 std::string getName() const throw(INTERP_KERNEL::Exception);
1498 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1499 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1500 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1501 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1502 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1503 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1504 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1505 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1506 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1507 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1508 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1509 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1511 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1512 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1513 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1514 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1515 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1518 int __len__() const throw(INTERP_KERNEL::Exception)
1520 return self->getNumberOfTS();
1523 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1525 if(elt0 && PyInt_Check(elt0))
1527 int pos=PyInt_AS_LONG(elt0);
1530 else if(elt0 && PyTuple_Check(elt0))
1532 if(PyTuple_Size(elt0)==2)
1534 PyObject *o0=PyTuple_GetItem(elt0,0);
1535 PyObject *o1=PyTuple_GetItem(elt0,1);
1536 if(PyInt_Check(o0) && PyInt_Check(o1))
1538 int iter=PyInt_AS_LONG(o0);
1539 int order=PyInt_AS_LONG(o1);
1540 return self->getPosOfTimeStep(iter,order);
1543 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
1546 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
1548 else if(elt0 && PyFloat_Check(elt0))
1550 double val=PyFloat_AS_DOUBLE(elt0);
1551 return self->getPosGivenTime(val);
1554 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1557 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1559 std::vector< std::pair<int,int> > res=self->getIterations();
1560 PyObject *ret=PyList_New(res.size());
1562 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1564 PyObject *elt=PyTuple_New(2);
1565 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1566 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1567 PyList_SetItem(ret,rk,elt);
1572 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1574 std::vector<double> ret1;
1575 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1576 std::size_t sz=ret.size();
1577 PyObject *ret2=PyList_New(sz);
1578 for(std::size_t i=0;i<sz;i++)
1580 PyObject *elt=PyTuple_New(3);
1581 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1582 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1583 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1584 PyList_SetItem(ret2,i,elt);
1589 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1591 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1592 PyObject *ret2=PyList_New(ret.size());
1593 for(int i=0;i<(int)ret.size();i++)
1595 const std::vector<TypeOfField>& rett=ret[i];
1596 PyObject *ret3=PyList_New(rett.size());
1597 for(int j=0;j<(int)rett.size();j++)
1598 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1599 PyList_SetItem(ret2,i,ret3);
1604 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1606 std::vector<int> ret1;
1607 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1608 PyObject *elt=PyTuple_New(2);
1609 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1610 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1614 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1616 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1617 std::vector< std::vector<TypeOfField> > typesF;
1618 std::vector< std::vector<std::string> > pfls;
1619 std::vector< std::vector<std::string> > locs;
1620 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1622 PyObject *ret2=PyList_New(sz);
1623 for(int i=0;i<sz;i++)
1625 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1626 const std::vector<TypeOfField>& typesFI=typesF[i];
1627 const std::vector<std::string>& pflsI=pfls[i];
1628 const std::vector<std::string>& locsI=locs[i];
1629 PyObject *elt=PyTuple_New(2);
1630 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1631 int sz2=ret[i].size();
1632 PyObject *elt2=PyList_New(sz2);
1633 for(int j=0;j<sz2;j++)
1635 PyObject *elt3=PyTuple_New(4);
1636 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1637 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));
1638 PyTuple_SetItem(elt3,1,elt4);
1639 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1640 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1641 PyList_SetItem(elt2,j,elt3);
1643 PyTuple_SetItem(elt,1,elt2);
1644 PyList_SetItem(ret2,i,elt);
1649 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1651 if(PyList_Check(elts))
1653 int sz=PyList_Size(elts);
1654 std::vector<int> ret(sz);
1655 for(int i=0;i<sz;i++)
1657 PyObject *elt=PyList_GetItem(elts,i);
1658 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1664 std::vector<int> ret(1);
1665 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1670 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1672 if(PySlice_Check(elts))
1674 Py_ssize_t strt=2,stp=2,step=2;
1675 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1676 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1678 self->eraseTimeStepIds2(strt,stp,step);
1681 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1685 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1686 if(!idsToRemove.empty())
1687 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1691 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1695 std::vector<int> pos2;
1696 DataArrayInt *pos3=0;
1697 DataArrayIntTuple *pos4=0;
1698 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1703 self->eraseTimeStepIds(&pos1,&pos1+1);
1710 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1715 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1719 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1723 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1725 return self->iterator();
1728 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1730 if(elt0 && PyList_Check(elt0))
1732 int sz=PyList_Size(elt0);
1733 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1734 int *pt=da->getPointer();
1735 for(int i=0;i<sz;i++,pt++)
1737 PyObject *elt1=PyList_GetItem(elt0,i);
1738 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1740 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1742 else if(elt0 && PySlice_Check(elt0))
1744 Py_ssize_t strt=2,stp=2,step=2;
1745 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1746 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1747 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1749 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1752 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1755 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1757 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1758 return self->changeMeshNames(modifTab);
1761 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1763 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1764 std::size_t sz=ret.size();
1765 PyObject *retPy=PyList_New(sz);
1766 for(std::size_t i=0;i<sz;i++)
1767 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1771 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1773 std::vector<MEDFileAnyTypeField1TS *> tmp;
1774 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1775 self->pushBackTimeSteps(tmp);
1780 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1783 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1784 static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1785 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1787 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1788 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1789 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1790 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1791 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1793 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1794 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1795 ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1798 MEDFileFieldMultiTS()
1800 return MEDFileFieldMultiTS::New();
1803 MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1805 return MEDFileFieldMultiTS::New(fileName,loadAll);
1808 MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1810 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
1813 std::string __str__() const throw(INTERP_KERNEL::Exception)
1815 return self->simpleRepr();
1818 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1820 DataArrayInt *ret1=0;
1821 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1822 PyObject *ret=PyTuple_New(2);
1823 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1824 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1828 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1830 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1831 std::vector< std::vector<TypeOfField> > typesF;
1832 std::vector< std::vector<std::string> > pfls;
1833 std::vector< std::vector<std::string> > locs;
1834 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1836 PyObject *ret2=PyList_New(sz);
1837 for(int i=0;i<sz;i++)
1839 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1840 const std::vector<TypeOfField>& typesFI=typesF[i];
1841 const std::vector<std::string>& pflsI=pfls[i];
1842 const std::vector<std::string>& locsI=locs[i];
1843 PyObject *elt=PyTuple_New(2);
1844 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1845 int sz2=ret[i].size();
1846 PyObject *elt2=PyList_New(sz2);
1847 for(int j=0;j<sz2;j++)
1849 PyObject *elt3=PyTuple_New(4);
1850 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1851 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1852 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1853 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1854 PyList_SetItem(elt2,j,elt3);
1856 PyTuple_SetItem(elt,1,elt2);
1857 PyList_SetItem(ret2,i,elt);
1861 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1863 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1869 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1871 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1872 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1875 PyObject *ret=PyTuple_New(2);
1876 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1877 std::size_t sz=elt1Cpp.size();
1878 PyObject *elt=PyList_New(sz);
1879 for(std::size_t i=0;i<sz;i++)
1881 PyObject *elt1=PyTuple_New(2);
1882 PyObject *elt2=PyTuple_New(2);
1883 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1884 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1885 PyObject *elt3=PyTuple_New(2);
1886 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1887 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1888 PyTuple_SetItem(elt1,0,elt2);
1889 PyTuple_SetItem(elt1,1,elt3);
1890 PyList_SetItem(elt,i,elt1);
1892 PyTuple_SetItem(ret,1,elt);
1898 class MEDFileFieldsIterator
1903 PyObject *next() throw(INTERP_KERNEL::Exception)
1905 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1907 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1910 PyErr_SetString(PyExc_StopIteration,"No more data.");
1917 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1920 static MEDFileIntFieldMultiTS *New();
1921 static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1922 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1924 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1925 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1926 ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1929 MEDFileIntFieldMultiTS()
1931 return MEDFileIntFieldMultiTS::New();
1934 MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1936 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
1939 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1941 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
1944 std::string __str__() const throw(INTERP_KERNEL::Exception)
1946 return self->simpleRepr();
1949 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1951 DataArrayInt *ret1=0;
1952 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1953 PyObject *ret=PyTuple_New(2);
1954 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1955 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1959 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1961 DataArrayInt *ret1=0;
1962 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1963 PyObject *ret=PyTuple_New(2);
1964 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1965 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1969 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1971 DataArrayInt *ret1=0;
1972 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1973 PyObject *ret=PyTuple_New(2);
1974 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1975 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1979 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1981 DataArrayInt *ret1=0;
1982 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1983 PyObject *ret=PyTuple_New(2);
1984 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1985 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1989 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1991 DataArrayInt *ret1=0;
1992 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1993 PyObject *ret=PyTuple_New(2);
1994 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1995 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1999 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2001 DataArrayInt *ret1=0;
2002 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2003 PyObject *ret=PyTuple_New(2);
2004 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2005 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2009 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2011 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2019 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2022 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2023 static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2024 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2025 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2026 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2027 int getNumberOfFields() const;
2028 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2029 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2031 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2032 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2033 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2034 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2035 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2036 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2037 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2038 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2043 return MEDFileFields::New();
2046 MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2048 return MEDFileFields::New(fileName,loadAll);
2051 std::string __str__() const throw(INTERP_KERNEL::Exception)
2053 return self->simpleRepr();
2056 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2059 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2060 PyObject *ret=PyTuple_New(2);
2061 PyObject *ret_0=PyList_New(ret0.size());
2063 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2065 PyObject *elt=PyTuple_New(2);
2066 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2067 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2068 PyList_SetItem(ret_0,rk,elt);
2070 PyTuple_SetItem(ret,0,ret_0);
2071 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2072 PyTuple_SetItem(ret,1,ret_1);
2076 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2078 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2079 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2082 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2084 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2085 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2088 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2090 if(obj && PyList_Check(obj))
2092 int sz=PyList_Size(obj);
2093 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2094 int *pt=da->getPointer();
2095 for(int i=0;i<sz;i++,pt++)
2097 PyObject *elt1=PyList_GetItem(obj,i);
2098 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2100 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2103 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2106 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2108 self->setFieldAtPos(obj,field);
2112 int __len__() const throw(INTERP_KERNEL::Exception)
2114 return self->getNumberOfFields();
2117 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2119 return self->iterator();
2122 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2124 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2125 return self->changeMeshNames(modifTab);
2128 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2130 if(elt0 && PyInt_Check(elt0))
2132 return PyInt_AS_LONG(elt0);
2134 else if(elt0 && PyString_Check(elt0))
2135 return self->getPosFromFieldName(PyString_AsString(elt0));
2137 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2140 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2142 if(PyList_Check(elts))
2144 int sz=PyList_Size(elts);
2145 std::vector<int> ret(sz);
2146 for(int i=0;i<sz;i++)
2148 PyObject *elt=PyList_GetItem(elts,i);
2149 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2155 std::vector<int> ret(1);
2156 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2161 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2163 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2164 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2165 self->pushFields(tmp);
2168 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2170 if(elts && PySlice_Check(elts))
2172 Py_ssize_t strt=2,stp=2,step=2;
2173 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2174 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2175 self->destroyFieldsAtPos2(strt,stp,step);
2177 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2181 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2182 if(!idsToRemove.empty())
2183 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2189 class MEDFileParameter1TS : public RefCountObject
2192 void setIteration(int it);
2193 int getIteration() const;
2194 void setOrder(int order);
2195 int getOrder() const;
2196 void setTimeValue(double time);
2197 void setTime(int dt, int it, double time);
2198 double getTime(int& dt, int& it);
2199 double getTimeValue() const;
2202 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2205 void setValue(double val) throw(INTERP_KERNEL::Exception);
2206 double getValue() const throw(INTERP_KERNEL::Exception);
2207 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2210 std::string __str__() const throw(INTERP_KERNEL::Exception)
2212 return self->simpleRepr();
2217 class MEDFileParameterTinyInfo : public MEDFileWritable
2220 void setDescription(const char *name);
2221 const char *getDescription() const;
2222 void setTimeUnit(const char *unit);
2223 const char *getTimeUnit() const;
2226 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2229 static MEDFileParameterDouble1TS *New();
2230 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2231 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2232 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2233 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2234 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2235 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2236 const char *getName() const throw(INTERP_KERNEL::Exception);
2237 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2240 MEDFileParameterDouble1TS()
2242 return MEDFileParameterDouble1TS::New();
2245 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2247 return MEDFileParameterDouble1TS::New(fileName);
2250 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2252 return MEDFileParameterDouble1TS::New(fileName,paramName);
2255 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2257 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2260 std::string __str__() const throw(INTERP_KERNEL::Exception)
2262 return self->simpleRepr();
2265 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2268 bool ret0=self->isEqual(other,eps,what);
2269 PyObject *res=PyList_New(2);
2270 PyObject *ret0Py=ret0?Py_True:Py_False;
2272 PyList_SetItem(res,0,ret0Py);
2273 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2279 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2282 static MEDFileParameterMultiTS *New();
2283 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2284 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2285 const char *getName() const;
2286 void setName(const char *name);
2287 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2288 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2289 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2290 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2291 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2292 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2293 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2296 MEDFileParameterMultiTS()
2298 return MEDFileParameterMultiTS::New();
2301 MEDFileParameterMultiTS(const char *fileName)
2303 return MEDFileParameterMultiTS::New(fileName);
2306 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2308 return MEDFileParameterMultiTS::New(fileName,paramName);
2311 std::string __str__() const throw(INTERP_KERNEL::Exception)
2313 return self->simpleRepr();
2316 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2319 bool ret0=self->isEqual(other,eps,what);
2320 PyObject *res=PyList_New(2);
2321 PyObject *ret0Py=ret0?Py_True:Py_False;
2323 PyList_SetItem(res,0,ret0Py);
2324 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2328 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2332 std::vector<int> pos2;
2333 DataArrayInt *pos3=0;
2334 DataArrayIntTuple *pos4=0;
2335 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2340 self->eraseTimeStepIds(&pos1,&pos1+1);
2347 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2352 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2356 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2360 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2362 if(elt0 && PyInt_Check(elt0))
2364 int pos=PyInt_AS_LONG(elt0);
2367 else if(elt0 && PyTuple_Check(elt0))
2369 if(PyTuple_Size(elt0)==2)
2371 PyObject *o0=PyTuple_GetItem(elt0,0);
2372 PyObject *o1=PyTuple_GetItem(elt0,1);
2373 if(PyInt_Check(o0) && PyInt_Check(o1))
2375 int iter=PyInt_AS_LONG(o0);
2376 int order=PyInt_AS_LONG(o1);
2377 return self->getPosOfTimeStep(iter,order);
2380 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
2383 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
2385 else if(elt0 && PyFloat_Check(elt0))
2387 double val=PyFloat_AS_DOUBLE(elt0);
2388 return self->getPosGivenTime(val);
2391 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2394 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2396 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2402 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2404 if(PyList_Check(elts))
2406 int sz=PyList_Size(elts);
2407 std::vector<int> ret(sz);
2408 for(int i=0;i<sz;i++)
2410 PyObject *elt=PyList_GetItem(elts,i);
2411 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2417 std::vector<int> ret(1);
2418 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2423 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2425 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2426 if(!idsToRemove.empty())
2427 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2430 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2432 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2438 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2440 std::vector< std::pair<int,int> > res=self->getIterations();
2441 PyObject *ret=PyList_New(res.size());
2443 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2445 PyObject *elt=PyTuple_New(2);
2446 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2447 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2448 PyList_SetItem(ret,rk,elt);
2453 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2455 std::vector<double> res2;
2456 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2457 PyObject *ret=PyList_New(res.size());
2459 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2461 PyObject *elt=PyTuple_New(3);
2462 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2463 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2464 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2465 PyList_SetItem(ret,rk,elt);
2472 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2475 static MEDFileParameters *New();
2476 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2477 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2478 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2479 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2480 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2481 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2482 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2483 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2484 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2485 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2486 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2491 return MEDFileParameters::New();
2494 MEDFileParameters(const char *fileName)
2496 return MEDFileParameters::New(fileName);
2499 std::string __str__() const throw(INTERP_KERNEL::Exception)
2501 return self->simpleRepr();
2504 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2506 if(PyInt_Check(obj))
2508 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2513 else if(PyString_Check(obj))
2515 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2521 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2524 int __len__() const throw(INTERP_KERNEL::Exception)
2526 return self->getNumberOfParams();
2529 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2531 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2537 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2539 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2545 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2548 bool ret0=self->isEqual(other,eps,what);
2549 PyObject *res=PyList_New(2);
2550 PyObject *ret0Py=ret0?Py_True:Py_False;
2552 PyList_SetItem(res,0,ret0Py);
2553 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2559 class MEDFileData : public RefCountObject, public MEDFileWritable
2562 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2563 static MEDFileData *New();
2564 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2565 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2566 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2567 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2568 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2569 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2570 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2572 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2573 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2575 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2578 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2580 return MEDFileData::New(fileName);
2585 return MEDFileData::New();
2588 std::string __str__() const throw(INTERP_KERNEL::Exception)
2590 return self->simpleRepr();
2593 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2595 MEDFileMeshes *ret=self->getMeshes();
2601 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2603 MEDFileParameters *ret=self->getParams();
2609 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2611 MEDFileFields *ret=self->getFields();
2617 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2619 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2620 return self->changeMeshNames(modifTab);
2625 class SauvReader : public RefCountObject
2628 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2629 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2632 class SauvWriter : public RefCountObject
2635 static SauvWriter * New();
2636 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2637 void write(const char* fileName) throw(INTERP_KERNEL::Exception);