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 "MEDFileMeshReadSelector.hxx"
35 #include "MEDLoaderTypemaps.i"
36 #include "SauvReader.hxx"
37 #include "SauvWriter.hxx"
39 using namespace ParaMEDMEM;
42 #if SWIG_VERSION >= 0x010329
43 %template() std::vector<std::string>;
46 %typemap(out) ParaMEDMEM::MEDFileMesh*
48 $result=convertMEDFileMesh($1,$owner);
51 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
53 $result=convertMEDFileParameter1TS($1,$owner);
56 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
58 $result=convertMEDFileFieldMultiTS($1,$owner);
61 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
63 $result=convertMEDFileField1TS($1,$owner);
66 %newobject MEDLoader::ReadUMeshFromFamilies;
67 %newobject MEDLoader::ReadUMeshFromGroups;
68 %newobject MEDLoader::ReadUMeshFromFile;
69 %newobject MEDLoader::ReadField;
70 %newobject MEDLoader::ReadFieldCell;
71 %newobject MEDLoader::ReadFieldNode;
72 %newobject MEDLoader::ReadFieldGauss;
73 %newobject MEDLoader::ReadFieldGaussNE;
74 %newobject ParaMEDMEM::MEDFileMesh::New;
75 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
76 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
77 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
78 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
79 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
80 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
81 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
82 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
83 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
84 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
85 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
86 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
87 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
88 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
89 %newobject ParaMEDMEM::MEDFileUMesh::New;
90 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
91 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
92 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
93 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
94 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
95 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
96 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
98 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
99 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
100 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
101 %newobject ParaMEDMEM::MEDFileCMesh::New;
102 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
103 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
104 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
105 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
106 %newobject ParaMEDMEM::MEDFileMeshes::New;
107 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
108 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
109 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
110 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
111 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
113 %newobject ParaMEDMEM::MEDFileFields::New;
114 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
115 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
116 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
117 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
118 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
119 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
120 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
121 %newobject ParaMEDMEM::MEDFileFields::__iter__;
123 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
124 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
125 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
126 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
127 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
128 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
129 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
130 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
131 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
132 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
133 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
134 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
135 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
136 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
137 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
138 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
139 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
141 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
142 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
143 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
144 %newobject ParaMEDMEM::MEDFileField1TS::New;
145 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
146 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
147 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
148 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
149 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
150 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
151 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
152 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
153 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
155 %newobject ParaMEDMEM::MEDFileData::New;
156 %newobject ParaMEDMEM::MEDFileData::deepCpy;
157 %newobject ParaMEDMEM::MEDFileData::getMeshes;
158 %newobject ParaMEDMEM::MEDFileData::getFields;
159 %newobject ParaMEDMEM::MEDFileData::getParams;
161 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
162 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
163 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
164 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
165 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
166 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
167 %newobject ParaMEDMEM::MEDFileParameters::New;
168 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
169 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
170 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
171 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
173 %newobject ParaMEDMEM::SauvWriter::New;
174 %newobject ParaMEDMEM::SauvReader::New;
175 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
177 %feature("unref") MEDFileMesh "$this->decrRef();"
178 %feature("unref") MEDFileUMesh "$this->decrRef();"
179 %feature("unref") MEDFileCMesh "$this->decrRef();"
180 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
181 %feature("unref") MEDFileMeshes "$this->decrRef();"
182 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
183 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
184 %feature("unref") MEDFileField1TS "$this->decrRef();"
185 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
186 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
187 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
188 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
189 %feature("unref") MEDFileFields "$this->decrRef();"
190 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
191 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
192 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
193 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
194 %feature("unref") MEDFileParameters "$this->decrRef();"
195 %feature("unref") MEDFileData "$this->decrRef();"
196 %feature("unref") SauvReader "$this->decrRef();"
197 %feature("unref") SauvWriter "$this->decrRef();"
202 static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
203 static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
204 static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
205 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
206 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
207 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
208 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
209 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
210 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
211 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
212 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
213 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
214 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
215 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
216 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
217 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
220 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
222 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
223 PyObject *ret=PyList_New(res.size());
225 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
227 PyObject *elt=PyTuple_New(2);
228 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
229 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
230 PyList_SetItem(ret,rk,elt);
235 static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
237 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
238 PyObject *ret=PyList_New(res.size());
240 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
242 PyObject *elt=PyTuple_New(3);
243 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
244 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
245 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
246 PyList_SetItem(ret,rk,elt);
251 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
253 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
254 PyObject *ret=PyList_New(res.size());
256 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
258 PyObject *elt=PyTuple_New(2);
259 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
260 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
261 PyList_SetItem(ret,rk,elt);
265 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
267 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
268 PyObject *ret=PyList_New(res.size());
270 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
272 PyObject *elt=PyTuple_New(2);
273 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
274 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
275 PyList_SetItem(ret,rk,elt);
279 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
281 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
282 PyObject *ret=PyList_New(res.size());
284 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
286 PyObject *elt=PyTuple_New(2);
287 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
288 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
289 PyList_SetItem(ret,rk,elt);
293 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
295 int meshDim,spaceDim,numberOfNodes;
296 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
297 PyObject *ret=PyTuple_New(4);
298 PyObject *elt0=PyList_New(res.size());
300 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
302 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
304 PyObject *elt1=PyList_New(obj2.size());
305 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
307 PyObject *elt2=PyTuple_New(2);
308 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
309 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
310 PyList_SetItem(elt1,j,elt2);
312 PyList_SetItem(elt0,i,elt1);
314 PyTuple_SetItem(ret,0,elt0);
315 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
316 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
317 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
320 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
321 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
323 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
324 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
325 return convertFieldDoubleVecToPy(res);
327 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
329 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
330 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
331 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
333 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
335 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
336 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
337 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
339 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
341 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
342 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
343 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
345 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
347 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
349 PyObject *ret=PyList_New(size);
350 for(int i=0;i<size;i++)
351 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
354 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
356 std::vector<std::string> grps;
357 converPyListToVecString(li,grps);
358 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
360 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
362 std::vector<std::string> fams;
363 converPyListToVecString(li,fams);
364 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
367 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
368 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
369 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
370 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);
371 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
372 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
373 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
374 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
375 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
376 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
377 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
378 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
379 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
384 class MEDFileWritable
387 void copyOptionsFrom(const MEDFileWritable& other) const;
388 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
389 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
390 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
391 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
394 class MEDFileMeshReadSelector
397 MEDFileMeshReadSelector();
398 MEDFileMeshReadSelector(unsigned int code);
399 unsigned int getCode() const;
400 void setCode(unsigned int newCode);
401 bool isCellFamilyFieldReading() const;
402 bool isNodeFamilyFieldReading() const;
403 bool isCellNameFieldReading() const;
404 bool isNodeNameFieldReading() const;
405 bool isCellNumFieldReading() const;
406 bool isNodeNumFieldReading() const;
407 void setCellFamilyFieldReading(bool b);
408 void setNodeFamilyFieldReading(bool b);
409 void setCellNameFieldReading(bool b);
410 void setNodeNameFieldReading(bool b);
411 void setCellNumFieldReading(bool b);
412 void setNodeNumFieldReading(bool b);
415 std::string __str__() const throw(INTERP_KERNEL::Exception)
417 std::ostringstream oss;
422 std::string __repr__() const throw(INTERP_KERNEL::Exception)
424 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
430 class MEDFileMesh : public RefCountObject, public MEDFileWritable
433 static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
434 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
435 virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
436 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
437 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
438 virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
439 void setName(const char *name);
440 const char *getName();
441 const char *getUnivName() const;
442 bool getUnivNameWrStatus() const;
443 void setUnivNameWrStatus(bool newStatus);
444 void setDescription(const char *name);
445 const char *getDescription() const;
446 void setOrder(int order);
447 int getOrder() const;
448 void setIteration(int it);
450 void setTimeValue(double time);
451 void setTime(int dt, int it, double time);
452 double getTimeValue() const;
453 void setTimeUnit(const char *unit);
454 const char *getTimeUnit() const;
455 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
456 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
457 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
458 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
459 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
460 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
461 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
462 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
464 bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
465 bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
466 bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
467 void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
468 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
469 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
470 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
471 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
472 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
473 void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
474 const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
475 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
476 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
477 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
478 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
479 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
480 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
481 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
482 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
483 std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
484 std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
485 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
486 std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
487 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
488 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
489 std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
490 std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
491 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
492 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
493 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
494 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
495 void setFamilyInfo(const std::map<std::string,int>& info);
496 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
497 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
498 int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
499 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
500 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
501 int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
502 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
503 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
504 virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
505 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
506 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
507 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
508 DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
509 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
510 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
511 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
512 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
513 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
514 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
515 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
516 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
518 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
519 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
520 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
521 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
522 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
523 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
524 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
525 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
526 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
527 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
528 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
529 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
532 std::string __str__() const throw(INTERP_KERNEL::Exception)
534 return self->simpleRepr();
537 PyObject *getTime() throw(INTERP_KERNEL::Exception)
540 double tmp0=self->getTime(tmp1,tmp2);
541 PyObject *res = PyList_New(3);
542 PyList_SetItem(res,0,SWIG_From_int(tmp1));
543 PyList_SetItem(res,1,SWIG_From_int(tmp2));
544 PyList_SetItem(res,2,SWIG_From_double(tmp0));
548 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
551 bool ret0=self->isEqual(other,eps,what);
552 PyObject *res=PyList_New(2);
553 PyObject *ret0Py=ret0?Py_True:Py_False;
555 PyList_SetItem(res,0,ret0Py);
556 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
560 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
563 bool ret0=self->areFamsEqual(other,what);
564 PyObject *res=PyList_New(2);
565 PyObject *ret0Py=ret0?Py_True:Py_False;
567 PyList_SetItem(res,0,ret0Py);
568 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
572 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
575 bool ret0=self->areGrpsEqual(other,what);
576 PyObject *res=PyList_New(2);
577 PyObject *ret0Py=ret0?Py_True:Py_False;
579 PyList_SetItem(res,0,ret0Py);
580 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
584 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
586 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
589 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
592 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
594 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
597 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
600 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
602 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
605 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
608 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
611 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
612 PyObject *ret=PyTuple_New(2);
613 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
614 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
618 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
620 DataArrayInt *ret3=0;
621 std::vector<int> ret1,ret2;
622 bool ret0=self->unPolyze(ret1,ret2,ret3);
623 PyObject *ret=PyTuple_New(4);
624 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
626 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
627 for(int j=0;j<(int)ret1.size()/3;j++)
629 PyObject *retLev2=PyList_New(3);
630 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
631 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
632 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
633 PyList_SetItem(retLev1_0,j,retLev2);
635 PyTuple_SetItem(ret,1,retLev1_0);
637 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
638 for(int j=0;j<(int)ret2.size()/3;j++)
640 PyObject *retLev2=PyList_New(3);
641 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
642 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
643 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
644 PyList_SetItem(retLev1_1,j,retLev2);
646 PyTuple_SetItem(ret,2,retLev1_1);
648 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
654 class MEDFileUMesh : public MEDFileMesh
657 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
658 static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
659 static MEDFileUMesh *New();
661 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
663 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
664 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
665 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
666 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
667 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
668 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
669 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
670 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
671 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
672 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
673 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
674 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
675 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
676 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
677 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
678 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
679 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
680 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
681 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
682 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
683 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
684 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
685 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
686 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
687 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
688 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
690 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
691 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
692 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
693 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
694 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
695 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
696 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
697 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
698 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
701 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
703 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
706 MEDFileUMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
708 return MEDFileUMesh::New(fileName,mrs);
713 return MEDFileUMesh::New();
716 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
718 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
721 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
724 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
726 std::vector<const DataArrayInt *> grps;
727 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
728 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
731 void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
733 std::vector<const MEDCouplingUMesh *> ms;
734 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
735 self->setMeshes(ms,renum);
738 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
740 std::vector<const MEDCouplingUMesh *> ms;
741 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
742 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
745 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
747 std::vector<const MEDCouplingUMesh *> ms;
748 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
749 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
752 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
754 DataArrayDouble *ret=self->getCoords();
760 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
762 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
763 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
764 PyObject *ret=PyTuple_New(3);
765 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
766 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
767 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
773 class MEDFileStructuredMesh : public MEDFileMesh
777 class MEDFileCMesh : public MEDFileStructuredMesh
780 static MEDFileCMesh *New();
781 static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
782 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
783 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
788 return MEDFileCMesh::New();
791 MEDFileCMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
793 return MEDFileCMesh::New(fileName,mrs);
796 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
798 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
801 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
803 const MEDCouplingCMesh *tmp=self->getMesh();
806 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
811 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
814 static MEDFileCurveLinearMesh *New();
815 static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
816 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
817 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
820 MEDFileCurveLinearMesh()
822 return MEDFileCurveLinearMesh::New();
825 MEDFileCurveLinearMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
827 return MEDFileCurveLinearMesh::New(fileName,mrs);
830 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
832 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
835 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
837 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
840 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
845 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
848 static MEDFileMeshMultiTS *New();
849 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
850 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
851 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
852 const char *getName() const throw(INTERP_KERNEL::Exception);
853 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
854 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
859 return MEDFileMeshMultiTS::New();
862 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
864 return MEDFileMeshMultiTS::New(fileName);
867 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
869 return MEDFileMeshMultiTS::New(fileName,mName);
872 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
874 MEDFileMesh *ret=self->getOneTimeStep();
882 class MEDFileMeshesIterator
887 PyObject *next() throw(INTERP_KERNEL::Exception)
889 MEDFileMesh *ret=self->nextt();
893 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
897 PyErr_SetString(PyExc_StopIteration,"No more data.");
904 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
907 static MEDFileMeshes *New();
908 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
909 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
910 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
911 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
912 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
914 void resize(int newSize) throw(INTERP_KERNEL::Exception);
915 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
916 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
917 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
922 return MEDFileMeshes::New();
925 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
927 return MEDFileMeshes::New(fileName);
930 std::string __str__() const throw(INTERP_KERNEL::Exception)
932 return self->simpleRepr();
935 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
939 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
944 else if(PyString_Check(obj))
946 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
952 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
955 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
957 self->setMeshAtPos(obj,mesh);
961 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
963 return self->iterator();
966 int __len__() const throw(INTERP_KERNEL::Exception)
968 return self->getNumberOfMeshes();
971 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
973 MEDFileMesh *ret=self->getMeshAtPos(i);
978 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
980 MEDFileMesh *ret=self->getMeshWithName(mname);
988 class MEDFileFieldLoc : public RefCountObject
991 const std::string& getName() const;
992 int getDimension() const;
993 int getNumberOfGaussPoints() const;
994 int getNumberOfPointsInCells() const;
995 const std::vector<double>& getRefCoords() const;
996 const std::vector<double>& getGaussCoords() const;
997 const std::vector<double>& getGaussWeights() const;
998 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
1001 std::string __str__() const throw(INTERP_KERNEL::Exception)
1003 return self->repr();
1008 class MEDFileFieldGlobsReal
1011 void resetContent();
1012 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1013 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1014 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1015 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1016 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
1017 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
1018 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
1019 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
1020 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
1021 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
1022 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
1023 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
1024 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
1025 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
1026 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
1027 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
1028 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1029 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1030 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1031 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1032 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1033 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1034 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1035 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1036 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1037 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
1040 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
1042 const DataArrayInt *ret=self->getProfile(pflName);
1045 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1048 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1050 const DataArrayInt *ret=self->getProfileFromId(pflId);
1053 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1056 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1058 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1061 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1064 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1066 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1069 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1072 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1074 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1075 return convertVecPairVecStToPy(ret);
1078 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1080 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1081 return convertVecPairVecStToPy(ret);
1084 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1086 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1087 self->changePflsNames(v);
1090 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1092 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1093 self->changePflsRefsNamesGen(v);
1096 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1098 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1099 self->changePflsNamesInStruct(v);
1102 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1104 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1105 self->changeLocsNames(v);
1108 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1110 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1111 self->changeLocsRefsNamesGen(v);
1114 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1116 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1117 self->changeLocsNamesInStruct(v);
1120 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1122 std::ostringstream oss;
1123 self->simpleReprGlobs(oss);
1129 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1132 static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1133 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1134 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1135 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1136 void loadArrays() throw(INTERP_KERNEL::Exception);
1137 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1138 void releaseArrays() throw(INTERP_KERNEL::Exception);
1139 int getDimension() const throw(INTERP_KERNEL::Exception);
1140 int getIteration() const throw(INTERP_KERNEL::Exception);
1141 int getOrder() const throw(INTERP_KERNEL::Exception);
1142 std::string getName() throw(INTERP_KERNEL::Exception);
1143 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1144 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1145 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1146 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
1147 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
1148 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1149 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1150 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1151 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1152 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1153 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1154 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1155 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1156 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1159 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1162 double tmp0=self->getTime(tmp1,tmp2);
1163 PyObject *res = PyList_New(3);
1164 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1165 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1166 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1170 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1172 std::pair<int,int> res=self->getDtIt();
1173 PyObject *elt=PyTuple_New(2);
1174 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1175 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1179 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1181 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1184 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1186 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1189 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1191 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1192 return self->changeMeshNames(modifTab);
1195 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1197 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1198 PyObject *ret2=PyList_New(ret.size());
1199 for(int i=0;i<(int)ret.size();i++)
1200 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1204 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1206 std::vector<int> ret1;
1207 int ret0=self->getNonEmptyLevels(mname,ret1);
1208 PyObject *elt=PyTuple_New(2);
1209 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1210 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1214 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1216 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1217 std::vector< std::vector<TypeOfField> > typesF;
1218 std::vector< std::vector<std::string> > pfls;
1219 std::vector< std::vector<std::string> > locs;
1220 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1222 PyObject *ret2=PyList_New(sz);
1223 for(int i=0;i<sz;i++)
1225 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1226 const std::vector<TypeOfField>& typesFI=typesF[i];
1227 const std::vector<std::string>& pflsI=pfls[i];
1228 const std::vector<std::string>& locsI=locs[i];
1229 PyObject *elt=PyTuple_New(2);
1230 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1231 int sz2=ret[i].size();
1232 PyObject *elt2=PyList_New(sz2);
1233 for(int j=0;j<sz2;j++)
1235 PyObject *elt3=PyTuple_New(4);
1236 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1237 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));
1238 PyTuple_SetItem(elt3,1,elt4);
1239 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1240 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1241 PyList_SetItem(elt2,j,elt3);
1243 PyTuple_SetItem(elt,1,elt2);
1244 PyList_SetItem(ret2,i,elt);
1249 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1251 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1252 std::size_t sz=ret.size();
1253 PyObject *retPy=PyList_New(sz);
1254 for(std::size_t i=0;i<sz;i++)
1255 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1259 PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
1261 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
1262 std::size_t sz=ret.size();
1263 PyObject *retPy=PyList_New(sz);
1264 for(std::size_t i=0;i<sz;i++)
1265 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1271 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1274 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1275 static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1276 static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1277 static MEDFileField1TS *New();
1278 ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1279 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1280 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1281 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1282 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1283 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1285 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1286 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1287 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1288 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1291 MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1293 return MEDFileField1TS::New(fileName,loadAll);
1296 MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1298 return MEDFileField1TS::New(fileName,fieldName,loadAll);
1301 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1303 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1308 return MEDFileField1TS::New();
1311 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1313 const DataArrayDouble *arr=0;
1315 arr=field->getArray();
1316 self->copyTinyInfoFrom(field,arr);
1319 std::string __str__() const throw(INTERP_KERNEL::Exception)
1321 return self->simpleRepr();
1324 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1326 DataArrayInt *ret1=0;
1327 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1328 PyObject *ret=PyTuple_New(2);
1329 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1330 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1334 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1336 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1337 std::vector< std::vector<TypeOfField> > typesF;
1338 std::vector< std::vector<std::string> > pfls;
1339 std::vector< std::vector<std::string> > locs;
1340 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1342 PyObject *ret2=PyList_New(sz);
1343 for(int i=0;i<sz;i++)
1345 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1346 const std::vector<TypeOfField>& typesFI=typesF[i];
1347 const std::vector<std::string>& pflsI=pfls[i];
1348 const std::vector<std::string>& locsI=locs[i];
1349 PyObject *elt=PyTuple_New(2);
1350 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1351 int sz2=ret[i].size();
1352 PyObject *elt2=PyList_New(sz2);
1353 for(int j=0;j<sz2;j++)
1355 PyObject *elt3=PyTuple_New(4);
1356 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1357 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1358 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1359 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1360 PyList_SetItem(elt2,j,elt3);
1362 PyTuple_SetItem(elt,1,elt2);
1363 PyList_SetItem(ret2,i,elt);
1368 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1370 DataArrayDouble *ret=self->getUndergroundDataArray();
1376 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1378 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1379 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1382 PyObject *ret=PyTuple_New(2);
1383 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1384 std::size_t sz=elt1Cpp.size();
1385 PyObject *elt=PyList_New(sz);
1386 for(std::size_t i=0;i<sz;i++)
1388 PyObject *elt1=PyTuple_New(2);
1389 PyObject *elt2=PyTuple_New(2);
1390 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1391 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1392 PyObject *elt3=PyTuple_New(2);
1393 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1394 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1395 PyTuple_SetItem(elt1,0,elt2);
1396 PyTuple_SetItem(elt1,1,elt3);
1397 PyList_SetItem(elt,i,elt1);
1399 PyTuple_SetItem(ret,1,elt);
1405 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1408 static MEDFileIntField1TS *New();
1409 static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1410 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1411 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1412 ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1414 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1415 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1418 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1420 return MEDFileIntField1TS::New();
1423 MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1425 return MEDFileIntField1TS::New(fileName,loadAll);
1428 MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1430 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1433 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1435 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1438 std::string __str__() const throw(INTERP_KERNEL::Exception)
1440 return self->simpleRepr();
1443 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1445 DataArrayInt *ret1=0;
1446 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1447 PyObject *ret=PyTuple_New(2);
1448 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1449 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1453 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1455 DataArrayInt *ret1=0;
1456 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1457 PyObject *ret=PyTuple_New(2);
1458 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1459 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1463 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1465 DataArrayInt *ret1=0;
1466 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1467 PyObject *ret=PyTuple_New(2);
1468 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1469 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1473 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1475 DataArrayInt *ret1=0;
1476 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1477 PyObject *ret=PyTuple_New(2);
1478 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1479 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1483 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1485 DataArrayInt *ret1=0;
1486 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1487 PyObject *ret=PyTuple_New(2);
1488 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1489 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1493 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1495 DataArrayInt *ret1=0;
1496 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1497 PyObject *ret=PyTuple_New(2);
1498 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1499 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1503 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1505 DataArrayInt *ret=self->getUndergroundDataArray();
1513 class MEDFileAnyTypeFieldMultiTSIterator
1518 PyObject *next() throw(INTERP_KERNEL::Exception)
1520 MEDFileAnyTypeField1TS *ret=self->nextt();
1522 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1525 PyErr_SetString(PyExc_StopIteration,"No more data.");
1532 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1535 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1536 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1537 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1538 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1539 std::string getName() const throw(INTERP_KERNEL::Exception);
1540 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1541 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1542 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1543 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1544 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1545 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1546 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1547 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1548 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1549 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1550 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1551 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1552 void loadArrays() throw(INTERP_KERNEL::Exception);
1553 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1554 void releaseArrays() throw(INTERP_KERNEL::Exception);
1556 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1557 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1558 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1559 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1560 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1563 int __len__() const throw(INTERP_KERNEL::Exception)
1565 return self->getNumberOfTS();
1568 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1570 if(elt0 && PyInt_Check(elt0))
1572 int pos=PyInt_AS_LONG(elt0);
1575 else if(elt0 && PyTuple_Check(elt0))
1577 if(PyTuple_Size(elt0)==2)
1579 PyObject *o0=PyTuple_GetItem(elt0,0);
1580 PyObject *o1=PyTuple_GetItem(elt0,1);
1581 if(PyInt_Check(o0) && PyInt_Check(o1))
1583 int iter=PyInt_AS_LONG(o0);
1584 int order=PyInt_AS_LONG(o1);
1585 return self->getPosOfTimeStep(iter,order);
1588 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 !");
1591 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 !");
1593 else if(elt0 && PyFloat_Check(elt0))
1595 double val=PyFloat_AS_DOUBLE(elt0);
1596 return self->getPosGivenTime(val);
1599 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1602 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1604 std::vector< std::pair<int,int> > res=self->getIterations();
1605 PyObject *ret=PyList_New(res.size());
1607 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1609 PyObject *elt=PyTuple_New(2);
1610 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1611 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1612 PyList_SetItem(ret,rk,elt);
1617 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1619 std::vector<double> ret1;
1620 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1621 std::size_t sz=ret.size();
1622 PyObject *ret2=PyList_New(sz);
1623 for(std::size_t i=0;i<sz;i++)
1625 PyObject *elt=PyTuple_New(3);
1626 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1627 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1628 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1629 PyList_SetItem(ret2,i,elt);
1634 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1636 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1637 PyObject *ret2=PyList_New(ret.size());
1638 for(int i=0;i<(int)ret.size();i++)
1640 const std::vector<TypeOfField>& rett=ret[i];
1641 PyObject *ret3=PyList_New(rett.size());
1642 for(int j=0;j<(int)rett.size();j++)
1643 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1644 PyList_SetItem(ret2,i,ret3);
1649 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1651 std::vector<int> ret1;
1652 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1653 PyObject *elt=PyTuple_New(2);
1654 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1655 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1659 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1661 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1662 std::vector< std::vector<TypeOfField> > typesF;
1663 std::vector< std::vector<std::string> > pfls;
1664 std::vector< std::vector<std::string> > locs;
1665 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1667 PyObject *ret2=PyList_New(sz);
1668 for(int i=0;i<sz;i++)
1670 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1671 const std::vector<TypeOfField>& typesFI=typesF[i];
1672 const std::vector<std::string>& pflsI=pfls[i];
1673 const std::vector<std::string>& locsI=locs[i];
1674 PyObject *elt=PyTuple_New(2);
1675 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1676 int sz2=ret[i].size();
1677 PyObject *elt2=PyList_New(sz2);
1678 for(int j=0;j<sz2;j++)
1680 PyObject *elt3=PyTuple_New(4);
1681 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1682 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));
1683 PyTuple_SetItem(elt3,1,elt4);
1684 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1685 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1686 PyList_SetItem(elt2,j,elt3);
1688 PyTuple_SetItem(elt,1,elt2);
1689 PyList_SetItem(ret2,i,elt);
1694 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1696 if(PyList_Check(elts))
1698 int sz=PyList_Size(elts);
1699 std::vector<int> ret(sz);
1700 for(int i=0;i<sz;i++)
1702 PyObject *elt=PyList_GetItem(elts,i);
1703 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1709 std::vector<int> ret(1);
1710 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1715 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1717 if(PySlice_Check(elts))
1719 Py_ssize_t strt=2,stp=2,step=2;
1720 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1721 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1723 self->eraseTimeStepIds2(strt,stp,step);
1726 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1730 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1731 if(!idsToRemove.empty())
1732 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1736 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1740 std::vector<int> pos2;
1741 DataArrayInt *pos3=0;
1742 DataArrayIntTuple *pos4=0;
1743 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1748 self->eraseTimeStepIds(&pos1,&pos1+1);
1755 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1760 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1764 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1768 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1770 return self->iterator();
1773 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1775 if(elt0 && PyList_Check(elt0))
1777 int sz=PyList_Size(elt0);
1778 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1779 int *pt=da->getPointer();
1780 for(int i=0;i<sz;i++,pt++)
1782 PyObject *elt1=PyList_GetItem(elt0,i);
1783 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1785 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1787 else if(elt0 && PySlice_Check(elt0))
1789 Py_ssize_t strt=2,stp=2,step=2;
1790 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1791 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1792 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1794 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1797 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1800 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1802 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1803 return self->changeMeshNames(modifTab);
1806 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1808 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1809 std::size_t sz=ret.size();
1810 PyObject *retPy=PyList_New(sz);
1811 for(std::size_t i=0;i<sz;i++)
1812 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1816 PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
1818 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
1819 std::size_t sz=ret.size();
1820 PyObject *retPy=PyList_New(sz);
1821 for(std::size_t i=0;i<sz;i++)
1822 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1826 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1828 std::vector<MEDFileAnyTypeField1TS *> tmp;
1829 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1830 self->pushBackTimeSteps(tmp);
1833 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception)
1835 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
1836 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
1837 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
1838 std::size_t sz=ret.size();
1839 PyObject *retPy=PyList_New(sz);
1840 for(std::size_t i=0;i<sz;i++)
1842 std::size_t sz2=ret[i].size();
1843 PyObject *ret1Py=PyList_New(sz2);
1844 for(std::size_t j=0;j<sz2;j++)
1846 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
1849 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
1851 PyList_SetItem(retPy,i,ret1Py);
1856 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
1858 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
1859 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
1860 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh);
1861 std::size_t sz=ret.size();
1862 PyObject *retPy=PyList_New(sz);
1863 for(std::size_t i=0;i<sz;i++)
1865 std::size_t sz2=ret[i].size();
1866 PyObject *ret1Py=PyList_New(sz2);
1867 for(std::size_t j=0;j<sz2;j++)
1869 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
1872 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
1874 PyList_SetItem(retPy,i,ret1Py);
1881 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1884 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1885 static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1886 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1888 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1889 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1890 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1891 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1892 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1894 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1895 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1896 ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1899 MEDFileFieldMultiTS()
1901 return MEDFileFieldMultiTS::New();
1904 MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1906 return MEDFileFieldMultiTS::New(fileName,loadAll);
1909 MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1911 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
1914 std::string __str__() const throw(INTERP_KERNEL::Exception)
1916 return self->simpleRepr();
1919 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1921 DataArrayInt *ret1=0;
1922 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1923 PyObject *ret=PyTuple_New(2);
1924 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1925 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1929 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1931 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1932 std::vector< std::vector<TypeOfField> > typesF;
1933 std::vector< std::vector<std::string> > pfls;
1934 std::vector< std::vector<std::string> > locs;
1935 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1937 PyObject *ret2=PyList_New(sz);
1938 for(int i=0;i<sz;i++)
1940 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1941 const std::vector<TypeOfField>& typesFI=typesF[i];
1942 const std::vector<std::string>& pflsI=pfls[i];
1943 const std::vector<std::string>& locsI=locs[i];
1944 PyObject *elt=PyTuple_New(2);
1945 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1946 int sz2=ret[i].size();
1947 PyObject *elt2=PyList_New(sz2);
1948 for(int j=0;j<sz2;j++)
1950 PyObject *elt3=PyTuple_New(4);
1951 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1952 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1953 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1954 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1955 PyList_SetItem(elt2,j,elt3);
1957 PyTuple_SetItem(elt,1,elt2);
1958 PyList_SetItem(ret2,i,elt);
1962 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1964 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1970 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1972 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1973 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1976 PyObject *ret=PyTuple_New(2);
1977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1978 std::size_t sz=elt1Cpp.size();
1979 PyObject *elt=PyList_New(sz);
1980 for(std::size_t i=0;i<sz;i++)
1982 PyObject *elt1=PyTuple_New(2);
1983 PyObject *elt2=PyTuple_New(2);
1984 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1985 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1986 PyObject *elt3=PyTuple_New(2);
1987 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1988 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1989 PyTuple_SetItem(elt1,0,elt2);
1990 PyTuple_SetItem(elt1,1,elt3);
1991 PyList_SetItem(elt,i,elt1);
1993 PyTuple_SetItem(ret,1,elt);
1999 class MEDFileFieldsIterator
2004 PyObject *next() throw(INTERP_KERNEL::Exception)
2006 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
2008 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
2011 PyErr_SetString(PyExc_StopIteration,"No more data.");
2018 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2021 static MEDFileIntFieldMultiTS *New();
2022 static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2023 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2025 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
2026 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
2027 ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
2030 MEDFileIntFieldMultiTS()
2032 return MEDFileIntFieldMultiTS::New();
2035 MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2037 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
2040 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2042 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
2045 std::string __str__() const throw(INTERP_KERNEL::Exception)
2047 return self->simpleRepr();
2050 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2052 DataArrayInt *ret1=0;
2053 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
2054 PyObject *ret=PyTuple_New(2);
2055 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2056 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2060 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2062 DataArrayInt *ret1=0;
2063 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
2064 PyObject *ret=PyTuple_New(2);
2065 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2066 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2070 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2072 DataArrayInt *ret1=0;
2073 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
2074 PyObject *ret=PyTuple_New(2);
2075 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2076 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2080 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2082 DataArrayInt *ret1=0;
2083 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
2084 PyObject *ret=PyTuple_New(2);
2085 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2086 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2090 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2092 DataArrayInt *ret1=0;
2093 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
2094 PyObject *ret=PyTuple_New(2);
2095 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2096 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2100 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2102 DataArrayInt *ret1=0;
2103 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2104 PyObject *ret=PyTuple_New(2);
2105 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2106 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2110 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2112 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2120 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2123 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2124 static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2125 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2126 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2127 void loadArrays() throw(INTERP_KERNEL::Exception);
2128 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
2129 void releaseArrays() throw(INTERP_KERNEL::Exception);
2130 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2131 int getNumberOfFields() const;
2132 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2133 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2135 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2136 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2137 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2138 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2139 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2140 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2141 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2142 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2147 return MEDFileFields::New();
2150 MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2152 return MEDFileFields::New(fileName,loadAll);
2155 std::string __str__() const throw(INTERP_KERNEL::Exception)
2157 return self->simpleRepr();
2160 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2163 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2164 PyObject *ret=PyTuple_New(2);
2165 PyObject *ret_0=PyList_New(ret0.size());
2167 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2169 PyObject *elt=PyTuple_New(2);
2170 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2171 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2172 PyList_SetItem(ret_0,rk,elt);
2174 PyTuple_SetItem(ret,0,ret_0);
2175 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2176 PyTuple_SetItem(ret,1,ret_1);
2180 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2182 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2183 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2186 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2188 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2189 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2192 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2194 if(obj && PyList_Check(obj))
2196 int sz=PyList_Size(obj);
2197 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2198 int *pt=da->getPointer();
2199 for(int i=0;i<sz;i++,pt++)
2201 PyObject *elt1=PyList_GetItem(obj,i);
2202 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2204 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2207 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2210 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2212 self->setFieldAtPos(obj,field);
2216 int __len__() const throw(INTERP_KERNEL::Exception)
2218 return self->getNumberOfFields();
2221 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2223 return self->iterator();
2226 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2228 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2229 return self->changeMeshNames(modifTab);
2232 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2234 if(elt0 && PyInt_Check(elt0))
2236 return PyInt_AS_LONG(elt0);
2238 else if(elt0 && PyString_Check(elt0))
2239 return self->getPosFromFieldName(PyString_AsString(elt0));
2241 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2244 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2246 if(PyList_Check(elts))
2248 int sz=PyList_Size(elts);
2249 std::vector<int> ret(sz);
2250 for(int i=0;i<sz;i++)
2252 PyObject *elt=PyList_GetItem(elts,i);
2253 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2259 std::vector<int> ret(1);
2260 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2265 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2267 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2268 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2269 self->pushFields(tmp);
2272 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2274 if(elts && PySlice_Check(elts))
2276 Py_ssize_t strt=2,stp=2,step=2;
2277 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2278 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2279 self->destroyFieldsAtPos2(strt,stp,step);
2281 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2285 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2286 if(!idsToRemove.empty())
2287 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2293 class MEDFileParameter1TS : public RefCountObject
2296 void setIteration(int it);
2297 int getIteration() const;
2298 void setOrder(int order);
2299 int getOrder() const;
2300 void setTimeValue(double time);
2301 void setTime(int dt, int it, double time);
2302 double getTime(int& dt, int& it);
2303 double getTimeValue() const;
2306 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2309 void setValue(double val) throw(INTERP_KERNEL::Exception);
2310 double getValue() const throw(INTERP_KERNEL::Exception);
2311 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2314 std::string __str__() const throw(INTERP_KERNEL::Exception)
2316 return self->simpleRepr();
2321 class MEDFileParameterTinyInfo : public MEDFileWritable
2324 void setDescription(const char *name);
2325 const char *getDescription() const;
2326 void setTimeUnit(const char *unit);
2327 const char *getTimeUnit() const;
2330 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2333 static MEDFileParameterDouble1TS *New();
2334 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2335 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2336 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2337 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2338 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2339 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2340 const char *getName() const throw(INTERP_KERNEL::Exception);
2341 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2344 MEDFileParameterDouble1TS()
2346 return MEDFileParameterDouble1TS::New();
2349 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2351 return MEDFileParameterDouble1TS::New(fileName);
2354 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2356 return MEDFileParameterDouble1TS::New(fileName,paramName);
2359 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2361 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2364 std::string __str__() const throw(INTERP_KERNEL::Exception)
2366 return self->simpleRepr();
2369 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2372 bool ret0=self->isEqual(other,eps,what);
2373 PyObject *res=PyList_New(2);
2374 PyObject *ret0Py=ret0?Py_True:Py_False;
2376 PyList_SetItem(res,0,ret0Py);
2377 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2383 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2386 static MEDFileParameterMultiTS *New();
2387 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2388 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2389 const char *getName() const;
2390 void setName(const char *name);
2391 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2392 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2393 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2394 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2395 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2396 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2397 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2400 MEDFileParameterMultiTS()
2402 return MEDFileParameterMultiTS::New();
2405 MEDFileParameterMultiTS(const char *fileName)
2407 return MEDFileParameterMultiTS::New(fileName);
2410 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2412 return MEDFileParameterMultiTS::New(fileName,paramName);
2415 std::string __str__() const throw(INTERP_KERNEL::Exception)
2417 return self->simpleRepr();
2420 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2423 bool ret0=self->isEqual(other,eps,what);
2424 PyObject *res=PyList_New(2);
2425 PyObject *ret0Py=ret0?Py_True:Py_False;
2427 PyList_SetItem(res,0,ret0Py);
2428 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2432 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2436 std::vector<int> pos2;
2437 DataArrayInt *pos3=0;
2438 DataArrayIntTuple *pos4=0;
2439 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2444 self->eraseTimeStepIds(&pos1,&pos1+1);
2451 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2456 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2460 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2464 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2466 if(elt0 && PyInt_Check(elt0))
2468 int pos=PyInt_AS_LONG(elt0);
2471 else if(elt0 && PyTuple_Check(elt0))
2473 if(PyTuple_Size(elt0)==2)
2475 PyObject *o0=PyTuple_GetItem(elt0,0);
2476 PyObject *o1=PyTuple_GetItem(elt0,1);
2477 if(PyInt_Check(o0) && PyInt_Check(o1))
2479 int iter=PyInt_AS_LONG(o0);
2480 int order=PyInt_AS_LONG(o1);
2481 return self->getPosOfTimeStep(iter,order);
2484 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 !");
2487 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 !");
2489 else if(elt0 && PyFloat_Check(elt0))
2491 double val=PyFloat_AS_DOUBLE(elt0);
2492 return self->getPosGivenTime(val);
2495 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2498 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2500 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2506 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2508 if(PyList_Check(elts))
2510 int sz=PyList_Size(elts);
2511 std::vector<int> ret(sz);
2512 for(int i=0;i<sz;i++)
2514 PyObject *elt=PyList_GetItem(elts,i);
2515 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2521 std::vector<int> ret(1);
2522 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2527 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2529 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2530 if(!idsToRemove.empty())
2531 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2534 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2536 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2542 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2544 std::vector< std::pair<int,int> > res=self->getIterations();
2545 PyObject *ret=PyList_New(res.size());
2547 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2549 PyObject *elt=PyTuple_New(2);
2550 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2551 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2552 PyList_SetItem(ret,rk,elt);
2557 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2559 std::vector<double> res2;
2560 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2561 PyObject *ret=PyList_New(res.size());
2563 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2565 PyObject *elt=PyTuple_New(3);
2566 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2567 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2568 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2569 PyList_SetItem(ret,rk,elt);
2576 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2579 static MEDFileParameters *New();
2580 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2581 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2582 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2583 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2584 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2585 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2586 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2587 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2588 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2589 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2590 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2595 return MEDFileParameters::New();
2598 MEDFileParameters(const char *fileName)
2600 return MEDFileParameters::New(fileName);
2603 std::string __str__() const throw(INTERP_KERNEL::Exception)
2605 return self->simpleRepr();
2608 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2610 if(PyInt_Check(obj))
2612 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2617 else if(PyString_Check(obj))
2619 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2625 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2628 int __len__() const throw(INTERP_KERNEL::Exception)
2630 return self->getNumberOfParams();
2633 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2635 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2641 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2643 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2649 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2652 bool ret0=self->isEqual(other,eps,what);
2653 PyObject *res=PyList_New(2);
2654 PyObject *ret0Py=ret0?Py_True:Py_False;
2656 PyList_SetItem(res,0,ret0Py);
2657 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2663 class MEDFileData : public RefCountObject, public MEDFileWritable
2666 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2667 static MEDFileData *New();
2668 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2669 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2670 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2671 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2672 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2673 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2674 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2676 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2677 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2679 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2682 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2684 return MEDFileData::New(fileName);
2689 return MEDFileData::New();
2692 std::string __str__() const throw(INTERP_KERNEL::Exception)
2694 return self->simpleRepr();
2697 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2699 MEDFileMeshes *ret=self->getMeshes();
2705 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2707 MEDFileParameters *ret=self->getParams();
2713 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2715 MEDFileFields *ret=self->getFields();
2721 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2723 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2724 return self->changeMeshNames(modifTab);
2729 class SauvReader : public RefCountObject
2732 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2733 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2736 class SauvWriter : public RefCountObject
2739 static SauvWriter * New();
2740 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2741 void write(const char* fileName) throw(INTERP_KERNEL::Exception);