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 void loadArrays() throw(INTERP_KERNEL::Exception);
1110 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1111 void releaseArrays() throw(INTERP_KERNEL::Exception);
1112 int getDimension() const throw(INTERP_KERNEL::Exception);
1113 int getIteration() const throw(INTERP_KERNEL::Exception);
1114 int getOrder() const throw(INTERP_KERNEL::Exception);
1115 std::string getName() throw(INTERP_KERNEL::Exception);
1116 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1117 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1118 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1119 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1120 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1121 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1122 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1123 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1124 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1125 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1126 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1127 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1130 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1133 double tmp0=self->getTime(tmp1,tmp2);
1134 PyObject *res = PyList_New(3);
1135 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1136 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1137 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1141 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1143 std::pair<int,int> res=self->getDtIt();
1144 PyObject *elt=PyTuple_New(2);
1145 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1146 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1150 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1152 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1155 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1157 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1160 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1162 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1163 return self->changeMeshNames(modifTab);
1166 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1168 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1169 PyObject *ret2=PyList_New(ret.size());
1170 for(int i=0;i<(int)ret.size();i++)
1171 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1175 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1177 std::vector<int> ret1;
1178 int ret0=self->getNonEmptyLevels(mname,ret1);
1179 PyObject *elt=PyTuple_New(2);
1180 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1181 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1185 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1187 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1188 std::vector< std::vector<TypeOfField> > typesF;
1189 std::vector< std::vector<std::string> > pfls;
1190 std::vector< std::vector<std::string> > locs;
1191 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1193 PyObject *ret2=PyList_New(sz);
1194 for(int i=0;i<sz;i++)
1196 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1197 const std::vector<TypeOfField>& typesFI=typesF[i];
1198 const std::vector<std::string>& pflsI=pfls[i];
1199 const std::vector<std::string>& locsI=locs[i];
1200 PyObject *elt=PyTuple_New(2);
1201 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1202 int sz2=ret[i].size();
1203 PyObject *elt2=PyList_New(sz2);
1204 for(int j=0;j<sz2;j++)
1206 PyObject *elt3=PyTuple_New(4);
1207 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1208 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));
1209 PyTuple_SetItem(elt3,1,elt4);
1210 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1211 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1212 PyList_SetItem(elt2,j,elt3);
1214 PyTuple_SetItem(elt,1,elt2);
1215 PyList_SetItem(ret2,i,elt);
1220 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1222 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1223 std::size_t sz=ret.size();
1224 PyObject *retPy=PyList_New(sz);
1225 for(std::size_t i=0;i<sz;i++)
1226 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1232 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1235 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1236 static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1237 static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1238 static MEDFileField1TS *New();
1239 ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1240 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1241 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1242 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1243 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1244 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1246 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1247 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1248 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1249 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1252 MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1254 return MEDFileField1TS::New(fileName,loadAll);
1257 MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1259 return MEDFileField1TS::New(fileName,fieldName,loadAll);
1262 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1264 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1269 return MEDFileField1TS::New();
1272 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1274 const DataArrayDouble *arr=0;
1276 arr=field->getArray();
1277 self->copyTinyInfoFrom(field,arr);
1280 std::string __str__() const throw(INTERP_KERNEL::Exception)
1282 return self->simpleRepr();
1285 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1287 DataArrayInt *ret1=0;
1288 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1289 PyObject *ret=PyTuple_New(2);
1290 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1291 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1295 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1297 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1298 std::vector< std::vector<TypeOfField> > typesF;
1299 std::vector< std::vector<std::string> > pfls;
1300 std::vector< std::vector<std::string> > locs;
1301 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1303 PyObject *ret2=PyList_New(sz);
1304 for(int i=0;i<sz;i++)
1306 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1307 const std::vector<TypeOfField>& typesFI=typesF[i];
1308 const std::vector<std::string>& pflsI=pfls[i];
1309 const std::vector<std::string>& locsI=locs[i];
1310 PyObject *elt=PyTuple_New(2);
1311 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1312 int sz2=ret[i].size();
1313 PyObject *elt2=PyList_New(sz2);
1314 for(int j=0;j<sz2;j++)
1316 PyObject *elt3=PyTuple_New(4);
1317 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1318 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1319 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1320 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1321 PyList_SetItem(elt2,j,elt3);
1323 PyTuple_SetItem(elt,1,elt2);
1324 PyList_SetItem(ret2,i,elt);
1329 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1331 DataArrayDouble *ret=self->getUndergroundDataArray();
1337 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1339 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1340 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1343 PyObject *ret=PyTuple_New(2);
1344 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1345 std::size_t sz=elt1Cpp.size();
1346 PyObject *elt=PyList_New(sz);
1347 for(std::size_t i=0;i<sz;i++)
1349 PyObject *elt1=PyTuple_New(2);
1350 PyObject *elt2=PyTuple_New(2);
1351 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1352 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1353 PyObject *elt3=PyTuple_New(2);
1354 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1355 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1356 PyTuple_SetItem(elt1,0,elt2);
1357 PyTuple_SetItem(elt1,1,elt3);
1358 PyList_SetItem(elt,i,elt1);
1360 PyTuple_SetItem(ret,1,elt);
1366 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1369 static MEDFileIntField1TS *New();
1370 static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1371 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1372 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1373 ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1375 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1376 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1379 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1381 return MEDFileIntField1TS::New();
1384 MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1386 return MEDFileIntField1TS::New(fileName,loadAll);
1389 MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1391 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1394 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1396 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1399 std::string __str__() const throw(INTERP_KERNEL::Exception)
1401 return self->simpleRepr();
1404 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1406 DataArrayInt *ret1=0;
1407 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1408 PyObject *ret=PyTuple_New(2);
1409 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1410 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1414 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1416 DataArrayInt *ret1=0;
1417 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1418 PyObject *ret=PyTuple_New(2);
1419 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1420 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1424 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1426 DataArrayInt *ret1=0;
1427 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1428 PyObject *ret=PyTuple_New(2);
1429 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1430 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1434 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1436 DataArrayInt *ret1=0;
1437 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1438 PyObject *ret=PyTuple_New(2);
1439 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1440 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1444 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1446 DataArrayInt *ret1=0;
1447 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1448 PyObject *ret=PyTuple_New(2);
1449 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1450 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1454 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1456 DataArrayInt *ret1=0;
1457 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1458 PyObject *ret=PyTuple_New(2);
1459 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1460 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1464 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1466 DataArrayInt *ret=self->getUndergroundDataArray();
1474 class MEDFileAnyTypeFieldMultiTSIterator
1479 PyObject *next() throw(INTERP_KERNEL::Exception)
1481 MEDFileAnyTypeField1TS *ret=self->nextt();
1483 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1486 PyErr_SetString(PyExc_StopIteration,"No more data.");
1493 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1496 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1497 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1498 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1499 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1500 std::string getName() const throw(INTERP_KERNEL::Exception);
1501 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1502 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1503 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1504 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1505 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1506 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1507 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1508 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1509 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1510 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1511 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1512 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1513 void loadArrays() throw(INTERP_KERNEL::Exception);
1514 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1515 void releaseArrays() throw(INTERP_KERNEL::Exception);
1517 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1518 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1519 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1520 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1521 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1524 int __len__() const throw(INTERP_KERNEL::Exception)
1526 return self->getNumberOfTS();
1529 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1531 if(elt0 && PyInt_Check(elt0))
1533 int pos=PyInt_AS_LONG(elt0);
1536 else if(elt0 && PyTuple_Check(elt0))
1538 if(PyTuple_Size(elt0)==2)
1540 PyObject *o0=PyTuple_GetItem(elt0,0);
1541 PyObject *o1=PyTuple_GetItem(elt0,1);
1542 if(PyInt_Check(o0) && PyInt_Check(o1))
1544 int iter=PyInt_AS_LONG(o0);
1545 int order=PyInt_AS_LONG(o1);
1546 return self->getPosOfTimeStep(iter,order);
1549 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 !");
1552 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 !");
1554 else if(elt0 && PyFloat_Check(elt0))
1556 double val=PyFloat_AS_DOUBLE(elt0);
1557 return self->getPosGivenTime(val);
1560 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1563 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1565 std::vector< std::pair<int,int> > res=self->getIterations();
1566 PyObject *ret=PyList_New(res.size());
1568 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1570 PyObject *elt=PyTuple_New(2);
1571 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1572 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1573 PyList_SetItem(ret,rk,elt);
1578 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1580 std::vector<double> ret1;
1581 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1582 std::size_t sz=ret.size();
1583 PyObject *ret2=PyList_New(sz);
1584 for(std::size_t i=0;i<sz;i++)
1586 PyObject *elt=PyTuple_New(3);
1587 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1588 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1589 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1590 PyList_SetItem(ret2,i,elt);
1595 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1597 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1598 PyObject *ret2=PyList_New(ret.size());
1599 for(int i=0;i<(int)ret.size();i++)
1601 const std::vector<TypeOfField>& rett=ret[i];
1602 PyObject *ret3=PyList_New(rett.size());
1603 for(int j=0;j<(int)rett.size();j++)
1604 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1605 PyList_SetItem(ret2,i,ret3);
1610 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1612 std::vector<int> ret1;
1613 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1614 PyObject *elt=PyTuple_New(2);
1615 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1616 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1620 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1622 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1623 std::vector< std::vector<TypeOfField> > typesF;
1624 std::vector< std::vector<std::string> > pfls;
1625 std::vector< std::vector<std::string> > locs;
1626 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1628 PyObject *ret2=PyList_New(sz);
1629 for(int i=0;i<sz;i++)
1631 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1632 const std::vector<TypeOfField>& typesFI=typesF[i];
1633 const std::vector<std::string>& pflsI=pfls[i];
1634 const std::vector<std::string>& locsI=locs[i];
1635 PyObject *elt=PyTuple_New(2);
1636 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1637 int sz2=ret[i].size();
1638 PyObject *elt2=PyList_New(sz2);
1639 for(int j=0;j<sz2;j++)
1641 PyObject *elt3=PyTuple_New(4);
1642 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1643 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));
1644 PyTuple_SetItem(elt3,1,elt4);
1645 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1646 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1647 PyList_SetItem(elt2,j,elt3);
1649 PyTuple_SetItem(elt,1,elt2);
1650 PyList_SetItem(ret2,i,elt);
1655 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1657 if(PyList_Check(elts))
1659 int sz=PyList_Size(elts);
1660 std::vector<int> ret(sz);
1661 for(int i=0;i<sz;i++)
1663 PyObject *elt=PyList_GetItem(elts,i);
1664 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1670 std::vector<int> ret(1);
1671 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1676 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1678 if(PySlice_Check(elts))
1680 Py_ssize_t strt=2,stp=2,step=2;
1681 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1682 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1684 self->eraseTimeStepIds2(strt,stp,step);
1687 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1691 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1692 if(!idsToRemove.empty())
1693 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1697 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1701 std::vector<int> pos2;
1702 DataArrayInt *pos3=0;
1703 DataArrayIntTuple *pos4=0;
1704 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1709 self->eraseTimeStepIds(&pos1,&pos1+1);
1716 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1721 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1725 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1729 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1731 return self->iterator();
1734 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1736 if(elt0 && PyList_Check(elt0))
1738 int sz=PyList_Size(elt0);
1739 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1740 int *pt=da->getPointer();
1741 for(int i=0;i<sz;i++,pt++)
1743 PyObject *elt1=PyList_GetItem(elt0,i);
1744 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1746 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1748 else if(elt0 && PySlice_Check(elt0))
1750 Py_ssize_t strt=2,stp=2,step=2;
1751 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1752 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1753 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1755 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1758 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1761 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1763 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1764 return self->changeMeshNames(modifTab);
1767 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1769 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1770 std::size_t sz=ret.size();
1771 PyObject *retPy=PyList_New(sz);
1772 for(std::size_t i=0;i<sz;i++)
1773 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1777 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1779 std::vector<MEDFileAnyTypeField1TS *> tmp;
1780 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1781 self->pushBackTimeSteps(tmp);
1786 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1789 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1790 static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1791 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1793 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1794 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1795 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1796 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1797 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1799 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1800 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1801 ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1804 MEDFileFieldMultiTS()
1806 return MEDFileFieldMultiTS::New();
1809 MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1811 return MEDFileFieldMultiTS::New(fileName,loadAll);
1814 MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1816 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
1819 std::string __str__() const throw(INTERP_KERNEL::Exception)
1821 return self->simpleRepr();
1824 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1826 DataArrayInt *ret1=0;
1827 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1828 PyObject *ret=PyTuple_New(2);
1829 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1830 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1834 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1836 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1837 std::vector< std::vector<TypeOfField> > typesF;
1838 std::vector< std::vector<std::string> > pfls;
1839 std::vector< std::vector<std::string> > locs;
1840 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1842 PyObject *ret2=PyList_New(sz);
1843 for(int i=0;i<sz;i++)
1845 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1846 const std::vector<TypeOfField>& typesFI=typesF[i];
1847 const std::vector<std::string>& pflsI=pfls[i];
1848 const std::vector<std::string>& locsI=locs[i];
1849 PyObject *elt=PyTuple_New(2);
1850 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1851 int sz2=ret[i].size();
1852 PyObject *elt2=PyList_New(sz2);
1853 for(int j=0;j<sz2;j++)
1855 PyObject *elt3=PyTuple_New(4);
1856 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1857 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1858 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1859 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1860 PyList_SetItem(elt2,j,elt3);
1862 PyTuple_SetItem(elt,1,elt2);
1863 PyList_SetItem(ret2,i,elt);
1867 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1869 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1875 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1877 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1878 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1881 PyObject *ret=PyTuple_New(2);
1882 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1883 std::size_t sz=elt1Cpp.size();
1884 PyObject *elt=PyList_New(sz);
1885 for(std::size_t i=0;i<sz;i++)
1887 PyObject *elt1=PyTuple_New(2);
1888 PyObject *elt2=PyTuple_New(2);
1889 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1890 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1891 PyObject *elt3=PyTuple_New(2);
1892 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1893 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1894 PyTuple_SetItem(elt1,0,elt2);
1895 PyTuple_SetItem(elt1,1,elt3);
1896 PyList_SetItem(elt,i,elt1);
1898 PyTuple_SetItem(ret,1,elt);
1904 class MEDFileFieldsIterator
1909 PyObject *next() throw(INTERP_KERNEL::Exception)
1911 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1913 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1916 PyErr_SetString(PyExc_StopIteration,"No more data.");
1923 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1926 static MEDFileIntFieldMultiTS *New();
1927 static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1928 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1930 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1931 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1932 ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1935 MEDFileIntFieldMultiTS()
1937 return MEDFileIntFieldMultiTS::New();
1940 MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1942 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
1945 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1947 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
1950 std::string __str__() const throw(INTERP_KERNEL::Exception)
1952 return self->simpleRepr();
1955 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1957 DataArrayInt *ret1=0;
1958 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1959 PyObject *ret=PyTuple_New(2);
1960 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1961 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1965 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1967 DataArrayInt *ret1=0;
1968 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1969 PyObject *ret=PyTuple_New(2);
1970 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1971 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1975 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1977 DataArrayInt *ret1=0;
1978 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1979 PyObject *ret=PyTuple_New(2);
1980 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1981 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1985 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1987 DataArrayInt *ret1=0;
1988 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1989 PyObject *ret=PyTuple_New(2);
1990 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1991 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1995 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1997 DataArrayInt *ret1=0;
1998 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1999 PyObject *ret=PyTuple_New(2);
2000 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2001 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2005 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2007 DataArrayInt *ret1=0;
2008 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2009 PyObject *ret=PyTuple_New(2);
2010 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2011 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2015 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2017 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2025 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2028 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2029 static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2030 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2031 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2032 void loadArrays() throw(INTERP_KERNEL::Exception);
2033 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
2034 void releaseArrays() throw(INTERP_KERNEL::Exception);
2035 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2036 int getNumberOfFields() const;
2037 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2038 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2040 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2041 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2042 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2043 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2044 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2045 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2046 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2047 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2052 return MEDFileFields::New();
2055 MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2057 return MEDFileFields::New(fileName,loadAll);
2060 std::string __str__() const throw(INTERP_KERNEL::Exception)
2062 return self->simpleRepr();
2065 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2068 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2069 PyObject *ret=PyTuple_New(2);
2070 PyObject *ret_0=PyList_New(ret0.size());
2072 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2074 PyObject *elt=PyTuple_New(2);
2075 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2076 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2077 PyList_SetItem(ret_0,rk,elt);
2079 PyTuple_SetItem(ret,0,ret_0);
2080 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2081 PyTuple_SetItem(ret,1,ret_1);
2085 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2087 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2088 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2091 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2093 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2094 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2097 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2099 if(obj && PyList_Check(obj))
2101 int sz=PyList_Size(obj);
2102 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2103 int *pt=da->getPointer();
2104 for(int i=0;i<sz;i++,pt++)
2106 PyObject *elt1=PyList_GetItem(obj,i);
2107 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2109 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2112 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2115 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2117 self->setFieldAtPos(obj,field);
2121 int __len__() const throw(INTERP_KERNEL::Exception)
2123 return self->getNumberOfFields();
2126 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2128 return self->iterator();
2131 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2133 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2134 return self->changeMeshNames(modifTab);
2137 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2139 if(elt0 && PyInt_Check(elt0))
2141 return PyInt_AS_LONG(elt0);
2143 else if(elt0 && PyString_Check(elt0))
2144 return self->getPosFromFieldName(PyString_AsString(elt0));
2146 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2149 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2151 if(PyList_Check(elts))
2153 int sz=PyList_Size(elts);
2154 std::vector<int> ret(sz);
2155 for(int i=0;i<sz;i++)
2157 PyObject *elt=PyList_GetItem(elts,i);
2158 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2164 std::vector<int> ret(1);
2165 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2170 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2172 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2173 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2174 self->pushFields(tmp);
2177 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2179 if(elts && PySlice_Check(elts))
2181 Py_ssize_t strt=2,stp=2,step=2;
2182 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2183 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2184 self->destroyFieldsAtPos2(strt,stp,step);
2186 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2190 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2191 if(!idsToRemove.empty())
2192 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2198 class MEDFileParameter1TS : public RefCountObject
2201 void setIteration(int it);
2202 int getIteration() const;
2203 void setOrder(int order);
2204 int getOrder() const;
2205 void setTimeValue(double time);
2206 void setTime(int dt, int it, double time);
2207 double getTime(int& dt, int& it);
2208 double getTimeValue() const;
2211 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2214 void setValue(double val) throw(INTERP_KERNEL::Exception);
2215 double getValue() const throw(INTERP_KERNEL::Exception);
2216 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2219 std::string __str__() const throw(INTERP_KERNEL::Exception)
2221 return self->simpleRepr();
2226 class MEDFileParameterTinyInfo : public MEDFileWritable
2229 void setDescription(const char *name);
2230 const char *getDescription() const;
2231 void setTimeUnit(const char *unit);
2232 const char *getTimeUnit() const;
2235 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2238 static MEDFileParameterDouble1TS *New();
2239 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2240 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2241 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2242 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2243 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2244 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2245 const char *getName() const throw(INTERP_KERNEL::Exception);
2246 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2249 MEDFileParameterDouble1TS()
2251 return MEDFileParameterDouble1TS::New();
2254 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2256 return MEDFileParameterDouble1TS::New(fileName);
2259 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2261 return MEDFileParameterDouble1TS::New(fileName,paramName);
2264 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2266 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2269 std::string __str__() const throw(INTERP_KERNEL::Exception)
2271 return self->simpleRepr();
2274 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2277 bool ret0=self->isEqual(other,eps,what);
2278 PyObject *res=PyList_New(2);
2279 PyObject *ret0Py=ret0?Py_True:Py_False;
2281 PyList_SetItem(res,0,ret0Py);
2282 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2288 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2291 static MEDFileParameterMultiTS *New();
2292 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2293 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2294 const char *getName() const;
2295 void setName(const char *name);
2296 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2297 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2298 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2299 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2300 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2301 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2302 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2305 MEDFileParameterMultiTS()
2307 return MEDFileParameterMultiTS::New();
2310 MEDFileParameterMultiTS(const char *fileName)
2312 return MEDFileParameterMultiTS::New(fileName);
2315 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2317 return MEDFileParameterMultiTS::New(fileName,paramName);
2320 std::string __str__() const throw(INTERP_KERNEL::Exception)
2322 return self->simpleRepr();
2325 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2328 bool ret0=self->isEqual(other,eps,what);
2329 PyObject *res=PyList_New(2);
2330 PyObject *ret0Py=ret0?Py_True:Py_False;
2332 PyList_SetItem(res,0,ret0Py);
2333 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2337 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2341 std::vector<int> pos2;
2342 DataArrayInt *pos3=0;
2343 DataArrayIntTuple *pos4=0;
2344 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2349 self->eraseTimeStepIds(&pos1,&pos1+1);
2356 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2361 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2365 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2369 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2371 if(elt0 && PyInt_Check(elt0))
2373 int pos=PyInt_AS_LONG(elt0);
2376 else if(elt0 && PyTuple_Check(elt0))
2378 if(PyTuple_Size(elt0)==2)
2380 PyObject *o0=PyTuple_GetItem(elt0,0);
2381 PyObject *o1=PyTuple_GetItem(elt0,1);
2382 if(PyInt_Check(o0) && PyInt_Check(o1))
2384 int iter=PyInt_AS_LONG(o0);
2385 int order=PyInt_AS_LONG(o1);
2386 return self->getPosOfTimeStep(iter,order);
2389 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 !");
2392 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 !");
2394 else if(elt0 && PyFloat_Check(elt0))
2396 double val=PyFloat_AS_DOUBLE(elt0);
2397 return self->getPosGivenTime(val);
2400 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2403 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2405 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2411 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2413 if(PyList_Check(elts))
2415 int sz=PyList_Size(elts);
2416 std::vector<int> ret(sz);
2417 for(int i=0;i<sz;i++)
2419 PyObject *elt=PyList_GetItem(elts,i);
2420 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2426 std::vector<int> ret(1);
2427 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2432 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2434 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2435 if(!idsToRemove.empty())
2436 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2439 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2441 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2447 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2449 std::vector< std::pair<int,int> > res=self->getIterations();
2450 PyObject *ret=PyList_New(res.size());
2452 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2454 PyObject *elt=PyTuple_New(2);
2455 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2456 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2457 PyList_SetItem(ret,rk,elt);
2462 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2464 std::vector<double> res2;
2465 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2466 PyObject *ret=PyList_New(res.size());
2468 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2470 PyObject *elt=PyTuple_New(3);
2471 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2472 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2473 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2474 PyList_SetItem(ret,rk,elt);
2481 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2484 static MEDFileParameters *New();
2485 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2486 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2487 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2488 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2489 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2490 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2491 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2492 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2493 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2494 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2495 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2500 return MEDFileParameters::New();
2503 MEDFileParameters(const char *fileName)
2505 return MEDFileParameters::New(fileName);
2508 std::string __str__() const throw(INTERP_KERNEL::Exception)
2510 return self->simpleRepr();
2513 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2515 if(PyInt_Check(obj))
2517 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2522 else if(PyString_Check(obj))
2524 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2530 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2533 int __len__() const throw(INTERP_KERNEL::Exception)
2535 return self->getNumberOfParams();
2538 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2540 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2546 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2548 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2554 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2557 bool ret0=self->isEqual(other,eps,what);
2558 PyObject *res=PyList_New(2);
2559 PyObject *ret0Py=ret0?Py_True:Py_False;
2561 PyList_SetItem(res,0,ret0Py);
2562 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2568 class MEDFileData : public RefCountObject, public MEDFileWritable
2571 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2572 static MEDFileData *New();
2573 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2574 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2575 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2576 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2577 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2578 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2579 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2581 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2582 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2584 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2587 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2589 return MEDFileData::New(fileName);
2594 return MEDFileData::New();
2597 std::string __str__() const throw(INTERP_KERNEL::Exception)
2599 return self->simpleRepr();
2602 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2604 MEDFileMeshes *ret=self->getMeshes();
2610 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2612 MEDFileParameters *ret=self->getParams();
2618 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2620 MEDFileFields *ret=self->getFields();
2626 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2628 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2629 return self->changeMeshNames(modifTab);
2634 class SauvReader : public RefCountObject
2637 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2638 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2641 class SauvWriter : public RefCountObject
2644 static SauvWriter * New();
2645 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2646 void write(const char* fileName) throw(INTERP_KERNEL::Exception);