1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
23 #define MEDCOUPLING_EXPORT
24 #define MEDLOADER_EXPORT
26 %include "MEDCouplingCommon.i"
29 #include "MEDLoader.hxx"
30 #include "MEDFileMesh.hxx"
31 #include "MEDFileField.hxx"
32 #include "MEDFileParameter.hxx"
33 #include "MEDFileData.hxx"
34 #include "MEDLoaderTypemaps.i"
35 #include "SauvReader.hxx"
36 #include "SauvWriter.hxx"
38 using namespace ParaMEDMEM;
41 #if SWIG_VERSION >= 0x010329
42 %template() std::vector<std::string>;
45 %typemap(out) ParaMEDMEM::MEDFileMesh*
47 $result=convertMEDFileMesh($1,$owner);
50 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
52 $result=convertMEDFileParameter1TS($1,$owner);
55 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
57 $result=convertMEDFileFieldMultiTS($1,$owner);
60 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
62 $result=convertMEDFileField1TS($1,$owner);
65 %newobject MEDLoader::ReadUMeshFromFamilies;
66 %newobject MEDLoader::ReadUMeshFromGroups;
67 %newobject MEDLoader::ReadUMeshFromFile;
68 %newobject MEDLoader::ReadField;
69 %newobject MEDLoader::ReadFieldCell;
70 %newobject MEDLoader::ReadFieldNode;
71 %newobject MEDLoader::ReadFieldGauss;
72 %newobject MEDLoader::ReadFieldGaussNE;
73 %newobject ParaMEDMEM::MEDFileMesh::New;
74 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
75 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
76 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
77 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
78 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
79 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
80 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
81 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
82 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
83 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
84 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
85 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
86 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
87 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
88 %newobject ParaMEDMEM::MEDFileUMesh::New;
89 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
90 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
91 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
92 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
93 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
94 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
95 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
96 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
98 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
99 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
100 %newobject ParaMEDMEM::MEDFileCMesh::New;
101 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
102 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
103 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
104 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
105 %newobject ParaMEDMEM::MEDFileMeshes::New;
106 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
107 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
108 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
109 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
110 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
112 %newobject ParaMEDMEM::MEDFileFields::New;
113 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
114 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
115 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
116 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
117 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
118 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
119 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
120 %newobject ParaMEDMEM::MEDFileFields::__iter__;
122 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
123 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
124 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
125 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
126 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
127 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
128 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
129 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
130 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
131 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
132 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
133 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
134 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
135 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
136 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
138 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
139 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
140 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
141 %newobject ParaMEDMEM::MEDFileField1TS::New;
142 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
143 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
144 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
145 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
146 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
147 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
148 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
149 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
150 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
152 %newobject ParaMEDMEM::MEDFileData::New;
153 %newobject ParaMEDMEM::MEDFileData::deepCpy;
154 %newobject ParaMEDMEM::MEDFileData::getMeshes;
155 %newobject ParaMEDMEM::MEDFileData::getFields;
156 %newobject ParaMEDMEM::MEDFileData::getParams;
158 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
159 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
160 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
161 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
162 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
163 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
164 %newobject ParaMEDMEM::MEDFileParameters::New;
165 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
166 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
167 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
168 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
170 %newobject ParaMEDMEM::SauvWriter::New;
171 %newobject ParaMEDMEM::SauvReader::New;
172 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
174 %feature("unref") MEDFileMesh "$this->decrRef();"
175 %feature("unref") MEDFileUMesh "$this->decrRef();"
176 %feature("unref") MEDFileCMesh "$this->decrRef();"
177 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
178 %feature("unref") MEDFileMeshes "$this->decrRef();"
179 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
180 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
181 %feature("unref") MEDFileField1TS "$this->decrRef();"
182 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
183 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
184 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
185 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
186 %feature("unref") MEDFileFields "$this->decrRef();"
187 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
188 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
189 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
190 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
191 %feature("unref") MEDFileParameters "$this->decrRef();"
192 %feature("unref") MEDFileData "$this->decrRef();"
193 %feature("unref") SauvReader "$this->decrRef();"
194 %feature("unref") SauvWriter "$this->decrRef();"
199 static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
200 static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
201 static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
202 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
203 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
204 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
205 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
206 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
207 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
208 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
209 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
210 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
211 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
212 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
213 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
214 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
217 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
219 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
220 PyObject *ret=PyList_New(res.size());
222 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
224 PyObject *elt=PyTuple_New(2);
225 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
226 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
227 PyList_SetItem(ret,rk,elt);
232 static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
234 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
235 PyObject *ret=PyList_New(res.size());
237 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
239 PyObject *elt=PyTuple_New(3);
240 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
241 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
242 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
243 PyList_SetItem(ret,rk,elt);
248 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
250 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
251 PyObject *ret=PyList_New(res.size());
253 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
255 PyObject *elt=PyTuple_New(2);
256 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
257 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
258 PyList_SetItem(ret,rk,elt);
262 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
264 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
265 PyObject *ret=PyList_New(res.size());
267 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
269 PyObject *elt=PyTuple_New(2);
270 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
271 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
272 PyList_SetItem(ret,rk,elt);
276 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
278 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
279 PyObject *ret=PyList_New(res.size());
281 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
283 PyObject *elt=PyTuple_New(2);
284 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
285 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
286 PyList_SetItem(ret,rk,elt);
290 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
292 int meshDim,spaceDim,numberOfNodes;
293 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
294 PyObject *ret=PyTuple_New(4);
295 PyObject *elt0=PyList_New(res.size());
297 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
299 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
301 PyObject *elt1=PyList_New(obj2.size());
302 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
304 PyObject *elt2=PyTuple_New(2);
305 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
306 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
307 PyList_SetItem(elt1,j,elt2);
309 PyList_SetItem(elt0,i,elt1);
311 PyTuple_SetItem(ret,0,elt0);
312 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
313 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
314 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
317 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
318 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
320 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
321 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
322 return convertFieldDoubleVecToPy(res);
324 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
326 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
327 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
328 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
330 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
332 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
333 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
334 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
336 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
338 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
339 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
340 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
342 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
344 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
346 PyObject *ret=PyList_New(size);
347 for(int i=0;i<size;i++)
348 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
351 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
353 std::vector<std::string> grps;
354 converPyListToVecString(li,grps);
355 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
357 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
359 std::vector<std::string> fams;
360 converPyListToVecString(li,fams);
361 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
364 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
365 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
366 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
367 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);
368 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
369 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
370 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
371 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
372 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
373 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
374 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
375 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
376 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
381 class MEDFileWritable
384 void copyOptionsFrom(const MEDFileWritable& other) const;
385 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
386 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
387 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
388 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
391 class MEDFileMesh : public RefCountObject, public MEDFileWritable
394 static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
395 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
396 virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
397 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
398 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
399 virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
400 void setName(const char *name);
401 const char *getName();
402 const char *getUnivName() const;
403 bool getUnivNameWrStatus() const;
404 void setUnivNameWrStatus(bool newStatus);
405 void setDescription(const char *name);
406 const char *getDescription() const;
407 void setOrder(int order);
408 int getOrder() const;
409 void setIteration(int it);
411 void setTimeValue(double time);
412 void setTime(int dt, int it, double time);
413 double getTimeValue() const;
414 void setTimeUnit(const char *unit);
415 const char *getTimeUnit() const;
416 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
417 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
418 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
419 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
420 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
421 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
422 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
423 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
425 bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
426 bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
427 bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
428 void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
429 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
430 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
431 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
432 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
433 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
434 void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
435 const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
436 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
437 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
438 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
439 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
440 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
441 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
442 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
443 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
444 std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
445 std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
446 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
447 std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
448 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
449 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
450 std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
451 std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
452 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
453 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
454 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
455 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
456 void setFamilyInfo(const std::map<std::string,int>& info);
457 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
458 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
459 int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
460 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
461 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
462 int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
463 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
464 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
465 virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
466 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
467 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
468 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
469 DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
470 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
471 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
472 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
473 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
474 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
475 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
476 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
477 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
479 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
480 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
481 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
482 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
483 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
484 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
485 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
486 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
487 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
488 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
489 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
490 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
493 MEDFileMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
495 return MEDFileMesh::New(fileName);
498 MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
500 return MEDFileMesh::New(fileName,mName,dt,it);
503 std::string __str__() const throw(INTERP_KERNEL::Exception)
505 return self->simpleRepr();
508 PyObject *getTime() throw(INTERP_KERNEL::Exception)
511 double tmp0=self->getTime(tmp1,tmp2);
512 PyObject *res = PyList_New(3);
513 PyList_SetItem(res,0,SWIG_From_int(tmp1));
514 PyList_SetItem(res,1,SWIG_From_int(tmp2));
515 PyList_SetItem(res,2,SWIG_From_double(tmp0));
519 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
522 bool ret0=self->isEqual(other,eps,what);
523 PyObject *res=PyList_New(2);
524 PyObject *ret0Py=ret0?Py_True:Py_False;
526 PyList_SetItem(res,0,ret0Py);
527 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
531 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
534 bool ret0=self->areFamsEqual(other,what);
535 PyObject *res=PyList_New(2);
536 PyObject *ret0Py=ret0?Py_True:Py_False;
538 PyList_SetItem(res,0,ret0Py);
539 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
543 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
546 bool ret0=self->areGrpsEqual(other,what);
547 PyObject *res=PyList_New(2);
548 PyObject *ret0Py=ret0?Py_True:Py_False;
550 PyList_SetItem(res,0,ret0Py);
551 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
555 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
557 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
560 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
563 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
565 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
568 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
571 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
573 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
576 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
579 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
582 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
583 PyObject *ret=PyTuple_New(2);
584 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
585 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
589 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
591 DataArrayInt *ret3=0;
592 std::vector<int> ret1,ret2;
593 bool ret0=self->unPolyze(ret1,ret2,ret3);
594 PyObject *ret=PyTuple_New(4);
595 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
597 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
598 for(int j=0;j<(int)ret1.size()/3;j++)
600 PyObject *retLev2=PyList_New(3);
601 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
602 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
603 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
604 PyList_SetItem(retLev1_0,j,retLev2);
606 PyTuple_SetItem(ret,1,retLev1_0);
608 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
609 for(int j=0;j<(int)ret2.size()/3;j++)
611 PyObject *retLev2=PyList_New(3);
612 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
613 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
614 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
615 PyList_SetItem(retLev1_1,j,retLev2);
617 PyTuple_SetItem(ret,2,retLev1_1);
619 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
625 class MEDFileUMesh : public MEDFileMesh
628 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
629 static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
630 static MEDFileUMesh *New();
632 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
634 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
635 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
636 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
637 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
638 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
639 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
640 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
641 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
642 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
643 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
644 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
645 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
646 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
647 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
648 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
649 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
650 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
651 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
652 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
653 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
654 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
655 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
656 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
657 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
658 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
659 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
661 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
662 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
663 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
664 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
665 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
666 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
667 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
668 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
669 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
672 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
674 return MEDFileUMesh::New(fileName,mName,dt,it);
677 MEDFileUMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
679 return MEDFileUMesh::New(fileName);
684 return MEDFileUMesh::New();
687 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
689 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
692 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
695 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
697 std::vector<const DataArrayInt *> grps;
698 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
699 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
702 void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
704 std::vector<const MEDCouplingUMesh *> ms;
705 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
706 self->setMeshes(ms,renum);
709 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
711 std::vector<const MEDCouplingUMesh *> ms;
712 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
713 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
716 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
718 std::vector<const MEDCouplingUMesh *> ms;
719 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
720 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
723 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
725 DataArrayDouble *ret=self->getCoords();
731 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
733 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
734 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
735 PyObject *ret=PyTuple_New(3);
736 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
737 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
738 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
744 class MEDFileStructuredMesh : public MEDFileMesh
748 class MEDFileCMesh : public MEDFileStructuredMesh
751 static MEDFileCMesh *New();
752 static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
753 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
754 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
759 return MEDFileCMesh::New();
762 MEDFileCMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
764 return MEDFileCMesh::New(fileName);
767 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
769 return MEDFileCMesh::New(fileName,mName,dt,it);
772 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
774 const MEDCouplingCMesh *tmp=self->getMesh();
777 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
782 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
785 static MEDFileCurveLinearMesh *New();
786 static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
787 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
788 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
791 MEDFileCurveLinearMesh()
793 return MEDFileCurveLinearMesh::New();
796 MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
798 return MEDFileCurveLinearMesh::New(fileName);
801 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
803 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
806 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
808 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
811 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
816 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
819 static MEDFileMeshMultiTS *New();
820 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
821 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
822 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
823 const char *getName() const throw(INTERP_KERNEL::Exception);
824 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
825 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
830 return MEDFileMeshMultiTS::New();
833 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
835 return MEDFileMeshMultiTS::New(fileName);
838 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
840 return MEDFileMeshMultiTS::New(fileName,mName);
843 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
845 MEDFileMesh *ret=self->getOneTimeStep();
853 class MEDFileMeshesIterator
858 PyObject *next() throw(INTERP_KERNEL::Exception)
860 MEDFileMesh *ret=self->nextt();
864 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
868 PyErr_SetString(PyExc_StopIteration,"No more data.");
875 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
878 static MEDFileMeshes *New();
879 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
880 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
881 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
882 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
883 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
885 void resize(int newSize) throw(INTERP_KERNEL::Exception);
886 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
887 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
888 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
893 return MEDFileMeshes::New();
896 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
898 return MEDFileMeshes::New(fileName);
901 std::string __str__() const throw(INTERP_KERNEL::Exception)
903 return self->simpleRepr();
906 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
910 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
915 else if(PyString_Check(obj))
917 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
923 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
926 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
928 self->setMeshAtPos(obj,mesh);
932 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
934 return self->iterator();
937 int __len__() const throw(INTERP_KERNEL::Exception)
939 return self->getNumberOfMeshes();
942 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
944 MEDFileMesh *ret=self->getMeshAtPos(i);
949 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
951 MEDFileMesh *ret=self->getMeshWithName(mname);
959 class MEDFileFieldLoc : public RefCountObject
962 const std::string& getName() const;
963 int getDimension() const;
964 int getNumberOfGaussPoints() const;
965 int getNumberOfPointsInCells() const;
966 const std::vector<double>& getRefCoords() const;
967 const std::vector<double>& getGaussCoords() const;
968 const std::vector<double>& getGaussWeights() const;
969 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
972 std::string __str__() const throw(INTERP_KERNEL::Exception)
979 class MEDFileFieldGlobsReal
983 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
984 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
985 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
986 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
987 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
988 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
989 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
990 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
991 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
992 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
993 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
994 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
995 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
996 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
997 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
998 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
999 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1000 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1001 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1002 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1003 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1004 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1005 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1006 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1007 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1008 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
1011 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
1013 const DataArrayInt *ret=self->getProfile(pflName);
1016 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1019 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1021 const DataArrayInt *ret=self->getProfileFromId(pflId);
1024 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1027 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1029 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1032 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1035 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1037 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1040 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1043 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1045 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1046 return convertVecPairVecStToPy(ret);
1049 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1051 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1052 return convertVecPairVecStToPy(ret);
1055 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1057 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1058 self->changePflsNames(v);
1061 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1063 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1064 self->changePflsRefsNamesGen(v);
1067 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1069 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1070 self->changePflsNamesInStruct(v);
1073 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1075 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1076 self->changeLocsNames(v);
1079 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1081 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1082 self->changeLocsRefsNamesGen(v);
1085 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1087 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1088 self->changeLocsNamesInStruct(v);
1091 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1093 std::ostringstream oss;
1094 self->simpleReprGlobs(oss);
1100 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1103 static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1104 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1105 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1106 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1107 int getDimension() const throw(INTERP_KERNEL::Exception);
1108 int getIteration() const throw(INTERP_KERNEL::Exception);
1109 int getOrder() const throw(INTERP_KERNEL::Exception);
1110 std::string getName() throw(INTERP_KERNEL::Exception);
1111 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1112 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1113 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1114 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1115 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1116 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1117 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1118 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1119 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1120 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1121 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1122 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1125 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1128 double tmp0=self->getTime(tmp1,tmp2);
1129 PyObject *res = PyList_New(3);
1130 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1131 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1132 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1136 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1138 std::pair<int,int> res=self->getDtIt();
1139 PyObject *elt=PyTuple_New(2);
1140 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1141 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1145 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1147 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1150 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1152 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1155 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1157 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1158 return self->changeMeshNames(modifTab);
1161 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1163 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1164 PyObject *ret2=PyList_New(ret.size());
1165 for(int i=0;i<(int)ret.size();i++)
1166 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1170 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1172 std::vector<int> ret1;
1173 int ret0=self->getNonEmptyLevels(mname,ret1);
1174 PyObject *elt=PyTuple_New(2);
1175 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1176 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1180 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1182 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1183 std::vector< std::vector<TypeOfField> > typesF;
1184 std::vector< std::vector<std::string> > pfls;
1185 std::vector< std::vector<std::string> > locs;
1186 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1188 PyObject *ret2=PyList_New(sz);
1189 for(int i=0;i<sz;i++)
1191 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1192 const std::vector<TypeOfField>& typesFI=typesF[i];
1193 const std::vector<std::string>& pflsI=pfls[i];
1194 const std::vector<std::string>& locsI=locs[i];
1195 PyObject *elt=PyTuple_New(2);
1196 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1197 int sz2=ret[i].size();
1198 PyObject *elt2=PyList_New(sz2);
1199 for(int j=0;j<sz2;j++)
1201 PyObject *elt3=PyTuple_New(4);
1202 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1203 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));
1204 PyTuple_SetItem(elt3,1,elt4);
1205 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1206 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1207 PyList_SetItem(elt2,j,elt3);
1209 PyTuple_SetItem(elt,1,elt2);
1210 PyList_SetItem(ret2,i,elt);
1215 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1217 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1218 std::size_t sz=ret.size();
1219 PyObject *retPy=PyList_New(sz);
1220 for(std::size_t i=0;i<sz;i++)
1221 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1227 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1230 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1231 static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1232 static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1233 static MEDFileField1TS *New();
1234 MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1235 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1236 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1237 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1238 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1239 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1241 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1242 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1243 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1244 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1247 MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1249 return MEDFileField1TS::New(fileName);
1252 MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1254 return MEDFileField1TS::New(fileName,fieldName);
1257 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1259 return MEDFileField1TS::New(fileName,fieldName,iteration,order);
1264 return MEDFileField1TS::New();
1267 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1269 const DataArrayDouble *arr=0;
1271 arr=field->getArray();
1272 self->copyTinyInfoFrom(field,arr);
1275 std::string __str__() const throw(INTERP_KERNEL::Exception)
1277 return self->simpleRepr();
1280 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1282 DataArrayInt *ret1=0;
1283 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1284 PyObject *ret=PyTuple_New(2);
1285 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1286 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1290 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1292 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1293 std::vector< std::vector<TypeOfField> > typesF;
1294 std::vector< std::vector<std::string> > pfls;
1295 std::vector< std::vector<std::string> > locs;
1296 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1298 PyObject *ret2=PyList_New(sz);
1299 for(int i=0;i<sz;i++)
1301 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1302 const std::vector<TypeOfField>& typesFI=typesF[i];
1303 const std::vector<std::string>& pflsI=pfls[i];
1304 const std::vector<std::string>& locsI=locs[i];
1305 PyObject *elt=PyTuple_New(2);
1306 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1307 int sz2=ret[i].size();
1308 PyObject *elt2=PyList_New(sz2);
1309 for(int j=0;j<sz2;j++)
1311 PyObject *elt3=PyTuple_New(4);
1312 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1313 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1314 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1315 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1316 PyList_SetItem(elt2,j,elt3);
1318 PyTuple_SetItem(elt,1,elt2);
1319 PyList_SetItem(ret2,i,elt);
1324 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1326 DataArrayDouble *ret=self->getUndergroundDataArray();
1332 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1334 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1335 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1338 PyObject *ret=PyTuple_New(2);
1339 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1340 std::size_t sz=elt1Cpp.size();
1341 PyObject *elt=PyList_New(sz);
1342 for(std::size_t i=0;i<sz;i++)
1344 PyObject *elt1=PyTuple_New(2);
1345 PyObject *elt2=PyTuple_New(2);
1346 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1347 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1348 PyObject *elt3=PyTuple_New(2);
1349 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1350 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1351 PyTuple_SetItem(elt1,0,elt2);
1352 PyTuple_SetItem(elt1,1,elt3);
1353 PyList_SetItem(elt,i,elt1);
1355 PyTuple_SetItem(ret,1,elt);
1361 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1364 static MEDFileIntField1TS *New();
1365 static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1366 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1367 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
1368 MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1370 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1371 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1374 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1376 return MEDFileIntField1TS::New();
1379 MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
1381 return MEDFileIntField1TS::New(fileName);
1384 MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1386 return MEDFileIntField1TS::New(fileName,fieldName);
1389 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
1391 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order);
1394 std::string __str__() const throw(INTERP_KERNEL::Exception)
1396 return self->simpleRepr();
1399 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1401 DataArrayInt *ret1=0;
1402 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1403 PyObject *ret=PyTuple_New(2);
1404 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1405 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1409 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1411 DataArrayInt *ret1=0;
1412 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1413 PyObject *ret=PyTuple_New(2);
1414 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1415 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1419 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1421 DataArrayInt *ret1=0;
1422 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1423 PyObject *ret=PyTuple_New(2);
1424 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1425 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1429 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1431 DataArrayInt *ret1=0;
1432 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1433 PyObject *ret=PyTuple_New(2);
1434 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1435 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1439 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1441 DataArrayInt *ret1=0;
1442 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1443 PyObject *ret=PyTuple_New(2);
1444 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1445 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1449 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1451 DataArrayInt *ret1=0;
1452 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1453 PyObject *ret=PyTuple_New(2);
1454 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1455 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1459 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1461 DataArrayInt *ret=self->getUndergroundDataArray();
1469 class MEDFileAnyTypeFieldMultiTSIterator
1474 PyObject *next() throw(INTERP_KERNEL::Exception)
1476 MEDFileAnyTypeField1TS *ret=self->nextt();
1478 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1481 PyErr_SetString(PyExc_StopIteration,"No more data.");
1488 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1491 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1492 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1493 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1494 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1495 std::string getName() const throw(INTERP_KERNEL::Exception);
1496 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1497 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1498 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1499 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1500 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1501 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1502 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1503 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1504 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1505 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1506 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1507 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1509 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1510 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1511 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1512 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1513 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1516 int __len__() const throw(INTERP_KERNEL::Exception)
1518 return self->getNumberOfTS();
1521 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1523 if(elt0 && PyInt_Check(elt0))
1525 int pos=PyInt_AS_LONG(elt0);
1528 else if(elt0 && PyTuple_Check(elt0))
1530 if(PyTuple_Size(elt0)==2)
1532 PyObject *o0=PyTuple_GetItem(elt0,0);
1533 PyObject *o1=PyTuple_GetItem(elt0,1);
1534 if(PyInt_Check(o0) && PyInt_Check(o1))
1536 int iter=PyInt_AS_LONG(o0);
1537 int order=PyInt_AS_LONG(o1);
1538 return self->getPosOfTimeStep(iter,order);
1541 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 !");
1544 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 !");
1546 else if(elt0 && PyFloat_Check(elt0))
1548 double val=PyFloat_AS_DOUBLE(elt0);
1549 return self->getPosGivenTime(val);
1552 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1555 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1557 std::vector< std::pair<int,int> > res=self->getIterations();
1558 PyObject *ret=PyList_New(res.size());
1560 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1562 PyObject *elt=PyTuple_New(2);
1563 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1564 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1565 PyList_SetItem(ret,rk,elt);
1570 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1572 std::vector<double> ret1;
1573 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1574 std::size_t sz=ret.size();
1575 PyObject *ret2=PyList_New(sz);
1576 for(std::size_t i=0;i<sz;i++)
1578 PyObject *elt=PyTuple_New(3);
1579 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1580 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1581 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1582 PyList_SetItem(ret2,i,elt);
1587 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1589 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1590 PyObject *ret2=PyList_New(ret.size());
1591 for(int i=0;i<(int)ret.size();i++)
1593 const std::vector<TypeOfField>& rett=ret[i];
1594 PyObject *ret3=PyList_New(rett.size());
1595 for(int j=0;j<(int)rett.size();j++)
1596 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1597 PyList_SetItem(ret2,i,ret3);
1602 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1604 std::vector<int> ret1;
1605 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1606 PyObject *elt=PyTuple_New(2);
1607 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1608 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1612 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1614 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1615 std::vector< std::vector<TypeOfField> > typesF;
1616 std::vector< std::vector<std::string> > pfls;
1617 std::vector< std::vector<std::string> > locs;
1618 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1620 PyObject *ret2=PyList_New(sz);
1621 for(int i=0;i<sz;i++)
1623 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1624 const std::vector<TypeOfField>& typesFI=typesF[i];
1625 const std::vector<std::string>& pflsI=pfls[i];
1626 const std::vector<std::string>& locsI=locs[i];
1627 PyObject *elt=PyTuple_New(2);
1628 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1629 int sz2=ret[i].size();
1630 PyObject *elt2=PyList_New(sz2);
1631 for(int j=0;j<sz2;j++)
1633 PyObject *elt3=PyTuple_New(4);
1634 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1635 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));
1636 PyTuple_SetItem(elt3,1,elt4);
1637 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1638 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1639 PyList_SetItem(elt2,j,elt3);
1641 PyTuple_SetItem(elt,1,elt2);
1642 PyList_SetItem(ret2,i,elt);
1647 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1649 if(PyList_Check(elts))
1651 int sz=PyList_Size(elts);
1652 std::vector<int> ret(sz);
1653 for(int i=0;i<sz;i++)
1655 PyObject *elt=PyList_GetItem(elts,i);
1656 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1662 std::vector<int> ret(1);
1663 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1668 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1670 if(PySlice_Check(elts))
1672 Py_ssize_t strt=2,stp=2,step=2;
1673 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1674 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1676 self->eraseTimeStepIds2(strt,stp,step);
1679 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1683 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1684 if(!idsToRemove.empty())
1685 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1689 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1693 std::vector<int> pos2;
1694 DataArrayInt *pos3=0;
1695 DataArrayIntTuple *pos4=0;
1696 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1701 self->eraseTimeStepIds(&pos1,&pos1+1);
1708 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1713 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1717 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1721 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1723 return self->iterator();
1726 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1728 if(elt0 && PyList_Check(elt0))
1730 int sz=PyList_Size(elt0);
1731 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1732 int *pt=da->getPointer();
1733 for(int i=0;i<sz;i++,pt++)
1735 PyObject *elt1=PyList_GetItem(elt0,i);
1736 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1738 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1740 else if(elt0 && PySlice_Check(elt0))
1742 Py_ssize_t strt=2,stp=2,step=2;
1743 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1744 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1745 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1747 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1750 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1753 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1755 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1756 return self->changeMeshNames(modifTab);
1759 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1761 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1762 std::size_t sz=ret.size();
1763 PyObject *retPy=PyList_New(sz);
1764 for(std::size_t i=0;i<sz;i++)
1765 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1769 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1771 std::vector<MEDFileAnyTypeField1TS *> tmp;
1772 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1773 self->pushBackTimeSteps(tmp);
1778 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1781 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1782 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1783 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1785 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1786 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1787 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1788 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1789 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1791 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1792 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1795 MEDFileFieldMultiTS()
1797 return MEDFileFieldMultiTS::New();
1800 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1802 return MEDFileFieldMultiTS::New(fileName);
1805 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1807 return MEDFileFieldMultiTS::New(fileName,fieldName);
1810 std::string __str__() const throw(INTERP_KERNEL::Exception)
1812 return self->simpleRepr();
1815 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1817 DataArrayInt *ret1=0;
1818 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1819 PyObject *ret=PyTuple_New(2);
1820 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1821 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1825 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1827 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1828 std::vector< std::vector<TypeOfField> > typesF;
1829 std::vector< std::vector<std::string> > pfls;
1830 std::vector< std::vector<std::string> > locs;
1831 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1833 PyObject *ret2=PyList_New(sz);
1834 for(int i=0;i<sz;i++)
1836 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1837 const std::vector<TypeOfField>& typesFI=typesF[i];
1838 const std::vector<std::string>& pflsI=pfls[i];
1839 const std::vector<std::string>& locsI=locs[i];
1840 PyObject *elt=PyTuple_New(2);
1841 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1842 int sz2=ret[i].size();
1843 PyObject *elt2=PyList_New(sz2);
1844 for(int j=0;j<sz2;j++)
1846 PyObject *elt3=PyTuple_New(4);
1847 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1848 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1849 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1850 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1851 PyList_SetItem(elt2,j,elt3);
1853 PyTuple_SetItem(elt,1,elt2);
1854 PyList_SetItem(ret2,i,elt);
1858 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1860 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1866 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1868 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1869 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1872 PyObject *ret=PyTuple_New(2);
1873 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1874 std::size_t sz=elt1Cpp.size();
1875 PyObject *elt=PyList_New(sz);
1876 for(std::size_t i=0;i<sz;i++)
1878 PyObject *elt1=PyTuple_New(2);
1879 PyObject *elt2=PyTuple_New(2);
1880 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
1881 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1882 PyObject *elt3=PyTuple_New(2);
1883 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1884 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1885 PyTuple_SetItem(elt1,0,elt2);
1886 PyTuple_SetItem(elt1,1,elt3);
1887 PyList_SetItem(elt,i,elt1);
1889 PyTuple_SetItem(ret,1,elt);
1895 class MEDFileFieldsIterator
1900 PyObject *next() throw(INTERP_KERNEL::Exception)
1902 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
1904 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
1907 PyErr_SetString(PyExc_StopIteration,"No more data.");
1914 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1917 static MEDFileIntFieldMultiTS *New();
1918 static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1919 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
1921 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1922 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1925 MEDFileIntFieldMultiTS()
1927 return MEDFileIntFieldMultiTS::New();
1930 MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
1932 return MEDFileIntFieldMultiTS::New(fileName);
1935 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
1937 return MEDFileIntFieldMultiTS::New(fileName,fieldName);
1940 std::string __str__() const throw(INTERP_KERNEL::Exception)
1942 return self->simpleRepr();
1945 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1947 DataArrayInt *ret1=0;
1948 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
1949 PyObject *ret=PyTuple_New(2);
1950 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1951 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1955 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1957 DataArrayInt *ret1=0;
1958 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
1959 PyObject *ret=PyTuple_New(2);
1960 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1961 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1965 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1967 DataArrayInt *ret1=0;
1968 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
1969 PyObject *ret=PyTuple_New(2);
1970 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1971 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1975 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1977 DataArrayInt *ret1=0;
1978 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
1979 PyObject *ret=PyTuple_New(2);
1980 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1981 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1985 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1987 DataArrayInt *ret1=0;
1988 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
1989 PyObject *ret=PyTuple_New(2);
1990 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1991 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1995 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1997 DataArrayInt *ret1=0;
1998 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1999 PyObject *ret=PyTuple_New(2);
2000 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2001 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2005 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2007 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2015 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2018 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2019 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2020 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2021 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2022 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2023 int getNumberOfFields() const;
2024 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2025 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2027 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2028 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2029 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2030 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2031 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2032 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2033 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2034 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2039 return MEDFileFields::New();
2042 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
2044 return MEDFileFields::New(fileName);
2047 std::string __str__() const throw(INTERP_KERNEL::Exception)
2049 return self->simpleRepr();
2052 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2055 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2056 PyObject *ret=PyTuple_New(2);
2057 PyObject *ret_0=PyList_New(ret0.size());
2059 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2061 PyObject *elt=PyTuple_New(2);
2062 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2063 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2064 PyList_SetItem(ret_0,rk,elt);
2066 PyTuple_SetItem(ret,0,ret_0);
2067 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2068 PyTuple_SetItem(ret,1,ret_1);
2072 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2074 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2075 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2078 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2080 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2081 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2084 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2086 if(obj && PyList_Check(obj))
2088 int sz=PyList_Size(obj);
2089 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2090 int *pt=da->getPointer();
2091 for(int i=0;i<sz;i++,pt++)
2093 PyObject *elt1=PyList_GetItem(obj,i);
2094 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2096 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2099 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2102 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2104 self->setFieldAtPos(obj,field);
2108 int __len__() const throw(INTERP_KERNEL::Exception)
2110 return self->getNumberOfFields();
2113 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2115 return self->iterator();
2118 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2120 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2121 return self->changeMeshNames(modifTab);
2124 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2126 if(elt0 && PyInt_Check(elt0))
2128 return PyInt_AS_LONG(elt0);
2130 else if(elt0 && PyString_Check(elt0))
2131 return self->getPosFromFieldName(PyString_AsString(elt0));
2133 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2136 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2138 if(PyList_Check(elts))
2140 int sz=PyList_Size(elts);
2141 std::vector<int> ret(sz);
2142 for(int i=0;i<sz;i++)
2144 PyObject *elt=PyList_GetItem(elts,i);
2145 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2151 std::vector<int> ret(1);
2152 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2157 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2159 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2160 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2161 self->pushFields(tmp);
2164 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2166 if(elts && PySlice_Check(elts))
2168 Py_ssize_t strt=2,stp=2,step=2;
2169 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2170 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2171 self->destroyFieldsAtPos2(strt,stp,step);
2173 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2177 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2178 if(!idsToRemove.empty())
2179 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2185 class MEDFileParameter1TS : public RefCountObject
2188 void setIteration(int it);
2189 int getIteration() const;
2190 void setOrder(int order);
2191 int getOrder() const;
2192 void setTimeValue(double time);
2193 void setTime(int dt, int it, double time);
2194 double getTime(int& dt, int& it);
2195 double getTimeValue() const;
2198 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2201 void setValue(double val) throw(INTERP_KERNEL::Exception);
2202 double getValue() const throw(INTERP_KERNEL::Exception);
2203 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2206 std::string __str__() const throw(INTERP_KERNEL::Exception)
2208 return self->simpleRepr();
2213 class MEDFileParameterTinyInfo : public MEDFileWritable
2216 void setDescription(const char *name);
2217 const char *getDescription() const;
2218 void setTimeUnit(const char *unit);
2219 const char *getTimeUnit() const;
2222 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2225 static MEDFileParameterDouble1TS *New();
2226 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2227 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2228 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2229 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2230 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2231 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2232 const char *getName() const throw(INTERP_KERNEL::Exception);
2233 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2236 MEDFileParameterDouble1TS()
2238 return MEDFileParameterDouble1TS::New();
2241 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2243 return MEDFileParameterDouble1TS::New(fileName);
2246 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2248 return MEDFileParameterDouble1TS::New(fileName,paramName);
2251 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2253 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2256 std::string __str__() const throw(INTERP_KERNEL::Exception)
2258 return self->simpleRepr();
2261 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2264 bool ret0=self->isEqual(other,eps,what);
2265 PyObject *res=PyList_New(2);
2266 PyObject *ret0Py=ret0?Py_True:Py_False;
2268 PyList_SetItem(res,0,ret0Py);
2269 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2275 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2278 static MEDFileParameterMultiTS *New();
2279 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2280 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2281 const char *getName() const;
2282 void setName(const char *name);
2283 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2284 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2285 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2286 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2287 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2288 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2289 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2292 MEDFileParameterMultiTS()
2294 return MEDFileParameterMultiTS::New();
2297 MEDFileParameterMultiTS(const char *fileName)
2299 return MEDFileParameterMultiTS::New(fileName);
2302 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2304 return MEDFileParameterMultiTS::New(fileName,paramName);
2307 std::string __str__() const throw(INTERP_KERNEL::Exception)
2309 return self->simpleRepr();
2312 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2315 bool ret0=self->isEqual(other,eps,what);
2316 PyObject *res=PyList_New(2);
2317 PyObject *ret0Py=ret0?Py_True:Py_False;
2319 PyList_SetItem(res,0,ret0Py);
2320 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2324 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2328 std::vector<int> pos2;
2329 DataArrayInt *pos3=0;
2330 DataArrayIntTuple *pos4=0;
2331 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2336 self->eraseTimeStepIds(&pos1,&pos1+1);
2343 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2348 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2352 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2356 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2358 if(elt0 && PyInt_Check(elt0))
2360 int pos=PyInt_AS_LONG(elt0);
2363 else if(elt0 && PyTuple_Check(elt0))
2365 if(PyTuple_Size(elt0)==2)
2367 PyObject *o0=PyTuple_GetItem(elt0,0);
2368 PyObject *o1=PyTuple_GetItem(elt0,1);
2369 if(PyInt_Check(o0) && PyInt_Check(o1))
2371 int iter=PyInt_AS_LONG(o0);
2372 int order=PyInt_AS_LONG(o1);
2373 return self->getPosOfTimeStep(iter,order);
2376 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 !");
2379 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 !");
2381 else if(elt0 && PyFloat_Check(elt0))
2383 double val=PyFloat_AS_DOUBLE(elt0);
2384 return self->getPosGivenTime(val);
2387 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2390 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2392 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2398 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2400 if(PyList_Check(elts))
2402 int sz=PyList_Size(elts);
2403 std::vector<int> ret(sz);
2404 for(int i=0;i<sz;i++)
2406 PyObject *elt=PyList_GetItem(elts,i);
2407 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2413 std::vector<int> ret(1);
2414 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2419 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2421 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2422 if(!idsToRemove.empty())
2423 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2426 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2428 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2434 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2436 std::vector< std::pair<int,int> > res=self->getIterations();
2437 PyObject *ret=PyList_New(res.size());
2439 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2441 PyObject *elt=PyTuple_New(2);
2442 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2443 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2444 PyList_SetItem(ret,rk,elt);
2449 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2451 std::vector<double> res2;
2452 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2453 PyObject *ret=PyList_New(res.size());
2455 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2457 PyObject *elt=PyTuple_New(3);
2458 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2459 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2460 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2461 PyList_SetItem(ret,rk,elt);
2468 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2471 static MEDFileParameters *New();
2472 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2473 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2474 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2475 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2476 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2477 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2478 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2479 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2480 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2481 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2482 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2487 return MEDFileParameters::New();
2490 MEDFileParameters(const char *fileName)
2492 return MEDFileParameters::New(fileName);
2495 std::string __str__() const throw(INTERP_KERNEL::Exception)
2497 return self->simpleRepr();
2500 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2502 if(PyInt_Check(obj))
2504 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2509 else if(PyString_Check(obj))
2511 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2517 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2520 int __len__() const throw(INTERP_KERNEL::Exception)
2522 return self->getNumberOfParams();
2525 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2527 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2533 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2535 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2541 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2544 bool ret0=self->isEqual(other,eps,what);
2545 PyObject *res=PyList_New(2);
2546 PyObject *ret0Py=ret0?Py_True:Py_False;
2548 PyList_SetItem(res,0,ret0Py);
2549 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2555 class MEDFileData : public RefCountObject, public MEDFileWritable
2558 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2559 static MEDFileData *New();
2560 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2561 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2562 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2563 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2564 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2565 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2566 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2568 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2569 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2571 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2574 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2576 return MEDFileData::New(fileName);
2581 return MEDFileData::New();
2584 std::string __str__() const throw(INTERP_KERNEL::Exception)
2586 return self->simpleRepr();
2589 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2591 MEDFileMeshes *ret=self->getMeshes();
2597 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2599 MEDFileParameters *ret=self->getParams();
2605 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2607 MEDFileFields *ret=self->getFields();
2613 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2615 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2616 return self->changeMeshNames(modifTab);
2621 class SauvReader : public RefCountObject
2624 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2625 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2628 class SauvWriter : public RefCountObject
2631 static SauvWriter * New();
2632 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2633 void write(const char* fileName) throw(INTERP_KERNEL::Exception);