1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
23 #define MEDCOUPLING_EXPORT
24 #define MEDLOADER_EXPORT
26 %include "MEDCouplingCommon.i"
29 #include "MEDLoader.hxx"
30 #include "MEDFileMesh.hxx"
31 #include "MEDFileField.hxx"
32 #include "MEDFileParameter.hxx"
33 #include "MEDFileData.hxx"
34 #include "MEDFileMeshReadSelector.hxx"
35 #include "MEDLoaderTypemaps.i"
36 #include "SauvReader.hxx"
37 #include "SauvWriter.hxx"
39 using namespace ParaMEDMEM;
42 #if SWIG_VERSION >= 0x010329
43 %template() std::vector<std::string>;
46 %typemap(out) ParaMEDMEM::MEDFileMesh*
48 $result=convertMEDFileMesh($1,$owner);
51 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
53 $result=convertMEDFileParameter1TS($1,$owner);
56 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
58 $result=convertMEDFileFieldMultiTS($1,$owner);
61 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
63 $result=convertMEDFileField1TS($1,$owner);
66 %newobject MEDLoader::ReadUMeshFromFamilies;
67 %newobject MEDLoader::ReadUMeshFromGroups;
68 %newobject MEDLoader::ReadUMeshFromFile;
69 %newobject MEDLoader::ReadField;
70 %newobject MEDLoader::ReadFieldCell;
71 %newobject MEDLoader::ReadFieldNode;
72 %newobject MEDLoader::ReadFieldGauss;
73 %newobject MEDLoader::ReadFieldGaussNE;
74 %newobject ParaMEDMEM::MEDFileMesh::New;
75 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
76 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
77 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
78 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
79 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
80 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
81 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
82 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
83 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
84 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
85 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
86 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
87 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
88 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
89 %newobject ParaMEDMEM::MEDFileUMesh::New;
90 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
91 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
92 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
93 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
94 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
95 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
96 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
98 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
99 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
100 %newobject ParaMEDMEM::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
101 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
102 %newobject ParaMEDMEM::MEDFileCMesh::New;
103 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
104 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
105 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
106 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
107 %newobject ParaMEDMEM::MEDFileMeshes::New;
108 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
109 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
110 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
111 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
112 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
114 %newobject ParaMEDMEM::MEDFileFields::New;
115 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
116 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
117 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
118 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
119 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
120 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
121 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
122 %newobject ParaMEDMEM::MEDFileFields::__iter__;
124 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
125 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
126 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
127 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
128 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
129 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
130 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
131 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
132 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
133 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
134 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
135 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
136 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
137 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
138 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
139 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
140 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
142 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
143 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
144 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
145 %newobject ParaMEDMEM::MEDFileField1TS::New;
146 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
147 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
148 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
149 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
150 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
151 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
152 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
153 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
154 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
156 %newobject ParaMEDMEM::MEDFileData::New;
157 %newobject ParaMEDMEM::MEDFileData::deepCpy;
158 %newobject ParaMEDMEM::MEDFileData::getMeshes;
159 %newobject ParaMEDMEM::MEDFileData::getFields;
160 %newobject ParaMEDMEM::MEDFileData::getParams;
162 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
163 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
164 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
165 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
166 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
167 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
168 %newobject ParaMEDMEM::MEDFileParameters::New;
169 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
170 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
171 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
172 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
174 %newobject ParaMEDMEM::SauvWriter::New;
175 %newobject ParaMEDMEM::SauvReader::New;
176 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
178 %feature("unref") MEDFileMesh "$this->decrRef();"
179 %feature("unref") MEDFileUMesh "$this->decrRef();"
180 %feature("unref") MEDFileCMesh "$this->decrRef();"
181 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
182 %feature("unref") MEDFileMeshes "$this->decrRef();"
183 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
184 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
185 %feature("unref") MEDFileField1TS "$this->decrRef();"
186 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
187 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
188 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
189 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
190 %feature("unref") MEDFileFields "$this->decrRef();"
191 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
192 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
193 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
194 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
195 %feature("unref") MEDFileParameters "$this->decrRef();"
196 %feature("unref") MEDFileData "$this->decrRef();"
197 %feature("unref") SauvReader "$this->decrRef();"
198 %feature("unref") SauvWriter "$this->decrRef();"
203 static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
204 static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
205 static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
206 static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
207 static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
208 static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
209 static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
210 static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
211 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
212 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
213 static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
214 static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
215 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
216 static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
217 static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
218 static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
221 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
223 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
224 PyObject *ret=PyList_New(res.size());
226 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
228 PyObject *elt=PyTuple_New(2);
229 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
230 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
231 PyList_SetItem(ret,rk,elt);
236 static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
238 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
239 PyObject *ret=PyList_New(res.size());
241 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
243 PyObject *elt=PyTuple_New(3);
244 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
245 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
246 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
247 PyList_SetItem(ret,rk,elt);
252 static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
254 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
255 PyObject *ret=PyList_New(res.size());
257 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
259 PyObject *elt=PyTuple_New(2);
260 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
261 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
262 PyList_SetItem(ret,rk,elt);
266 static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
268 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
269 PyObject *ret=PyList_New(res.size());
271 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
273 PyObject *elt=PyTuple_New(2);
274 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
275 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
276 PyList_SetItem(ret,rk,elt);
280 static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
282 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
283 PyObject *ret=PyList_New(res.size());
285 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
287 PyObject *elt=PyTuple_New(2);
288 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
289 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
290 PyList_SetItem(ret,rk,elt);
294 static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
296 int meshDim,spaceDim,numberOfNodes;
297 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
298 PyObject *ret=PyTuple_New(4);
299 PyObject *elt0=PyList_New(res.size());
301 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
303 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
305 PyObject *elt1=PyList_New(obj2.size());
306 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
308 PyObject *elt2=PyTuple_New(2);
309 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
310 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
311 PyList_SetItem(elt1,j,elt2);
313 PyList_SetItem(elt0,i,elt1);
315 PyTuple_SetItem(ret,0,elt0);
316 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
317 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
318 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
321 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
322 const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
324 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
325 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
326 return convertFieldDoubleVecToPy(res);
328 static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
330 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
331 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
332 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
334 static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
336 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
337 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
338 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
340 static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
342 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
343 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
344 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
346 static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
348 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
350 PyObject *ret=PyList_New(size);
351 for(int i=0;i<size;i++)
352 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
355 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
357 std::vector<std::string> grps;
358 converPyListToVecString(li,grps);
359 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
361 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
363 std::vector<std::string> fams;
364 converPyListToVecString(li,fams);
365 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
368 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
369 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
370 static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
371 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);
372 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
373 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
374 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
375 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
376 static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
377 static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
378 static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
379 static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
380 static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
385 class MEDFileWritable
388 void copyOptionsFrom(const MEDFileWritable& other) const;
389 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
390 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
391 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
392 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
395 class MEDFileMeshReadSelector
398 MEDFileMeshReadSelector();
399 MEDFileMeshReadSelector(unsigned int code);
400 unsigned int getCode() const;
401 void setCode(unsigned int newCode);
402 bool isCellFamilyFieldReading() const;
403 bool isNodeFamilyFieldReading() const;
404 bool isCellNameFieldReading() const;
405 bool isNodeNameFieldReading() const;
406 bool isCellNumFieldReading() const;
407 bool isNodeNumFieldReading() const;
408 void setCellFamilyFieldReading(bool b);
409 void setNodeFamilyFieldReading(bool b);
410 void setCellNameFieldReading(bool b);
411 void setNodeNameFieldReading(bool b);
412 void setCellNumFieldReading(bool b);
413 void setNodeNumFieldReading(bool b);
416 std::string __str__() const throw(INTERP_KERNEL::Exception)
418 std::ostringstream oss;
423 std::string __repr__() const throw(INTERP_KERNEL::Exception)
425 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
431 class MEDFileMesh : public RefCountObject, public MEDFileWritable
434 static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
435 static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
436 virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
437 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
438 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
439 virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
440 void setName(const char *name);
441 std::string getName();
442 const char *getUnivName() const;
443 bool getUnivNameWrStatus() const;
444 void setUnivNameWrStatus(bool newStatus);
445 void setDescription(const char *name);
446 std::string getDescription() const;
447 void setOrder(int order);
448 int getOrder() const;
449 void setIteration(int it);
451 void setTimeValue(double time);
452 void setTime(int dt, int it, double time);
453 double getTimeValue() const;
454 void setTimeUnit(const char *unit);
455 const char *getTimeUnit() const;
456 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
457 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
458 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
459 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
460 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
461 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
462 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
463 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
465 bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
466 bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
467 bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
468 void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
469 void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
470 void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
471 void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
472 virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
473 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
474 void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
475 const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
476 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
477 std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
478 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
479 std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
480 void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
481 void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
482 std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
483 void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
484 std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
485 std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
486 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
487 std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
488 void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
489 void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
490 std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
491 std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
492 void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
493 void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
494 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
495 void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
496 void setFamilyInfo(const std::map<std::string,int>& info);
497 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
498 int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
499 int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
500 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
501 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
502 int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
503 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
504 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
505 virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
506 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
507 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
508 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
509 DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
510 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
511 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
512 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
513 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
514 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
515 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
516 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
517 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
519 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
520 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
521 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
522 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
523 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
524 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
525 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
526 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
527 virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
528 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
529 virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
530 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
533 std::string __str__() const throw(INTERP_KERNEL::Exception)
535 return self->simpleRepr();
538 PyObject *getTime() throw(INTERP_KERNEL::Exception)
541 double tmp0=self->getTime(tmp1,tmp2);
542 PyObject *res = PyList_New(3);
543 PyList_SetItem(res,0,SWIG_From_int(tmp1));
544 PyList_SetItem(res,1,SWIG_From_int(tmp2));
545 PyList_SetItem(res,2,SWIG_From_double(tmp0));
549 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
552 bool ret0=self->isEqual(other,eps,what);
553 PyObject *res=PyList_New(2);
554 PyObject *ret0Py=ret0?Py_True:Py_False;
556 PyList_SetItem(res,0,ret0Py);
557 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
561 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
564 bool ret0=self->areFamsEqual(other,what);
565 PyObject *res=PyList_New(2);
566 PyObject *ret0Py=ret0?Py_True:Py_False;
568 PyList_SetItem(res,0,ret0Py);
569 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
573 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
576 bool ret0=self->areGrpsEqual(other,what);
577 PyObject *res=PyList_New(2);
578 PyObject *ret0Py=ret0?Py_True:Py_False;
580 PyList_SetItem(res,0,ret0Py);
581 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
585 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
587 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
590 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
593 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
595 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
598 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
601 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
603 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
606 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
609 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
612 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
613 PyObject *ret=PyTuple_New(2);
614 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
615 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
619 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
621 DataArrayInt *ret3=0;
622 std::vector<int> ret1,ret2;
623 bool ret0=self->unPolyze(ret1,ret2,ret3);
624 PyObject *ret=PyTuple_New(4);
625 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
627 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
628 for(int j=0;j<(int)ret1.size()/3;j++)
630 PyObject *retLev2=PyList_New(3);
631 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
632 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
633 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
634 PyList_SetItem(retLev1_0,j,retLev2);
636 PyTuple_SetItem(ret,1,retLev1_0);
638 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
639 for(int j=0;j<(int)ret2.size()/3;j++)
641 PyObject *retLev2=PyList_New(3);
642 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
643 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
644 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
645 PyList_SetItem(retLev1_1,j,retLev2);
647 PyTuple_SetItem(ret,2,retLev1_1);
649 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
655 class MEDFileUMesh : public MEDFileMesh
658 static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
659 static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
660 static MEDFileUMesh *New();
662 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
664 std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
665 std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
666 std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
667 std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
668 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
669 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
670 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
671 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
672 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
673 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
674 DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
675 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
676 DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
677 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
678 DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
679 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
680 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
681 DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
682 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
683 DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
684 DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
685 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
686 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
687 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
688 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
689 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
690 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
692 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
693 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
694 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
695 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
696 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
697 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
698 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
699 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
700 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
703 MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
705 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
708 MEDFileUMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
710 return MEDFileUMesh::New(fileName,mrs);
715 return MEDFileUMesh::New();
718 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
720 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
723 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
726 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
728 std::vector<const DataArrayInt *> grps;
729 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
730 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
733 void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
735 std::vector<const MEDCouplingUMesh *> ms;
736 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
737 self->setMeshes(ms,renum);
740 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
742 std::vector<const MEDCouplingUMesh *> ms;
743 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
744 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
747 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
749 std::vector<const MEDCouplingUMesh *> ms;
750 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
751 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
754 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
756 DataArrayDouble *ret=self->getCoords();
762 PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
764 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
765 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
766 PyObject *ret=PyTuple_New(3);
767 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
768 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
769 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
773 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
775 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
776 std::size_t sz(tmp.size());
777 PyObject *ret=PyList_New(sz);
778 for(std::size_t i=0;i<sz;i++)
782 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
789 class MEDFileStructuredMesh : public MEDFileMesh
793 class MEDFileCMesh : public MEDFileStructuredMesh
796 static MEDFileCMesh *New();
797 static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
798 static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
799 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
804 return MEDFileCMesh::New();
807 MEDFileCMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
809 return MEDFileCMesh::New(fileName,mrs);
812 MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
814 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
817 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
819 const MEDCouplingCMesh *tmp=self->getMesh();
822 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
827 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
830 static MEDFileCurveLinearMesh *New();
831 static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
832 static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
833 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
836 MEDFileCurveLinearMesh()
838 return MEDFileCurveLinearMesh::New();
841 MEDFileCurveLinearMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
843 return MEDFileCurveLinearMesh::New(fileName,mrs);
846 MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
848 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
851 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
853 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
856 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
861 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
864 static MEDFileMeshMultiTS *New();
865 static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
866 static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
867 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
868 std::string getName() const throw(INTERP_KERNEL::Exception);
869 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
870 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
875 return MEDFileMeshMultiTS::New();
878 MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
880 return MEDFileMeshMultiTS::New(fileName);
883 MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
885 return MEDFileMeshMultiTS::New(fileName,mName);
888 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
890 MEDFileMesh *ret=self->getOneTimeStep();
898 class MEDFileMeshesIterator
903 PyObject *next() throw(INTERP_KERNEL::Exception)
905 MEDFileMesh *ret=self->nextt();
909 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
913 PyErr_SetString(PyExc_StopIteration,"No more data.");
920 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
923 static MEDFileMeshes *New();
924 static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
925 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
926 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
927 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
928 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
930 void resize(int newSize) throw(INTERP_KERNEL::Exception);
931 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
932 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
933 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
938 return MEDFileMeshes::New();
941 MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
943 return MEDFileMeshes::New(fileName);
946 std::string __str__() const throw(INTERP_KERNEL::Exception)
948 return self->simpleRepr();
951 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
955 MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
960 else if(PyString_Check(obj))
962 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
968 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
971 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
973 self->setMeshAtPos(obj,mesh);
977 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
979 return self->iterator();
982 int __len__() const throw(INTERP_KERNEL::Exception)
984 return self->getNumberOfMeshes();
987 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
989 MEDFileMesh *ret=self->getMeshAtPos(i);
994 MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
996 MEDFileMesh *ret=self->getMeshWithName(mname);
1004 class MEDFileFieldLoc : public RefCountObject
1007 std::string getName() const;
1008 int getDimension() const;
1009 int getNumberOfGaussPoints() const;
1010 int getNumberOfPointsInCells() const;
1011 const std::vector<double>& getRefCoords() const;
1012 const std::vector<double>& getGaussCoords() const;
1013 const std::vector<double>& getGaussWeights() const;
1014 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
1017 std::string __str__() const throw(INTERP_KERNEL::Exception)
1019 return self->repr();
1024 class MEDFileFieldGlobsReal
1027 void resetContent();
1028 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1029 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1030 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1031 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1032 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
1033 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
1034 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
1035 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
1036 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
1037 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
1038 bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
1039 bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
1040 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
1041 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
1042 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
1043 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
1044 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1045 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1046 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1047 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1048 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1049 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1050 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1051 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
1052 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1053 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
1056 PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
1058 const DataArrayInt *ret=self->getProfile(pflName);
1061 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1064 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1066 const DataArrayInt *ret=self->getProfileFromId(pflId);
1069 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1072 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1074 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1077 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1080 PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
1082 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1085 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1088 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1090 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1091 return convertVecPairVecStToPy(ret);
1094 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1096 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1097 return convertVecPairVecStToPy(ret);
1100 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1102 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1103 self->changePflsNames(v);
1106 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1108 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1109 self->changePflsRefsNamesGen(v);
1112 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1114 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1115 self->changePflsNamesInStruct(v);
1118 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1120 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1121 self->changeLocsNames(v);
1124 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1126 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1127 self->changeLocsRefsNamesGen(v);
1130 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1132 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1133 self->changeLocsNamesInStruct(v);
1136 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1138 std::ostringstream oss;
1139 self->simpleReprGlobs(oss);
1145 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1148 static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1149 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1150 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1151 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1152 void loadArrays() throw(INTERP_KERNEL::Exception);
1153 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1154 void releaseArrays() throw(INTERP_KERNEL::Exception);
1155 int getDimension() const throw(INTERP_KERNEL::Exception);
1156 int getIteration() const throw(INTERP_KERNEL::Exception);
1157 int getOrder() const throw(INTERP_KERNEL::Exception);
1158 std::string getName() throw(INTERP_KERNEL::Exception);
1159 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1160 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1161 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1162 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
1163 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
1164 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1165 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1166 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1167 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1168 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1169 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1170 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1171 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1172 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1175 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1178 double tmp0=self->getTime(tmp1,tmp2);
1179 PyObject *res = PyList_New(3);
1180 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1181 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1182 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1186 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1188 std::pair<int,int> res=self->getDtIt();
1189 PyObject *elt=PyTuple_New(2);
1190 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1191 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1195 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1197 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1200 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1202 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1205 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1207 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1208 return self->changeMeshNames(modifTab);
1211 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1213 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1214 PyObject *ret2=PyList_New(ret.size());
1215 for(int i=0;i<(int)ret.size();i++)
1216 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1220 PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1222 std::vector<int> ret1;
1223 int ret0=self->getNonEmptyLevels(mname,ret1);
1224 PyObject *elt=PyTuple_New(2);
1225 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1226 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1230 PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1232 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1233 std::vector< std::vector<TypeOfField> > typesF;
1234 std::vector< std::vector<std::string> > pfls;
1235 std::vector< std::vector<std::string> > locs;
1236 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1238 PyObject *ret2=PyList_New(sz);
1239 for(int i=0;i<sz;i++)
1241 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1242 const std::vector<TypeOfField>& typesFI=typesF[i];
1243 const std::vector<std::string>& pflsI=pfls[i];
1244 const std::vector<std::string>& locsI=locs[i];
1245 PyObject *elt=PyTuple_New(2);
1246 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1247 int sz2=ret[i].size();
1248 PyObject *elt2=PyList_New(sz2);
1249 for(int j=0;j<sz2;j++)
1251 PyObject *elt3=PyTuple_New(4);
1252 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1253 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));
1254 PyTuple_SetItem(elt3,1,elt4);
1255 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1256 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1257 PyList_SetItem(elt2,j,elt3);
1259 PyTuple_SetItem(elt,1,elt2);
1260 PyList_SetItem(ret2,i,elt);
1265 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1267 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1268 std::size_t sz=ret.size();
1269 PyObject *retPy=PyList_New(sz);
1270 for(std::size_t i=0;i<sz;i++)
1271 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1275 PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
1277 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
1278 std::size_t sz=ret.size();
1279 PyObject *retPy=PyList_New(sz);
1280 for(std::size_t i=0;i<sz;i++)
1281 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1287 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1290 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1291 static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1292 static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1293 static MEDFileField1TS *New();
1294 ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1295 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1296 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1297 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1298 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1299 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1301 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1302 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1303 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1304 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1307 MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1309 return MEDFileField1TS::New(fileName,loadAll);
1312 MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1314 return MEDFileField1TS::New(fileName,fieldName,loadAll);
1317 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1319 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1324 return MEDFileField1TS::New();
1327 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1329 const DataArrayDouble *arr=0;
1331 arr=field->getArray();
1332 self->copyTinyInfoFrom(field,arr);
1335 std::string __str__() const throw(INTERP_KERNEL::Exception)
1337 return self->simpleRepr();
1340 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1342 DataArrayInt *ret1=0;
1343 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1344 PyObject *ret=PyTuple_New(2);
1345 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1346 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1350 PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
1352 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1353 std::vector< std::vector<TypeOfField> > typesF;
1354 std::vector< std::vector<std::string> > pfls;
1355 std::vector< std::vector<std::string> > locs;
1356 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1358 PyObject *ret2=PyList_New(sz);
1359 for(int i=0;i<sz;i++)
1361 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1362 const std::vector<TypeOfField>& typesFI=typesF[i];
1363 const std::vector<std::string>& pflsI=pfls[i];
1364 const std::vector<std::string>& locsI=locs[i];
1365 PyObject *elt=PyTuple_New(2);
1366 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1367 int sz2=ret[i].size();
1368 PyObject *elt2=PyList_New(sz2);
1369 for(int j=0;j<sz2;j++)
1371 PyObject *elt3=PyTuple_New(4);
1372 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1373 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1374 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1375 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1376 PyList_SetItem(elt2,j,elt3);
1378 PyTuple_SetItem(elt,1,elt2);
1379 PyList_SetItem(ret2,i,elt);
1384 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1386 DataArrayDouble *ret=self->getUndergroundDataArray();
1392 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1394 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1395 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1398 PyObject *ret=PyTuple_New(2);
1399 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1400 std::size_t sz=elt1Cpp.size();
1401 PyObject *elt=PyList_New(sz);
1402 for(std::size_t i=0;i<sz;i++)
1404 PyObject *elt1=PyTuple_New(2);
1405 PyObject *elt2=PyTuple_New(2);
1406 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1407 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1408 PyObject *elt3=PyTuple_New(2);
1409 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1410 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1411 PyTuple_SetItem(elt1,0,elt2);
1412 PyTuple_SetItem(elt1,1,elt3);
1413 PyList_SetItem(elt,i,elt1);
1415 PyTuple_SetItem(ret,1,elt);
1421 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1424 static MEDFileIntField1TS *New();
1425 static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1426 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1427 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1428 ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1430 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1431 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1434 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1436 return MEDFileIntField1TS::New();
1439 MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1441 return MEDFileIntField1TS::New(fileName,loadAll);
1444 MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1446 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1449 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1451 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1454 std::string __str__() const throw(INTERP_KERNEL::Exception)
1456 return self->simpleRepr();
1459 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1461 DataArrayInt *ret1=0;
1462 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1463 PyObject *ret=PyTuple_New(2);
1464 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1465 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1469 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1471 DataArrayInt *ret1=0;
1472 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1473 PyObject *ret=PyTuple_New(2);
1474 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1475 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1479 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1481 DataArrayInt *ret1=0;
1482 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1483 PyObject *ret=PyTuple_New(2);
1484 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1485 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1489 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1491 DataArrayInt *ret1=0;
1492 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1493 PyObject *ret=PyTuple_New(2);
1494 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1495 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1499 PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1501 DataArrayInt *ret1=0;
1502 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1503 PyObject *ret=PyTuple_New(2);
1504 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1505 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1509 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1511 DataArrayInt *ret1=0;
1512 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1513 PyObject *ret=PyTuple_New(2);
1514 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1515 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1519 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1521 DataArrayInt *ret=self->getUndergroundDataArray();
1529 class MEDFileAnyTypeFieldMultiTSIterator
1534 PyObject *next() throw(INTERP_KERNEL::Exception)
1536 MEDFileAnyTypeField1TS *ret=self->nextt();
1538 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1541 PyErr_SetString(PyExc_StopIteration,"No more data.");
1548 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1551 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1552 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1553 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1554 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1555 std::string getName() const throw(INTERP_KERNEL::Exception);
1556 void setName(const char *name) throw(INTERP_KERNEL::Exception);
1557 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1558 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
1559 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1560 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
1561 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1562 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1563 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1564 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1565 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1566 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1567 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1568 void loadArrays() throw(INTERP_KERNEL::Exception);
1569 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1570 void releaseArrays() throw(INTERP_KERNEL::Exception);
1572 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1573 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1574 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1575 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1576 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1579 int __len__() const throw(INTERP_KERNEL::Exception)
1581 return self->getNumberOfTS();
1584 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1586 if(elt0 && PyInt_Check(elt0))
1588 int pos=PyInt_AS_LONG(elt0);
1591 else if(elt0 && PyTuple_Check(elt0))
1593 if(PyTuple_Size(elt0)==2)
1595 PyObject *o0=PyTuple_GetItem(elt0,0);
1596 PyObject *o1=PyTuple_GetItem(elt0,1);
1597 if(PyInt_Check(o0) && PyInt_Check(o1))
1599 int iter=PyInt_AS_LONG(o0);
1600 int order=PyInt_AS_LONG(o1);
1601 return self->getPosOfTimeStep(iter,order);
1604 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 !");
1607 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 !");
1609 else if(elt0 && PyFloat_Check(elt0))
1611 double val=PyFloat_AS_DOUBLE(elt0);
1612 return self->getPosGivenTime(val);
1615 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1618 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1620 std::vector< std::pair<int,int> > res=self->getIterations();
1621 PyObject *ret=PyList_New(res.size());
1623 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1625 PyObject *elt=PyTuple_New(2);
1626 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1627 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1628 PyList_SetItem(ret,rk,elt);
1633 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1635 std::vector<double> ret1;
1636 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1637 std::size_t sz=ret.size();
1638 PyObject *ret2=PyList_New(sz);
1639 for(std::size_t i=0;i<sz;i++)
1641 PyObject *elt=PyTuple_New(3);
1642 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1643 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1644 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1645 PyList_SetItem(ret2,i,elt);
1650 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1652 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1653 PyObject *ret2=PyList_New(ret.size());
1654 for(int i=0;i<(int)ret.size();i++)
1656 const std::vector<TypeOfField>& rett=ret[i];
1657 PyObject *ret3=PyList_New(rett.size());
1658 for(int j=0;j<(int)rett.size();j++)
1659 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1660 PyList_SetItem(ret2,i,ret3);
1665 PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1667 std::vector<int> ret1;
1668 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1669 PyObject *elt=PyTuple_New(2);
1670 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1671 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1675 PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1677 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1678 std::vector< std::vector<TypeOfField> > typesF;
1679 std::vector< std::vector<std::string> > pfls;
1680 std::vector< std::vector<std::string> > locs;
1681 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1683 PyObject *ret2=PyList_New(sz);
1684 for(int i=0;i<sz;i++)
1686 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1687 const std::vector<TypeOfField>& typesFI=typesF[i];
1688 const std::vector<std::string>& pflsI=pfls[i];
1689 const std::vector<std::string>& locsI=locs[i];
1690 PyObject *elt=PyTuple_New(2);
1691 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1692 int sz2=ret[i].size();
1693 PyObject *elt2=PyList_New(sz2);
1694 for(int j=0;j<sz2;j++)
1696 PyObject *elt3=PyTuple_New(4);
1697 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1698 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));
1699 PyTuple_SetItem(elt3,1,elt4);
1700 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1701 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1702 PyList_SetItem(elt2,j,elt3);
1704 PyTuple_SetItem(elt,1,elt2);
1705 PyList_SetItem(ret2,i,elt);
1710 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1712 if(PyList_Check(elts))
1714 int sz=PyList_Size(elts);
1715 std::vector<int> ret(sz);
1716 for(int i=0;i<sz;i++)
1718 PyObject *elt=PyList_GetItem(elts,i);
1719 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1725 std::vector<int> ret(1);
1726 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1731 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1733 if(PySlice_Check(elts))
1735 Py_ssize_t strt=2,stp=2,step=2;
1736 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1737 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1739 self->eraseTimeStepIds2(strt,stp,step);
1742 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1746 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1747 if(!idsToRemove.empty())
1748 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1752 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1756 std::vector<int> pos2;
1757 DataArrayInt *pos3=0;
1758 DataArrayIntTuple *pos4=0;
1759 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1764 self->eraseTimeStepIds(&pos1,&pos1+1);
1771 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
1776 self->eraseTimeStepIds(pos3->begin(),pos3->end());
1780 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
1784 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
1786 return self->iterator();
1789 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1791 if(elt0 && PyList_Check(elt0))
1793 int sz=PyList_Size(elt0);
1794 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
1795 int *pt=da->getPointer();
1796 for(int i=0;i<sz;i++,pt++)
1798 PyObject *elt1=PyList_GetItem(elt0,i);
1799 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
1801 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
1803 else if(elt0 && PySlice_Check(elt0))
1805 Py_ssize_t strt=2,stp=2,step=2;
1806 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
1807 if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
1808 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
1810 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
1813 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
1816 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1818 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1819 return self->changeMeshNames(modifTab);
1822 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1824 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
1825 std::size_t sz=ret.size();
1826 PyObject *retPy=PyList_New(sz);
1827 for(std::size_t i=0;i<sz;i++)
1828 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1832 PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
1834 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
1835 std::size_t sz=ret.size();
1836 PyObject *retPy=PyList_New(sz);
1837 for(std::size_t i=0;i<sz;i++)
1838 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1842 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
1844 std::vector<MEDFileAnyTypeField1TS *> tmp;
1845 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
1846 self->pushBackTimeSteps(tmp);
1849 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception)
1851 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
1852 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
1853 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
1854 std::size_t sz=ret.size();
1855 PyObject *retPy=PyList_New(sz);
1856 for(std::size_t i=0;i<sz;i++)
1858 std::size_t sz2=ret[i].size();
1859 PyObject *ret1Py=PyList_New(sz2);
1860 for(std::size_t j=0;j<sz2;j++)
1862 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
1865 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
1867 PyList_SetItem(retPy,i,ret1Py);
1872 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
1874 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
1875 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
1876 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh);
1877 std::size_t sz=ret.size();
1878 PyObject *retPy=PyList_New(sz);
1879 for(std::size_t i=0;i<sz;i++)
1881 std::size_t sz2=ret[i].size();
1882 PyObject *ret1Py=PyList_New(sz2);
1883 for(std::size_t j=0;j<sz2;j++)
1885 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
1888 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
1890 PyList_SetItem(retPy,i,ret1Py);
1897 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
1900 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
1901 static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1902 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1904 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1905 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1906 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1907 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1908 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1910 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1911 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1912 ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1915 MEDFileFieldMultiTS()
1917 return MEDFileFieldMultiTS::New();
1920 MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1922 return MEDFileFieldMultiTS::New(fileName,loadAll);
1925 MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1927 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
1930 std::string __str__() const throw(INTERP_KERNEL::Exception)
1932 return self->simpleRepr();
1935 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1937 DataArrayInt *ret1=0;
1938 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
1939 PyObject *ret=PyTuple_New(2);
1940 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1941 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1945 PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
1947 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1948 std::vector< std::vector<TypeOfField> > typesF;
1949 std::vector< std::vector<std::string> > pfls;
1950 std::vector< std::vector<std::string> > locs;
1951 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
1953 PyObject *ret2=PyList_New(sz);
1954 for(int i=0;i<sz;i++)
1956 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1957 const std::vector<TypeOfField>& typesFI=typesF[i];
1958 const std::vector<std::string>& pflsI=pfls[i];
1959 const std::vector<std::string>& locsI=locs[i];
1960 PyObject *elt=PyTuple_New(2);
1961 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1962 int sz2=ret[i].size();
1963 PyObject *elt2=PyList_New(sz2);
1964 for(int j=0;j<sz2;j++)
1966 PyObject *elt3=PyTuple_New(4);
1967 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1968 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1969 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1970 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1971 PyList_SetItem(elt2,j,elt3);
1973 PyTuple_SetItem(elt,1,elt2);
1974 PyList_SetItem(ret2,i,elt);
1978 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1980 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
1986 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
1988 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1989 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
1992 PyObject *ret=PyTuple_New(2);
1993 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1994 std::size_t sz=elt1Cpp.size();
1995 PyObject *elt=PyList_New(sz);
1996 for(std::size_t i=0;i<sz;i++)
1998 PyObject *elt1=PyTuple_New(2);
1999 PyObject *elt2=PyTuple_New(2);
2000 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
2001 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
2002 PyObject *elt3=PyTuple_New(2);
2003 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
2004 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
2005 PyTuple_SetItem(elt1,0,elt2);
2006 PyTuple_SetItem(elt1,1,elt3);
2007 PyList_SetItem(elt,i,elt1);
2009 PyTuple_SetItem(ret,1,elt);
2015 class MEDFileFieldsIterator
2020 PyObject *next() throw(INTERP_KERNEL::Exception)
2022 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
2024 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
2027 PyErr_SetString(PyExc_StopIteration,"No more data.");
2034 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2037 static MEDFileIntFieldMultiTS *New();
2038 static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2039 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2041 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
2042 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
2043 ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
2046 MEDFileIntFieldMultiTS()
2048 return MEDFileIntFieldMultiTS::New();
2051 MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2053 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
2056 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2058 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
2061 std::string __str__() const throw(INTERP_KERNEL::Exception)
2063 return self->simpleRepr();
2066 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2068 DataArrayInt *ret1=0;
2069 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
2070 PyObject *ret=PyTuple_New(2);
2071 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2072 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2076 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2078 DataArrayInt *ret1=0;
2079 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
2080 PyObject *ret=PyTuple_New(2);
2081 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2082 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2086 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2088 DataArrayInt *ret1=0;
2089 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
2090 PyObject *ret=PyTuple_New(2);
2091 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2092 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2096 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2098 DataArrayInt *ret1=0;
2099 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
2100 PyObject *ret=PyTuple_New(2);
2101 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2102 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2106 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2108 DataArrayInt *ret1=0;
2109 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
2110 PyObject *ret=PyTuple_New(2);
2111 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2112 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2116 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2118 DataArrayInt *ret1=0;
2119 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2120 PyObject *ret=PyTuple_New(2);
2121 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2122 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2126 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2128 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2136 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2139 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2140 static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2141 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2142 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2143 void loadArrays() throw(INTERP_KERNEL::Exception);
2144 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
2145 void releaseArrays() throw(INTERP_KERNEL::Exception);
2146 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2147 int getNumberOfFields() const;
2148 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2149 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2151 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2152 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2153 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2154 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2155 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2156 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
2157 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
2158 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2163 return MEDFileFields::New();
2166 MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2168 return MEDFileFields::New(fileName,loadAll);
2171 std::string __str__() const throw(INTERP_KERNEL::Exception)
2173 return self->simpleRepr();
2176 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2179 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2180 PyObject *ret=PyTuple_New(2);
2181 PyObject *ret_0=PyList_New(ret0.size());
2183 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2185 PyObject *elt=PyTuple_New(2);
2186 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2187 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2188 PyList_SetItem(ret_0,rk,elt);
2190 PyTuple_SetItem(ret,0,ret_0);
2191 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2192 PyTuple_SetItem(ret,1,ret_1);
2196 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2198 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2199 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2202 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2204 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2205 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2208 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2210 if(obj && PyList_Check(obj))
2212 int sz=PyList_Size(obj);
2213 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2214 int *pt=da->getPointer();
2215 for(int i=0;i<sz;i++,pt++)
2217 PyObject *elt1=PyList_GetItem(obj,i);
2218 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2220 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2223 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2226 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2228 self->setFieldAtPos(obj,field);
2232 int __len__() const throw(INTERP_KERNEL::Exception)
2234 return self->getNumberOfFields();
2237 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2239 return self->iterator();
2242 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2244 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2245 return self->changeMeshNames(modifTab);
2248 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2250 if(elt0 && PyInt_Check(elt0))
2252 return PyInt_AS_LONG(elt0);
2254 else if(elt0 && PyString_Check(elt0))
2255 return self->getPosFromFieldName(PyString_AsString(elt0));
2257 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2260 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2262 if(PyList_Check(elts))
2264 int sz=PyList_Size(elts);
2265 std::vector<int> ret(sz);
2266 for(int i=0;i<sz;i++)
2268 PyObject *elt=PyList_GetItem(elts,i);
2269 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2275 std::vector<int> ret(1);
2276 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2281 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2283 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2284 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2285 self->pushFields(tmp);
2288 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2290 if(elts && PySlice_Check(elts))
2292 Py_ssize_t strt=2,stp=2,step=2;
2293 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2294 if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
2295 self->destroyFieldsAtPos2(strt,stp,step);
2297 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
2301 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2302 if(!idsToRemove.empty())
2303 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2309 class MEDFileParameter1TS : public RefCountObject
2312 void setIteration(int it);
2313 int getIteration() const;
2314 void setOrder(int order);
2315 int getOrder() const;
2316 void setTimeValue(double time);
2317 void setTime(int dt, int it, double time);
2318 double getTime(int& dt, int& it);
2319 double getTimeValue() const;
2322 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2325 void setValue(double val) throw(INTERP_KERNEL::Exception);
2326 double getValue() const throw(INTERP_KERNEL::Exception);
2327 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2330 std::string __str__() const throw(INTERP_KERNEL::Exception)
2332 return self->simpleRepr();
2337 class MEDFileParameterTinyInfo : public MEDFileWritable
2340 void setDescription(const char *name);
2341 std::string getDescription() const;
2342 void setTimeUnit(const char *unit);
2343 std::string getTimeUnit() const;
2346 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2349 static MEDFileParameterDouble1TS *New();
2350 static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2351 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2352 static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2353 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2354 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2355 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2356 std::string getName() const throw(INTERP_KERNEL::Exception);
2357 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2360 MEDFileParameterDouble1TS()
2362 return MEDFileParameterDouble1TS::New();
2365 MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
2367 return MEDFileParameterDouble1TS::New(fileName);
2370 MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
2372 return MEDFileParameterDouble1TS::New(fileName,paramName);
2375 MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2377 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2380 std::string __str__() const throw(INTERP_KERNEL::Exception)
2382 return self->simpleRepr();
2385 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2388 bool ret0=self->isEqual(other,eps,what);
2389 PyObject *res=PyList_New(2);
2390 PyObject *ret0Py=ret0?Py_True:Py_False;
2392 PyList_SetItem(res,0,ret0Py);
2393 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2399 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2402 static MEDFileParameterMultiTS *New();
2403 static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2404 static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
2405 std::string getName() const;
2406 void setName(const char *name);
2407 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2408 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2409 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2410 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2411 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2412 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2413 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2416 MEDFileParameterMultiTS()
2418 return MEDFileParameterMultiTS::New();
2421 MEDFileParameterMultiTS(const char *fileName)
2423 return MEDFileParameterMultiTS::New(fileName);
2426 MEDFileParameterMultiTS(const char *fileName, const char *paramName)
2428 return MEDFileParameterMultiTS::New(fileName,paramName);
2431 std::string __str__() const throw(INTERP_KERNEL::Exception)
2433 return self->simpleRepr();
2436 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2439 bool ret0=self->isEqual(other,eps,what);
2440 PyObject *res=PyList_New(2);
2441 PyObject *ret0Py=ret0?Py_True:Py_False;
2443 PyList_SetItem(res,0,ret0Py);
2444 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2448 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2452 std::vector<int> pos2;
2453 DataArrayInt *pos3=0;
2454 DataArrayIntTuple *pos4=0;
2455 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2460 self->eraseTimeStepIds(&pos1,&pos1+1);
2467 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2472 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2476 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2480 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2482 if(elt0 && PyInt_Check(elt0))
2484 int pos=PyInt_AS_LONG(elt0);
2487 else if(elt0 && PyTuple_Check(elt0))
2489 if(PyTuple_Size(elt0)==2)
2491 PyObject *o0=PyTuple_GetItem(elt0,0);
2492 PyObject *o1=PyTuple_GetItem(elt0,1);
2493 if(PyInt_Check(o0) && PyInt_Check(o1))
2495 int iter=PyInt_AS_LONG(o0);
2496 int order=PyInt_AS_LONG(o1);
2497 return self->getPosOfTimeStep(iter,order);
2500 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 !");
2503 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 !");
2505 else if(elt0 && PyFloat_Check(elt0))
2507 double val=PyFloat_AS_DOUBLE(elt0);
2508 return self->getPosGivenTime(val);
2511 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2514 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2516 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2522 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2524 if(PyList_Check(elts))
2526 int sz=PyList_Size(elts);
2527 std::vector<int> ret(sz);
2528 for(int i=0;i<sz;i++)
2530 PyObject *elt=PyList_GetItem(elts,i);
2531 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2537 std::vector<int> ret(1);
2538 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2543 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2545 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2546 if(!idsToRemove.empty())
2547 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2550 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2552 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2558 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2560 std::vector< std::pair<int,int> > res=self->getIterations();
2561 PyObject *ret=PyList_New(res.size());
2563 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2565 PyObject *elt=PyTuple_New(2);
2566 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2567 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2568 PyList_SetItem(ret,rk,elt);
2573 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2575 std::vector<double> res2;
2576 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2577 PyObject *ret=PyList_New(res.size());
2579 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2581 PyObject *elt=PyTuple_New(3);
2582 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2583 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2584 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2585 PyList_SetItem(ret,rk,elt);
2592 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2595 static MEDFileParameters *New();
2596 static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2597 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2598 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2599 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2600 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2601 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2602 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2603 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2604 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2605 int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
2606 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2611 return MEDFileParameters::New();
2614 MEDFileParameters(const char *fileName)
2616 return MEDFileParameters::New(fileName);
2619 std::string __str__() const throw(INTERP_KERNEL::Exception)
2621 return self->simpleRepr();
2624 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2626 if(PyInt_Check(obj))
2628 MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
2633 else if(PyString_Check(obj))
2635 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2641 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2644 int __len__() const throw(INTERP_KERNEL::Exception)
2646 return self->getNumberOfParams();
2649 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2651 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2657 MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
2659 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2665 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2668 bool ret0=self->isEqual(other,eps,what);
2669 PyObject *res=PyList_New(2);
2670 PyObject *ret0Py=ret0?Py_True:Py_False;
2672 PyList_SetItem(res,0,ret0Py);
2673 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2679 class MEDFileData : public RefCountObject, public MEDFileWritable
2682 static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
2683 static MEDFileData *New();
2684 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2685 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2686 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2687 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2688 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2689 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2690 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2692 bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
2693 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2695 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
2698 MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
2700 return MEDFileData::New(fileName);
2705 return MEDFileData::New();
2708 std::string __str__() const throw(INTERP_KERNEL::Exception)
2710 return self->simpleRepr();
2713 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2715 MEDFileMeshes *ret=self->getMeshes();
2721 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2723 MEDFileParameters *ret=self->getParams();
2729 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2731 MEDFileFields *ret=self->getFields();
2737 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2739 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2740 return self->changeMeshNames(modifTab);
2745 class SauvReader : public RefCountObject
2748 static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
2749 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
2752 class SauvWriter : public RefCountObject
2755 static SauvWriter * New();
2756 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
2757 void write(const char* fileName) throw(INTERP_KERNEL::Exception);