1 // Copyright (C) 2007-2015 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, or (at your option) any later version.
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 "MEDFileFieldOverView.hxx"
36 #include "MEDLoaderTypemaps.i"
37 #include "SauvReader.hxx"
38 #include "SauvWriter.hxx"
40 using namespace ParaMEDMEM;
43 #if SWIG_VERSION >= 0x010329
44 %template() std::vector<std::string>;
47 %typemap(out) ParaMEDMEM::MEDFileMesh*
49 $result=convertMEDFileMesh($1,$owner);
52 %typemap(out) ParaMEDMEM::MEDFileParameter1TS*
54 $result=convertMEDFileParameter1TS($1,$owner);
57 %typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
59 $result=convertMEDFileFieldMultiTS($1,$owner);
62 %typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
64 $result=convertMEDFileField1TS($1,$owner);
67 %typemap(out) ParaMEDMEM::MEDMeshMultiLev*
69 $result=convertMEDMeshMultiLev($1,$owner);
72 %newobject MEDLoader::ReadUMeshFromFamilies;
73 %newobject MEDLoader::ReadUMeshFromGroups;
74 %newobject MEDLoader::ReadUMeshFromFile;
75 %newobject MEDLoader::ReadMeshFromFile;
76 %newobject MEDLoader::ReadField;
77 %newobject MEDLoader::ReadFieldCell;
78 %newobject MEDLoader::ReadFieldNode;
79 %newobject MEDLoader::ReadFieldGauss;
80 %newobject MEDLoader::ReadFieldGaussNE;
81 %newobject ParaMEDMEM::MEDFileMesh::New;
82 %newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
83 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
84 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
85 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
86 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
87 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
88 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
89 %newobject ParaMEDMEM::MEDFileMesh::getFamiliesArr;
90 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupArr;
91 %newobject ParaMEDMEM::MEDFileMesh::getNodeGroupsArr;
92 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
93 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
94 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
95 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
96 %newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh;
97 %newobject ParaMEDMEM::MEDFileUMesh::New;
98 %newobject ParaMEDMEM::MEDFileUMesh::LoadPartOf;
99 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
100 %newobject ParaMEDMEM::MEDFileUMesh::getPartDefAtLevel;
101 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
102 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
103 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
104 %newobject ParaMEDMEM::MEDFileUMesh::getFamilies;
105 %newobject ParaMEDMEM::MEDFileUMesh::getMeshAtLevel;
106 %newobject ParaMEDMEM::MEDFileUMesh::getLevel0Mesh;
107 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
108 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
109 %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
110 %newobject ParaMEDMEM::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh;
111 %newobject ParaMEDMEM::MEDFileUMesh::extractFamilyFieldOnGeoType;
112 %newobject ParaMEDMEM::MEDFileUMesh::extractNumberFieldOnGeoType;
113 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
114 %newobject ParaMEDMEM::MEDFileUMesh::buildExtrudedMesh;
115 %newobject ParaMEDMEM::MEDFileUMesh::__getitem__;
116 %newobject ParaMEDMEM::MEDFileCMesh::New;
117 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
118 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
119 %newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
120 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
121 %newobject ParaMEDMEM::MEDFileMeshes::New;
122 %newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
123 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
124 %newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
125 %newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
126 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
128 %newobject ParaMEDMEM::MEDFileFields::New;
129 %newobject ParaMEDMEM::MEDFileFields::LoadPartOf;
130 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
131 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
132 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
133 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
134 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
135 %newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
136 %newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
137 %newobject ParaMEDMEM::MEDFileFields::__iter__;
139 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
140 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
141 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
142 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
143 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
144 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
145 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
146 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
147 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
148 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
149 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
150 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
151 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
152 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
153 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
154 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
155 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
157 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
158 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
159 %newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
160 %newobject ParaMEDMEM::MEDFileField1TS::New;
161 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
162 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
163 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
164 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
165 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
166 %newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
167 %newobject ParaMEDMEM::MEDFileIntField1TS::New;
168 %newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
169 %newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
171 %newobject ParaMEDMEM::MEDFileData::New;
172 %newobject ParaMEDMEM::MEDFileData::deepCpy;
173 %newobject ParaMEDMEM::MEDFileData::getMeshes;
174 %newobject ParaMEDMEM::MEDFileData::getFields;
175 %newobject ParaMEDMEM::MEDFileData::getParams;
177 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
178 %newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
179 %newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
180 %newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
181 %newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
182 %newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
183 %newobject ParaMEDMEM::MEDFileParameters::New;
184 %newobject ParaMEDMEM::MEDFileParameters::deepCpy;
185 %newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
186 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
187 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
189 %newobject ParaMEDMEM::SauvWriter::New;
190 %newobject ParaMEDMEM::SauvReader::New;
191 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
193 %newobject ParaMEDMEM::MEDFileMeshStruct::New;
194 %newobject ParaMEDMEM::MEDMeshMultiLev::prepare;
195 %newobject ParaMEDMEM::MEDMeshMultiLev::buildDataArray;
196 %newobject ParaMEDMEM::MEDFileFastCellSupportComparator::New;
197 %newobject ParaMEDMEM::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
199 %feature("unref") MEDFileMesh "$this->decrRef();"
200 %feature("unref") MEDFileUMesh "$this->decrRef();"
201 %feature("unref") MEDFileCMesh "$this->decrRef();"
202 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
203 %feature("unref") MEDFileMeshes "$this->decrRef();"
204 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
205 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
206 %feature("unref") MEDFileField1TS "$this->decrRef();"
207 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
208 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
209 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
210 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
211 %feature("unref") MEDFileFields "$this->decrRef();"
212 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
213 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
214 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
215 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
216 %feature("unref") MEDFileParameters "$this->decrRef();"
217 %feature("unref") MEDFileData "$this->decrRef();"
218 %feature("unref") SauvReader "$this->decrRef();"
219 %feature("unref") SauvWriter "$this->decrRef();"
220 %feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();"
221 %feature("unref") MEDMeshMultiLev "$this->decrRef();"
222 %feature("unref") MEDUMeshMultiLev "$this->decrRef();"
223 %feature("unref") MEDCMeshMultiLev "$this->decrRef();"
224 %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();"
225 %feature("unref") MEDFileMeshStruct "$this->decrRef();"
230 static bool HasXDR();
231 static std::string MEDFileVersionStr();
232 static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
233 static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
234 static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
235 static void CheckFileForRead(const std::string& fileName) throw(INTERP_KERNEL::Exception);
236 static std::vector<std::string> GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
237 static std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception);
238 static std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
239 static std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
240 static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception);
241 static std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception);
242 static std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
243 static std::vector<std::string> GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
244 static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
245 static std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
246 static std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
247 static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
248 static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj) throw(INTERP_KERNEL::Exception);
251 static PyObject *MEDFileVersion()
253 int major,minor,release;
254 MEDLoader::MEDFileVersion(major,minor,release);
255 PyObject *ret(PyTuple_New(3));
256 PyTuple_SetItem(ret,0,SWIG_From_int(major));
257 PyTuple_SetItem(ret,1,SWIG_From_int(minor));
258 PyTuple_SetItem(ret,2,SWIG_From_int(release));
262 static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
264 std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
265 PyObject *ret=PyList_New(res.size());
267 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
269 PyObject *elt=PyTuple_New(2);
270 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
271 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
272 PyList_SetItem(ret,rk,elt);
277 static PyObject *GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
279 std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
280 PyObject *ret=PyList_New(res.size());
282 for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
284 PyObject *elt=PyTuple_New(3);
285 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
286 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
287 PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
288 PyList_SetItem(ret,rk,elt);
293 static PyObject *GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
295 std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
296 PyObject *ret=PyList_New(res.size());
298 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
300 PyObject *elt=PyTuple_New(2);
301 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
302 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
303 PyList_SetItem(ret,rk,elt);
307 static PyObject *GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
309 std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
310 PyObject *ret=PyList_New(res.size());
312 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
314 PyObject *elt=PyTuple_New(2);
315 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
316 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
317 PyList_SetItem(ret,rk,elt);
321 static PyObject *GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
323 std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
324 PyObject *ret=PyList_New(res.size());
326 for(std::vector< std::pair<std::string,std::string> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
328 PyObject *elt=PyTuple_New(2);
329 PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str()));
330 PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str()));
331 PyList_SetItem(ret,rk,elt);
335 static PyObject *GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception)
337 int meshDim,spaceDim,numberOfNodes;
338 std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
339 PyObject *ret=PyTuple_New(4);
340 PyObject *elt0=PyList_New(res.size());
342 for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
344 const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
346 PyObject *elt1=PyList_New(obj2.size());
347 for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++)
349 PyObject *elt2=PyTuple_New(2);
350 PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first));
351 PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second));
352 PyList_SetItem(elt1,j,elt2);
354 PyList_SetItem(elt0,i,elt1);
356 PyTuple_SetItem(ret,0,elt0);
357 PyTuple_SetItem(ret,1,SWIG_From_int(meshDim));
358 PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim));
359 PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
362 static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
363 const std::string& fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
365 std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
366 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
367 return convertFieldDoubleVecToPy(res);
369 static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
371 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
372 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
373 MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
375 static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
377 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
378 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
379 MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
381 static void WriteUMeshes(const std::string& fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
383 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
384 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
385 MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
387 static PyObject *GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
389 std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
391 PyObject *ret=PyList_New(size);
392 for(int i=0;i<size;i++)
393 PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
396 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
398 std::vector<std::string> grps;
399 converPyListToVecString(li,grps);
400 return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
402 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
404 std::vector<std::string> fams;
405 converPyListToVecString(li,fams);
406 return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
409 static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
410 static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
411 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
412 static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
413 static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
414 static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
415 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
416 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
417 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
418 static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
419 static void WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
420 static void WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
421 static void WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
422 static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
423 static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
424 static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
429 class MEDFileWritable
432 void copyOptionsFrom(const MEDFileWritable& other) const;
433 int getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception);
434 void setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception);
435 int getZipConnPolicy() throw(INTERP_KERNEL::Exception);
436 void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
439 class MEDFileMeshReadSelector
442 MEDFileMeshReadSelector();
443 MEDFileMeshReadSelector(unsigned int code);
444 unsigned int getCode() const;
445 void setCode(unsigned int newCode);
446 bool isCellFamilyFieldReading() const;
447 bool isNodeFamilyFieldReading() const;
448 bool isCellNameFieldReading() const;
449 bool isNodeNameFieldReading() const;
450 bool isCellNumFieldReading() const;
451 bool isNodeNumFieldReading() const;
452 void setCellFamilyFieldReading(bool b);
453 void setNodeFamilyFieldReading(bool b);
454 void setCellNameFieldReading(bool b);
455 void setNodeNameFieldReading(bool b);
456 void setCellNumFieldReading(bool b);
457 void setNodeNumFieldReading(bool b);
460 std::string __str__() const throw(INTERP_KERNEL::Exception)
462 std::ostringstream oss;
467 std::string __repr__() const throw(INTERP_KERNEL::Exception)
469 std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
475 class MEDFileMesh : public RefCountObject, public MEDFileWritable
478 static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
479 static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
480 virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
481 virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
482 virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
483 virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
484 void setName(const std::string& name);
485 std::string getName();
486 std::string getUnivName() const;
487 bool getUnivNameWrStatus() const;
488 void setUnivNameWrStatus(bool newStatus);
489 void setDescription(const std::string& name);
490 std::string getDescription() const;
491 void setOrder(int order);
492 int getOrder() const;
493 void setIteration(int it);
495 void setTimeValue(double time);
496 void setTime(int dt, int it, double time);
497 double getTimeValue() const;
498 void setTimeUnit(const std::string& unit);
499 std::string getTimeUnit() const;
500 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
501 virtual bool hasImplicitPart() const throw(INTERP_KERNEL::Exception);
502 virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
503 virtual void releaseImplicitPartIfAny() const throw(INTERP_KERNEL::Exception);
504 virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
505 virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
506 virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
507 virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception);
508 std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
509 std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
510 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
511 int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
513 bool existsGroup(const std::string& groupName) const throw(INTERP_KERNEL::Exception);
514 bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
515 bool existsFamily(const std::string& familyName) const throw(INTERP_KERNEL::Exception);
516 void setFamilyId(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
517 void setFamilyIdUnique(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
518 void addFamily(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
519 void addFamilyOnGrp(const std::string& grpName, const std::string& famName) throw(INTERP_KERNEL::Exception);
520 virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName) throw(INTERP_KERNEL::Exception);
521 virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
522 void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
523 void clearGrpMap() throw(INTERP_KERNEL::Exception);
524 void clearFamMap() throw(INTERP_KERNEL::Exception);
525 void clearFamGrpMaps() throw(INTERP_KERNEL::Exception);
526 const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
527 const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
528 std::vector<std::string> getFamiliesOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception);
529 std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
530 std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception);
531 void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
532 void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
533 std::vector<std::string> getGroupsOnFamily(const std::string& name) const throw(INTERP_KERNEL::Exception);
534 void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
535 std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
536 std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
537 void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
538 std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
539 void removeGroup(const std::string& name) throw(INTERP_KERNEL::Exception);
540 void removeFamily(const std::string& name) throw(INTERP_KERNEL::Exception);
541 std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
542 std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
543 void changeGroupName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
544 void changeFamilyName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
545 void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
546 void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
547 void setFamilyInfo(const std::map<std::string,int>& info);
548 void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
549 int getFamilyId(const std::string& name) const throw(INTERP_KERNEL::Exception);
550 int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
551 int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
552 int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
553 int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
554 int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
555 int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
556 virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
557 virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
558 virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
559 DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
560 DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
561 std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
562 std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
563 bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
564 void normalizeFamIdsTrio() throw(INTERP_KERNEL::Exception);
565 void normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception);
566 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
567 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
568 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
570 virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
571 virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
572 virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
573 virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
574 virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
575 virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
576 virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
577 virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
578 virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
579 virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
580 virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
581 virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
584 std::string __str__() const throw(INTERP_KERNEL::Exception)
586 return self->simpleRepr();
589 PyObject *getTime() throw(INTERP_KERNEL::Exception)
592 double tmp0=self->getTime(tmp1,tmp2);
593 PyObject *res = PyList_New(3);
594 PyList_SetItem(res,0,SWIG_From_int(tmp1));
595 PyList_SetItem(res,1,SWIG_From_int(tmp2));
596 PyList_SetItem(res,2,SWIG_From_double(tmp0));
600 virtual PyObject *isEqual(const MEDFileMesh *other, double eps) const throw(INTERP_KERNEL::Exception)
603 bool ret0=self->isEqual(other,eps,what);
604 PyObject *res=PyList_New(2);
605 PyObject *ret0Py=ret0?Py_True:Py_False;
607 PyList_SetItem(res,0,ret0Py);
608 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
612 void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
614 std::vector<const DataArrayInt *> grps;
615 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
616 self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
619 PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
622 bool ret0=self->areFamsEqual(other,what);
623 PyObject *res=PyList_New(2);
624 PyObject *ret0Py=ret0?Py_True:Py_False;
626 PyList_SetItem(res,0,ret0Py);
627 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
631 PyObject *areGrpsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
634 bool ret0=self->areGrpsEqual(other,what);
635 PyObject *res=PyList_New(2);
636 PyObject *ret0Py=ret0?Py_True:Py_False;
638 PyList_SetItem(res,0,ret0Py);
639 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
643 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
645 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
646 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
647 PyObject *res=PyList_New(result.size());
648 for(int i=0;iL!=result.end(); i++, iL++)
649 PyList_SetItem(res,i,PyInt_FromLong(*iL));
653 PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
655 std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
656 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
657 PyObject *res=PyList_New(result.size());
658 for(int i=0;iL!=result.end(); i++, iL++)
659 PyList_SetItem(res,i,PyInt_FromLong(*iL));
663 PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
665 const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
668 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
671 PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
673 const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
676 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
679 PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
681 const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
684 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
687 PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
689 const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
692 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
695 PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
698 std::string ret0=self->findOrCreateAndGiveFamilyWithId(id,ret1);
699 PyObject *ret=PyTuple_New(2);
700 PyTuple_SetItem(ret,0,PyString_FromString(ret0.c_str()));
701 PyTuple_SetItem(ret,1,SWIG_From_bool(ret1));
705 PyObject *unPolyze() throw(INTERP_KERNEL::Exception)
707 DataArrayInt *ret3=0;
708 std::vector<int> ret1,ret2;
709 bool ret0=self->unPolyze(ret1,ret2,ret3);
710 PyObject *ret=PyTuple_New(4);
711 PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
713 PyObject *retLev1_0=PyList_New((int)ret1.size()/3);
714 for(int j=0;j<(int)ret1.size()/3;j++)
716 PyObject *retLev2=PyList_New(3);
717 PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j]));
718 PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1]));
719 PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2]));
720 PyList_SetItem(retLev1_0,j,retLev2);
722 PyTuple_SetItem(ret,1,retLev1_0);
724 PyObject *retLev1_1=PyList_New((int)ret2.size()/3);
725 for(int j=0;j<(int)ret2.size()/3;j++)
727 PyObject *retLev2=PyList_New(3);
728 PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j]));
729 PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1]));
730 PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2]));
731 PyList_SetItem(retLev1_1,j,retLev2);
733 PyTuple_SetItem(ret,2,retLev1_1);
735 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
741 class MEDFileUMesh : public MEDFileMesh
744 static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
745 static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
746 static MEDFileUMesh *New();
748 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
749 int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
751 std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const throw(INTERP_KERNEL::Exception);
752 std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const throw(INTERP_KERNEL::Exception);
753 std::vector<int> getFamNonEmptyLevels(const std::string& fam) const throw(INTERP_KERNEL::Exception);
754 std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const throw(INTERP_KERNEL::Exception);
755 std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
756 std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
757 std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
758 std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
759 std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
760 MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
761 MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
762 MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
763 MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
764 DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
765 MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
766 MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
767 MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
768 MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
769 MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
770 void forceComputationOfParts() const throw(INTERP_KERNEL::Exception);
772 int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
773 void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
774 void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
775 void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
776 void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
777 void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
778 void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
779 void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) throw(INTERP_KERNEL::Exception);
780 void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
781 void optimizeFamilies() throw(INTERP_KERNEL::Exception);
782 DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
783 DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
784 DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
785 MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const throw(INTERP_KERNEL::Exception);
788 MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
790 return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
793 MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
795 return MEDFileUMesh::New(fileName,mrs);
800 return MEDFileUMesh::New();
804 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
806 return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDFileUMesh");
809 static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
811 std::vector<int> typesCpp1;
812 convertPyToNewIntArr3(types,typesCpp1);
813 std::size_t sz(typesCpp1.size());
814 std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
815 for(std::size_t ii=0;ii<sz;ii++)
816 typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
817 return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
820 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
821 {// put an empty dict in input to say to __new__ to call __init__...
822 PyObject *ret(PyTuple_New(1));
823 PyObject *ret0(PyDict_New());
824 PyTuple_SetItem(ret,0,ret0);
828 PyObject *__getstate__() throw(INTERP_KERNEL::Exception)
830 std::vector<double> a0;
832 std::vector<std::string> a2;
833 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
834 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
835 self->serialize(a0,a1,a2,a3,a4);
836 PyObject *ret(PyTuple_New(5));
837 PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
838 PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
840 PyObject *ret2(PyList_New(sz));
841 for(int i=0;i<sz;i++)
842 PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
843 PyTuple_SetItem(ret,2,ret2);
845 PyObject *ret3(PyList_New(sz));
846 for(int i=0;i<sz;i++)
848 DataArrayInt *elt(a3[i]);
851 PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
853 PyTuple_SetItem(ret,3,ret3);
854 DataArrayDouble *ret4(a4);
857 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
861 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
863 static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
864 if(!PyTuple_Check(inp))
865 throw INTERP_KERNEL::Exception(MSG);
866 int sz(PyTuple_Size(inp));
868 throw INTERP_KERNEL::Exception(MSG);
869 std::vector<double> a0;
871 std::vector<std::string> a2;
872 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
873 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
875 PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
877 fillArrayWithPyListDbl3(a0py,tmp,a0);
878 convertPyToNewIntArr3(a1py,a1);
879 fillStringVector(a2py,a2);
881 PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
883 int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0));
884 if(!SWIG_IsOK(status))
885 throw INTERP_KERNEL::Exception(MSG);
886 a4=reinterpret_cast<DataArrayDouble *>(argp);
887 if((DataArrayDouble *)a4)
890 std::vector< DataArrayInt * > a3Tmp;
891 convertFromPyObjVectorOfObj<ParaMEDMEM::DataArrayInt *>(b0py,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",a3Tmp);
892 std::size_t sz(a3Tmp.size());
894 for(std::size_t i=0;i<sz;i++)
900 self->unserialize(a0,a1,a2,a3,a4);
904 MEDCouplingUMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
906 return self->getMeshAtLevel(meshDimRelToMaxExt,false);
909 void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh) throw(INTERP_KERNEL::Exception)
912 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
913 MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
916 self->setMeshAtLevel(meshDimRelToMax,m0,false);
919 MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
922 self->setMeshAtLevel(meshDimRelToMax,m1);
925 throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
928 void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
930 std::vector<const MEDCouplingUMesh *> ms;
931 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
932 self->setMeshes(ms,renum);
935 void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
937 std::vector<const MEDCouplingUMesh *> ms;
938 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
939 self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
942 void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
944 std::vector<const MEDCouplingUMesh *> ms;
945 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
946 self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
949 DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
951 DataArrayDouble *ret=self->getCoords();
957 PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const throw(INTERP_KERNEL::Exception)
959 const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
962 return const_cast<PartDefinition *>(ret);
965 PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception)
967 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
968 self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
969 PyObject *ret=PyTuple_New(3);
970 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
971 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
972 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
976 MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception)
978 MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
984 PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
986 std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
987 std::size_t sz(tmp.size());
988 PyObject *ret=PyList_New(sz);
989 for(std::size_t i=0;i<sz;i++)
993 PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
1000 class MEDFileStructuredMesh : public MEDFileMesh
1005 MEDCoupling1SGTUMesh *getImplicitFaceMesh() const throw(INTERP_KERNEL::Exception)
1007 MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
1015 class MEDFileCMesh : public MEDFileStructuredMesh
1018 static MEDFileCMesh *New();
1019 static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1020 static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1021 void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
1022 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
1027 return MEDFileCMesh::New();
1030 MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1032 return MEDFileCMesh::New(fileName,mrs);
1035 MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1037 return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
1040 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
1042 const MEDCouplingCMesh *tmp=self->getMesh();
1045 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
1050 class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
1053 static MEDFileCurveLinearMesh *New();
1054 static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1055 static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
1056 void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
1059 MEDFileCurveLinearMesh()
1061 return MEDFileCurveLinearMesh::New();
1064 MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1066 return MEDFileCurveLinearMesh::New(fileName,mrs);
1069 MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
1071 return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
1074 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
1076 const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
1079 return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
1084 class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
1087 static MEDFileMeshMultiTS *New();
1088 static MEDFileMeshMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
1089 static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception);
1090 MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1091 std::string getName() const throw(INTERP_KERNEL::Exception);
1092 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1093 void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
1096 MEDFileMeshMultiTS()
1098 return MEDFileMeshMultiTS::New();
1101 MEDFileMeshMultiTS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
1103 return MEDFileMeshMultiTS::New(fileName);
1106 MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception)
1108 return MEDFileMeshMultiTS::New(fileName,mName);
1111 MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception)
1113 MEDFileMesh *ret=self->getOneTimeStep();
1121 class MEDFileMeshesIterator
1126 PyObject *next() throw(INTERP_KERNEL::Exception)
1128 MEDFileMesh *ret=self->nextt();
1132 return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
1136 PyErr_SetString(PyExc_StopIteration,"No more data.");
1143 class MEDFileMeshes : public RefCountObject, public MEDFileWritable
1146 static MEDFileMeshes *New();
1147 static MEDFileMeshes *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
1148 MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
1149 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1150 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
1151 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1153 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1154 void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
1155 void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
1156 void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception);
1161 return MEDFileMeshes::New();
1164 MEDFileMeshes(const std::string& fileName) throw(INTERP_KERNEL::Exception)
1166 return MEDFileMeshes::New(fileName);
1169 std::string __str__() const throw(INTERP_KERNEL::Exception)
1171 return self->simpleRepr();
1174 MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1176 if(PyInt_Check(obj))
1178 MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
1183 else if(PyString_Check(obj))
1185 MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
1191 throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
1194 MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
1196 self->setMeshAtPos(obj,mesh);
1200 MEDFileMeshesIterator *__iter__() throw(INTERP_KERNEL::Exception)
1202 return self->iterator();
1205 int __len__() const throw(INTERP_KERNEL::Exception)
1207 return self->getNumberOfMeshes();
1210 MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
1212 MEDFileMesh *ret=self->getMeshAtPos(i);
1217 MEDFileMesh *getMeshWithName(const std::string& mname) const throw(INTERP_KERNEL::Exception)
1219 MEDFileMesh *ret=self->getMeshWithName(mname);
1227 class MEDFileFieldLoc : public RefCountObject
1230 std::string getName() const;
1231 int getDimension() const;
1232 int getNumberOfGaussPoints() const;
1233 int getNumberOfPointsInCells() const;
1234 const std::vector<double>& getRefCoords() const;
1235 const std::vector<double>& getGaussCoords() const;
1236 const std::vector<double>& getGaussWeights() const;
1237 bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
1240 std::string __str__() const throw(INTERP_KERNEL::Exception)
1242 return self->repr();
1247 class MEDFileFieldGlobsReal
1250 void resetContent();
1251 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1252 void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1253 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1254 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
1255 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
1256 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
1257 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
1258 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
1259 std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
1260 std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
1261 bool existsPfl(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
1262 bool existsLoc(const std::string& locName) const throw(INTERP_KERNEL::Exception);
1263 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
1264 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
1265 std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
1266 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const throw(INTERP_KERNEL::Exception);
1267 virtual std::vector<std::string> getPflsReallyUsed() const throw(INTERP_KERNEL::Exception);
1268 virtual std::vector<std::string> getLocsReallyUsed() const throw(INTERP_KERNEL::Exception);
1269 virtual std::vector<std::string> getPflsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1270 virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
1271 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
1272 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
1273 void changePflName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
1274 void changeLocName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
1275 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
1276 int getLocalizationId(const std::string& loc) const throw(INTERP_KERNEL::Exception);
1279 PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
1281 const DataArrayInt *ret=self->getProfile(pflName);
1284 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1287 PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
1289 const DataArrayInt *ret=self->getProfileFromId(pflId);
1292 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1295 PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
1297 const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
1300 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1303 PyObject *getLocalization(const std::string& locName) const throw(INTERP_KERNEL::Exception)
1305 const MEDFileFieldLoc *loc=&self->getLocalization(locName);
1308 return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
1311 PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
1313 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
1314 return convertVecPairVecStToPy(ret);
1317 PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
1319 std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
1320 return convertVecPairVecStToPy(ret);
1323 void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1325 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1326 self->changePflsNames(v);
1329 void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1331 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1332 self->changePflsRefsNamesGen(v);
1335 void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1337 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1338 self->changePflsNamesInStruct(v);
1341 void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1343 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1344 self->changeLocsNames(v);
1347 void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
1349 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1350 self->changeLocsRefsNamesGen(v);
1353 void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
1355 std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
1356 self->changeLocsNamesInStruct(v);
1359 std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
1361 std::ostringstream oss;
1362 self->simpleReprGlobs(oss);
1368 class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1371 static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1372 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1373 static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1374 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1375 void loadArrays() throw(INTERP_KERNEL::Exception);
1376 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1377 void unloadArrays() throw(INTERP_KERNEL::Exception);
1378 void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
1379 int getDimension() const throw(INTERP_KERNEL::Exception);
1380 int getIteration() const throw(INTERP_KERNEL::Exception);
1381 int getOrder() const throw(INTERP_KERNEL::Exception);
1382 std::string getName() throw(INTERP_KERNEL::Exception);
1383 void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
1384 std::string getMeshName() throw(INTERP_KERNEL::Exception);
1385 void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
1386 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
1387 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
1388 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1389 bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1390 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
1391 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1392 bool presenceOfMultiDiscPerGeoType() const throw(INTERP_KERNEL::Exception);
1393 void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
1394 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1395 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
1396 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1397 void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception);
1400 PyObject *getTime() throw(INTERP_KERNEL::Exception)
1403 double tmp0=self->getTime(tmp1,tmp2);
1404 PyObject *res = PyList_New(3);
1405 PyList_SetItem(res,0,SWIG_From_int(tmp1));
1406 PyList_SetItem(res,1,SWIG_From_int(tmp2));
1407 PyList_SetItem(res,2,SWIG_From_double(tmp0));
1411 PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
1413 std::pair<int,int> res=self->getDtIt();
1414 PyObject *elt=PyTuple_New(2);
1415 PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
1416 PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
1420 void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1422 self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
1425 void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
1427 self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
1430 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
1432 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
1433 return self->changeMeshNames(modifTab);
1436 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1438 std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
1439 PyObject *ret2=PyList_New(ret.size());
1440 for(int i=0;i<(int)ret.size();i++)
1441 PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
1445 PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1447 std::vector<int> ret1;
1448 int ret0=self->getNonEmptyLevels(mname,ret1);
1449 PyObject *elt=PyTuple_New(2);
1450 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1451 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1455 PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1457 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1458 std::vector< std::vector<TypeOfField> > typesF;
1459 std::vector< std::vector<std::string> > pfls;
1460 std::vector< std::vector<std::string> > locs;
1461 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
1463 PyObject *ret2=PyList_New(sz);
1464 for(int i=0;i<sz;i++)
1466 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1467 const std::vector<TypeOfField>& typesFI=typesF[i];
1468 const std::vector<std::string>& pflsI=pfls[i];
1469 const std::vector<std::string>& locsI=locs[i];
1470 PyObject *elt=PyTuple_New(2);
1471 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1472 int sz2=ret[i].size();
1473 PyObject *elt2=PyList_New(sz2);
1474 for(int j=0;j<sz2;j++)
1476 PyObject *elt3=PyTuple_New(4);
1477 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1478 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));
1479 PyTuple_SetItem(elt3,1,elt4);
1480 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1481 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1482 PyList_SetItem(elt2,j,elt3);
1484 PyTuple_SetItem(elt,1,elt2);
1485 PyList_SetItem(ret2,i,elt);
1490 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
1492 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
1493 std::size_t sz=ret.size();
1494 PyObject *retPy=PyList_New(sz);
1495 for(std::size_t i=0;i<sz;i++)
1496 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1500 PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
1502 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
1503 std::size_t sz=ret.size();
1504 PyObject *retPy=PyList_New(sz);
1505 for(std::size_t i=0;i<sz;i++)
1506 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1510 PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
1512 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
1513 std::size_t sz=ret.size();
1514 PyObject *retPy=PyList_New(sz);
1515 for(std::size_t i=0;i<sz;i++)
1516 PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
1522 class MEDFileField1TS : public MEDFileAnyTypeField1TS
1525 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1526 static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1527 static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1528 static MEDFileField1TS *New();
1529 ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1530 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1531 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1532 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1533 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1534 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
1536 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
1537 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1538 void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1539 void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
1542 MEDFileField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1544 return MEDFileField1TS::New(fileName,loadAll);
1547 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1549 return MEDFileField1TS::New(fileName,fieldName,loadAll);
1552 MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1554 return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
1559 return MEDFileField1TS::New();
1562 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
1564 const DataArrayDouble *arr=0;
1566 arr=field->getArray();
1567 self->copyTinyInfoFrom(field,arr);
1570 std::string __str__() const throw(INTERP_KERNEL::Exception)
1572 return self->simpleRepr();
1575 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1577 DataArrayInt *ret1=0;
1578 DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1579 PyObject *ret=PyTuple_New(2);
1580 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1581 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1585 PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1587 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1588 std::vector< std::vector<TypeOfField> > typesF;
1589 std::vector< std::vector<std::string> > pfls;
1590 std::vector< std::vector<std::string> > locs;
1591 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1593 PyObject *ret2=PyList_New(sz);
1594 for(int i=0;i<sz;i++)
1596 const std::vector<DataArrayDouble *>& dadsI=ret[i];
1597 const std::vector<TypeOfField>& typesFI=typesF[i];
1598 const std::vector<std::string>& pflsI=pfls[i];
1599 const std::vector<std::string>& locsI=locs[i];
1600 PyObject *elt=PyTuple_New(2);
1601 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1602 int sz2=ret[i].size();
1603 PyObject *elt2=PyList_New(sz2);
1604 for(int j=0;j<sz2;j++)
1606 PyObject *elt3=PyTuple_New(4);
1607 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1608 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1609 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1610 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1611 PyList_SetItem(elt2,j,elt3);
1613 PyTuple_SetItem(elt,1,elt2);
1614 PyList_SetItem(ret2,i,elt);
1619 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1621 DataArrayDouble *ret=self->getUndergroundDataArray();
1627 PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
1629 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
1630 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
1633 PyObject *ret=PyTuple_New(2);
1634 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1635 std::size_t sz=elt1Cpp.size();
1636 PyObject *elt=PyList_New(sz);
1637 for(std::size_t i=0;i<sz;i++)
1639 PyObject *elt1=PyTuple_New(2);
1640 PyObject *elt2=PyTuple_New(2);
1641 PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
1642 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
1643 PyObject *elt3=PyTuple_New(2);
1644 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
1645 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
1646 PyTuple_SetItem(elt1,0,elt2);
1647 PyTuple_SetItem(elt1,1,elt3);
1648 PyList_SetItem(elt,i,elt1);
1650 PyTuple_SetItem(ret,1,elt);
1656 class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
1659 static MEDFileIntField1TS *New();
1660 static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1661 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1662 static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1663 ParaMEDMEM::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
1665 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
1666 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
1669 MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
1671 return MEDFileIntField1TS::New();
1674 MEDFileIntField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1676 return MEDFileIntField1TS::New(fileName,loadAll);
1679 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1681 return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
1684 MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
1686 return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
1689 std::string __str__() const throw(INTERP_KERNEL::Exception)
1691 return self->simpleRepr();
1694 PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1696 DataArrayInt *ret1=0;
1697 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
1698 PyObject *ret=PyTuple_New(2);
1699 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1700 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1704 PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1706 DataArrayInt *ret1=0;
1707 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
1708 PyObject *ret=PyTuple_New(2);
1709 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1710 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1714 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1716 DataArrayInt *ret1=0;
1717 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
1718 PyObject *ret=PyTuple_New(2);
1719 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1720 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1724 PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1726 DataArrayInt *ret1=0;
1727 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
1728 PyObject *ret=PyTuple_New(2);
1729 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1730 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1734 PyObject *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
1736 DataArrayInt *ret1=0;
1737 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
1738 PyObject *ret=PyTuple_New(2);
1739 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
1740 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1744 PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
1746 DataArrayInt *ret1=0;
1747 DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
1748 PyObject *ret=PyTuple_New(2);
1749 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1750 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1754 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
1756 DataArrayInt *ret=self->getUndergroundDataArray();
1764 class MEDFileAnyTypeFieldMultiTSIterator
1769 PyObject *next() throw(INTERP_KERNEL::Exception)
1771 MEDFileAnyTypeField1TS *ret=self->nextt();
1773 return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
1776 PyErr_SetString(PyExc_StopIteration,"No more data.");
1783 class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1786 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1787 static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
1788 MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
1789 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
1790 std::string getName() const throw(INTERP_KERNEL::Exception);
1791 void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
1792 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
1793 void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception);
1794 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
1795 void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
1796 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
1797 bool presenceOfMultiDiscPerGeoType() const throw(INTERP_KERNEL::Exception);
1798 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
1799 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
1800 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
1801 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1802 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1803 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
1804 void loadArrays() throw(INTERP_KERNEL::Exception);
1805 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
1806 void unloadArrays() throw(INTERP_KERNEL::Exception);
1807 void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
1809 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
1810 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
1811 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
1812 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
1813 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
1816 int __len__() const throw(INTERP_KERNEL::Exception)
1818 return self->getNumberOfTS();
1821 int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
1823 if(elt0 && PyInt_Check(elt0))
1825 int pos=PyInt_AS_LONG(elt0);
1828 else if(elt0 && PyTuple_Check(elt0))
1830 if(PyTuple_Size(elt0)==2)
1832 PyObject *o0=PyTuple_GetItem(elt0,0);
1833 PyObject *o1=PyTuple_GetItem(elt0,1);
1834 if(PyInt_Check(o0) && PyInt_Check(o1))
1836 int iter=PyInt_AS_LONG(o0);
1837 int order=PyInt_AS_LONG(o1);
1838 return self->getPosOfTimeStep(iter,order);
1841 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 !");
1844 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 !");
1846 else if(elt0 && PyFloat_Check(elt0))
1848 double val=PyFloat_AS_DOUBLE(elt0);
1849 return self->getPosGivenTime(val);
1852 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
1855 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
1857 std::vector< std::pair<int,int> > res=self->getIterations();
1858 PyObject *ret=PyList_New(res.size());
1860 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
1862 PyObject *elt=PyTuple_New(2);
1863 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
1864 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
1865 PyList_SetItem(ret,rk,elt);
1870 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
1872 std::vector<double> ret1;
1873 std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
1874 std::size_t sz=ret.size();
1875 PyObject *ret2=PyList_New(sz);
1876 for(std::size_t i=0;i<sz;i++)
1878 PyObject *elt=PyTuple_New(3);
1879 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
1880 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
1881 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
1882 PyList_SetItem(ret2,i,elt);
1887 PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
1889 std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
1890 PyObject *ret2=PyList_New(ret.size());
1891 for(int i=0;i<(int)ret.size();i++)
1893 const std::vector<TypeOfField>& rett=ret[i];
1894 PyObject *ret3=PyList_New(rett.size());
1895 for(int j=0;j<(int)rett.size();j++)
1896 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
1897 PyList_SetItem(ret2,i,ret3);
1902 PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1904 std::vector<int> ret1;
1905 int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
1906 PyObject *elt=PyTuple_New(2);
1907 PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
1908 PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
1912 PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
1914 std::vector<INTERP_KERNEL::NormalizedCellType> types;
1915 std::vector< std::vector<TypeOfField> > typesF;
1916 std::vector< std::vector<std::string> > pfls;
1917 std::vector< std::vector<std::string> > locs;
1918 std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1920 PyObject *ret2=PyList_New(sz);
1921 for(int i=0;i<sz;i++)
1923 const std::vector< std::pair<int,int> >& dadsI=ret[i];
1924 const std::vector<TypeOfField>& typesFI=typesF[i];
1925 const std::vector<std::string>& pflsI=pfls[i];
1926 const std::vector<std::string>& locsI=locs[i];
1927 PyObject *elt=PyTuple_New(2);
1928 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
1929 int sz2=ret[i].size();
1930 PyObject *elt2=PyList_New(sz2);
1931 for(int j=0;j<sz2;j++)
1933 PyObject *elt3=PyTuple_New(4);
1934 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
1935 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));
1936 PyTuple_SetItem(elt3,1,elt4);
1937 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
1938 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
1939 PyList_SetItem(elt2,j,elt3);
1941 PyTuple_SetItem(elt,1,elt2);
1942 PyList_SetItem(ret2,i,elt);
1947 std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
1949 if(PyList_Check(elts))
1951 int sz=PyList_Size(elts);
1952 std::vector<int> ret(sz);
1953 for(int i=0;i<sz;i++)
1955 PyObject *elt=PyList_GetItem(elts,i);
1956 ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
1962 std::vector<int> ret(1);
1963 ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
1968 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
1970 if(PySlice_Check(elts))
1972 Py_ssize_t strt=2,stp=2,step=2;
1973 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
1974 GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
1975 self->eraseTimeStepIds2(strt,stp,step);
1979 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
1980 if(!idsToRemove.empty())
1981 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
1985 void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
1989 std::vector<int> pos2;
1990 DataArrayInt *pos3=0;
1991 DataArrayIntTuple *pos4=0;
1992 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
1997 self->eraseTimeStepIds(&pos1,&pos1+1);
2004 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2009 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2013 throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2017 MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
2019 return self->iterator();
2022 PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2024 if(elt0 && PyList_Check(elt0))
2026 int sz=PyList_Size(elt0);
2027 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2028 int *pt=da->getPointer();
2029 for(int i=0;i<sz;i++,pt++)
2031 PyObject *elt1=PyList_GetItem(elt0,i);
2032 *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
2034 return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
2036 else if(elt0 && PySlice_Check(elt0))
2038 Py_ssize_t strt=2,stp=2,step=2;
2039 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
2040 GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
2041 return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
2044 return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
2047 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2049 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2050 return self->changeMeshNames(modifTab);
2053 PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
2055 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
2056 std::size_t sz=ret.size();
2057 PyObject *retPy=PyList_New(sz);
2058 for(std::size_t i=0;i<sz;i++)
2059 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2063 PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
2065 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
2066 std::size_t sz=ret.size();
2067 PyObject *retPy=PyList_New(sz);
2068 for(std::size_t i=0;i<sz;i++)
2069 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2073 PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
2075 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
2076 std::size_t sz=ret.size();
2077 PyObject *retPy=PyList_New(sz);
2078 for(std::size_t i=0;i<sz;i++)
2079 PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
2083 void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
2085 std::vector<MEDFileAnyTypeField1TS *> tmp;
2086 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
2087 self->pushBackTimeSteps(tmp);
2090 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception)
2092 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2093 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2094 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
2095 std::size_t sz=ret.size();
2096 PyObject *retPy=PyList_New(sz);
2097 for(std::size_t i=0;i<sz;i++)
2099 std::size_t sz2=ret[i].size();
2100 PyObject *ret1Py=PyList_New(sz2);
2101 for(std::size_t j=0;j<sz2;j++)
2103 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2106 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2108 PyList_SetItem(retPy,i,ret1Py);
2113 static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
2115 std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
2116 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
2117 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> > ret2;
2118 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
2119 if(ret2.size()!=ret.size())
2121 std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
2122 throw INTERP_KERNEL::Exception(oss.str().c_str());
2124 std::size_t sz=ret.size();
2125 PyObject *retPy=PyList_New(sz);
2126 for(std::size_t i=0;i<sz;i++)
2128 std::size_t sz2=ret[i].size();
2129 PyObject *ret0Py=PyTuple_New(2);
2130 PyObject *ret1Py=PyList_New(sz2);
2131 for(std::size_t j=0;j<sz2;j++)
2133 MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
2136 PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
2138 PyTuple_SetItem(ret0Py,0,ret1Py);
2139 PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_ParaMEDMEM__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
2140 PyList_SetItem(retPy,i,ret0Py);
2147 class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2150 static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
2151 static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2152 static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2154 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2155 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2156 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2157 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2158 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
2160 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
2161 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
2162 ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
2165 MEDFileFieldMultiTS()
2167 return MEDFileFieldMultiTS::New();
2170 MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2172 return MEDFileFieldMultiTS::New(fileName,loadAll);
2175 MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2177 return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
2180 std::string __str__() const throw(INTERP_KERNEL::Exception)
2182 return self->simpleRepr();
2185 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2187 DataArrayInt *ret1=0;
2188 DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2189 PyObject *ret=PyTuple_New(2);
2190 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2191 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2195 PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
2197 std::vector<INTERP_KERNEL::NormalizedCellType> types;
2198 std::vector< std::vector<TypeOfField> > typesF;
2199 std::vector< std::vector<std::string> > pfls;
2200 std::vector< std::vector<std::string> > locs;
2201 std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2203 PyObject *ret2=PyList_New(sz);
2204 for(int i=0;i<sz;i++)
2206 const std::vector<DataArrayDouble *>& dadsI=ret[i];
2207 const std::vector<TypeOfField>& typesFI=typesF[i];
2208 const std::vector<std::string>& pflsI=pfls[i];
2209 const std::vector<std::string>& locsI=locs[i];
2210 PyObject *elt=PyTuple_New(2);
2211 PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
2212 int sz2=ret[i].size();
2213 PyObject *elt2=PyList_New(sz2);
2214 for(int j=0;j<sz2;j++)
2216 PyObject *elt3=PyTuple_New(4);
2217 PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
2218 PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2219 PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
2220 PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
2221 PyList_SetItem(elt2,j,elt3);
2223 PyTuple_SetItem(elt,1,elt2);
2224 PyList_SetItem(ret2,i,elt);
2228 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2230 DataArrayDouble *ret=self->getUndergroundDataArray(iteration,order);
2236 PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2238 std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
2239 DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
2242 PyObject *ret=PyTuple_New(2);
2243 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2244 std::size_t sz=elt1Cpp.size();
2245 PyObject *elt=PyList_New(sz);
2246 for(std::size_t i=0;i<sz;i++)
2248 PyObject *elt1=PyTuple_New(2);
2249 PyObject *elt2=PyTuple_New(2);
2250 PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first));
2251 PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
2252 PyObject *elt3=PyTuple_New(2);
2253 PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
2254 PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
2255 PyTuple_SetItem(elt1,0,elt2);
2256 PyTuple_SetItem(elt1,1,elt3);
2257 PyList_SetItem(elt,i,elt1);
2259 PyTuple_SetItem(ret,1,elt);
2265 class MEDFileFieldsIterator
2270 PyObject *next() throw(INTERP_KERNEL::Exception)
2272 MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
2274 return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
2277 PyErr_SetString(PyExc_StopIteration,"No more data.");
2284 class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
2287 static MEDFileIntFieldMultiTS *New();
2288 static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2289 static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2291 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
2292 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
2293 ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
2296 MEDFileIntFieldMultiTS()
2298 return MEDFileIntFieldMultiTS::New();
2301 MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2303 return MEDFileIntFieldMultiTS::New(fileName,loadAll);
2306 MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2308 return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
2311 std::string __str__() const throw(INTERP_KERNEL::Exception)
2313 return self->simpleRepr();
2316 PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2318 DataArrayInt *ret1=0;
2319 MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
2320 PyObject *ret=PyTuple_New(2);
2321 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2322 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2326 PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2328 DataArrayInt *ret1=0;
2329 MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
2330 PyObject *ret=PyTuple_New(2);
2331 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2332 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2336 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2338 DataArrayInt *ret1=0;
2339 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
2340 PyObject *ret=PyTuple_New(2);
2341 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2346 PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2348 DataArrayInt *ret1=0;
2349 MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
2350 PyObject *ret=PyTuple_New(2);
2351 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2352 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2356 PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
2358 DataArrayInt *ret1=0;
2359 MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
2360 PyObject *ret=PyTuple_New(2);
2361 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
2362 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2366 PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
2368 DataArrayInt *ret1=0;
2369 DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
2370 PyObject *ret=PyTuple_New(2);
2371 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2372 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2376 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
2378 DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
2386 class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
2389 static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
2390 static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
2391 static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0) throw(INTERP_KERNEL::Exception);
2392 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
2393 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
2394 void loadArrays() throw(INTERP_KERNEL::Exception);
2395 void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
2396 void unloadArrays() throw(INTERP_KERNEL::Exception);
2397 void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
2398 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2399 int getNumberOfFields() const;
2400 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
2401 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
2403 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2404 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2405 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
2406 int getPosFromFieldName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
2407 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
2408 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
2409 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception);
2410 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
2411 bool removeFieldsWithoutAnyTimeStep() throw(INTERP_KERNEL::Exception);
2416 return MEDFileFields::New();
2419 MEDFileFields(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
2421 return MEDFileFields::New(fileName,loadAll);
2424 std::string __str__() const throw(INTERP_KERNEL::Exception)
2426 return self->simpleRepr();
2429 PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
2432 std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
2433 PyObject *ret=PyTuple_New(2);
2434 PyObject *ret_0=PyList_New(ret0.size());
2436 for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
2438 PyObject *elt=PyTuple_New(2);
2439 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2440 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2441 PyList_SetItem(ret_0,rk,elt);
2443 PyTuple_SetItem(ret,0,ret_0);
2444 PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
2445 PyTuple_SetItem(ret,1,ret_1);
2449 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2451 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2452 return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
2455 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
2457 std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
2458 return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
2461 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2463 if(obj && PyList_Check(obj))
2465 int sz=PyList_Size(obj);
2466 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
2467 int *pt=da->getPointer();
2468 for(int i=0;i<sz;i++,pt++)
2470 PyObject *elt1=PyList_GetItem(obj,i);
2471 *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
2473 return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
2476 return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
2479 MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
2481 self->setFieldAtPos(obj,field);
2485 int __len__() const throw(INTERP_KERNEL::Exception)
2487 return self->getNumberOfFields();
2490 MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
2492 return self->iterator();
2495 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2497 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2498 return self->changeMeshNames(modifTab);
2501 int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2503 if(elt0 && PyInt_Check(elt0))
2505 return PyInt_AS_LONG(elt0);
2507 else if(elt0 && PyString_Check(elt0))
2508 return self->getPosFromFieldName(PyString_AsString(elt0));
2510 throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
2513 std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2515 if(PyList_Check(elts))
2517 int sz=PyList_Size(elts);
2518 std::vector<int> ret(sz);
2519 for(int i=0;i<sz;i++)
2521 PyObject *elt=PyList_GetItem(elts,i);
2522 ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
2528 std::vector<int> ret(1);
2529 ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
2534 void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
2536 std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
2537 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
2538 self->pushFields(tmp);
2541 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2543 if(elts && PySlice_Check(elts))
2545 Py_ssize_t strt=2,stp=2,step=2;
2546 PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
2547 GetIndicesOfSlice(oC,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
2548 self->destroyFieldsAtPos2(strt,stp,step);
2552 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
2553 if(!idsToRemove.empty())
2554 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2560 class MEDFileParameter1TS : public RefCountObject
2563 void setIteration(int it);
2564 int getIteration() const;
2565 void setOrder(int order);
2566 int getOrder() const;
2567 void setTimeValue(double time);
2568 void setTime(int dt, int it, double time);
2569 double getTime(int& dt, int& it);
2570 double getTimeValue() const;
2573 class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
2576 void setValue(double val) throw(INTERP_KERNEL::Exception);
2577 double getValue() const throw(INTERP_KERNEL::Exception);
2578 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2581 std::string __str__() const throw(INTERP_KERNEL::Exception)
2583 return self->simpleRepr();
2588 class MEDFileParameterTinyInfo : public MEDFileWritable
2591 void setDescription(const std::string& name);
2592 std::string getDescription() const;
2593 void setTimeUnit(const std::string& unit);
2594 std::string getTimeUnit() const;
2597 class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
2600 static MEDFileParameterDouble1TS *New();
2601 static MEDFileParameterDouble1TS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2602 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
2603 static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
2604 virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
2605 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2606 void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
2607 std::string getName() const throw(INTERP_KERNEL::Exception);
2608 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2611 MEDFileParameterDouble1TS()
2613 return MEDFileParameterDouble1TS::New();
2616 MEDFileParameterDouble1TS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
2618 return MEDFileParameterDouble1TS::New(fileName);
2621 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception)
2623 return MEDFileParameterDouble1TS::New(fileName,paramName);
2626 MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
2628 return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
2631 std::string __str__() const throw(INTERP_KERNEL::Exception)
2633 return self->simpleRepr();
2636 PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
2639 bool ret0=self->isEqual(other,eps,what);
2640 PyObject *res=PyList_New(2);
2641 PyObject *ret0Py=ret0?Py_True:Py_False;
2643 PyList_SetItem(res,0,ret0Py);
2644 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2650 class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
2653 static MEDFileParameterMultiTS *New();
2654 static MEDFileParameterMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2655 static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
2656 std::string getName() const;
2657 void setName(const std::string& name);
2658 MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
2659 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2660 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2661 void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
2662 double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2663 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
2664 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
2665 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
2668 MEDFileParameterMultiTS()
2670 return MEDFileParameterMultiTS::New();
2673 MEDFileParameterMultiTS(const std::string& fileName)
2675 return MEDFileParameterMultiTS::New(fileName);
2678 MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
2680 return MEDFileParameterMultiTS::New(fileName,paramName);
2683 std::string __str__() const throw(INTERP_KERNEL::Exception)
2685 return self->simpleRepr();
2688 PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
2691 bool ret0=self->isEqual(other,eps,what);
2692 PyObject *res=PyList_New(2);
2693 PyObject *ret0Py=ret0?Py_True:Py_False;
2695 PyList_SetItem(res,0,ret0Py);
2696 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2700 void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
2704 std::vector<int> pos2;
2705 DataArrayInt *pos3=0;
2706 DataArrayIntTuple *pos4=0;
2707 convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
2712 self->eraseTimeStepIds(&pos1,&pos1+1);
2719 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
2724 self->eraseTimeStepIds(pos3->begin(),pos3->end());
2728 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
2732 int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2734 if(elt0 && PyInt_Check(elt0))
2736 int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
2739 else if(elt0 && PyTuple_Check(elt0))
2741 if(PyTuple_Size(elt0)==2)
2743 PyObject *o0=PyTuple_GetItem(elt0,0);
2744 PyObject *o1=PyTuple_GetItem(elt0,1);
2745 if(PyInt_Check(o0) && PyInt_Check(o1))
2747 int iter=PyInt_AS_LONG(o0);
2748 int order=PyInt_AS_LONG(o1);
2749 return self->getPosOfTimeStep(iter,order);
2752 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 !");
2755 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 !");
2757 else if(elt0 && PyFloat_Check(elt0))
2759 double val=PyFloat_AS_DOUBLE(elt0);
2760 return self->getPosGivenTime(val);
2763 throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
2766 MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
2768 MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
2774 std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
2776 if(PyList_Check(elts))
2778 int sz=PyList_Size(elts);
2779 std::vector<int> ret(sz);
2780 for(int i=0;i<sz;i++)
2782 PyObject *elt=PyList_GetItem(elts,i);
2783 ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
2789 std::vector<int> ret(1);
2790 ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
2795 void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
2797 std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
2798 if(!idsToRemove.empty())
2799 self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
2802 MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
2804 MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
2810 PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
2812 std::vector< std::pair<int,int> > res=self->getIterations();
2813 PyObject *ret=PyList_New(res.size());
2815 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2817 PyObject *elt=PyTuple_New(2);
2818 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2819 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2820 PyList_SetItem(ret,rk,elt);
2825 PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
2827 std::vector<double> res2;
2828 std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
2829 PyObject *ret=PyList_New(res.size());
2831 for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
2833 PyObject *elt=PyTuple_New(3);
2834 PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
2835 PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
2836 PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
2837 PyList_SetItem(ret,rk,elt);
2844 class MEDFileParameters : public RefCountObject, public MEDFileWritable
2847 static MEDFileParameters *New();
2848 static MEDFileParameters *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2849 MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
2850 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2851 std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
2852 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
2853 void resize(int newSize) throw(INTERP_KERNEL::Exception);
2854 void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2855 void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
2856 void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
2857 int getPosFromParamName(const std::string& paramName) const throw(INTERP_KERNEL::Exception);
2858 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2863 return MEDFileParameters::New();
2866 MEDFileParameters(const std::string& fileName)
2868 return MEDFileParameters::New(fileName);
2871 std::string __str__() const throw(INTERP_KERNEL::Exception)
2873 return self->simpleRepr();
2876 MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2878 if(PyInt_Check(obj))
2880 MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
2885 else if(PyString_Check(obj))
2887 MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
2893 throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
2896 int __len__() const throw(INTERP_KERNEL::Exception)
2898 return self->getNumberOfParams();
2901 MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
2903 MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
2909 MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const throw(INTERP_KERNEL::Exception)
2911 MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
2917 PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
2920 bool ret0=self->isEqual(other,eps,what);
2921 PyObject *res=PyList_New(2);
2922 PyObject *ret0Py=ret0?Py_True:Py_False;
2924 PyList_SetItem(res,0,ret0Py);
2925 PyList_SetItem(res,1,PyString_FromString(what.c_str()));
2931 class MEDFileData : public RefCountObject, public MEDFileWritable
2934 static MEDFileData *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
2935 static MEDFileData *New();
2936 MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
2937 void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
2938 void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
2939 void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
2940 int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
2941 int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
2942 int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
2944 bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
2945 bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
2947 void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
2950 MEDFileData(const std::string& fileName) throw(INTERP_KERNEL::Exception)
2952 return MEDFileData::New(fileName);
2957 return MEDFileData::New();
2960 std::string __str__() const throw(INTERP_KERNEL::Exception)
2962 return self->simpleRepr();
2965 MEDFileMeshes *getMeshes() const throw(INTERP_KERNEL::Exception)
2967 MEDFileMeshes *ret=self->getMeshes();
2973 MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
2975 MEDFileParameters *ret=self->getParams();
2981 MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
2983 MEDFileFields *ret=self->getFields();
2989 bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
2991 std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
2992 return self->changeMeshNames(modifTab);
2997 class SauvReader : public RefCountObject
3000 static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
3001 MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
3004 SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception)
3006 return SauvReader::New(fileName);
3011 class SauvWriter : public RefCountObject
3014 static SauvWriter * New();
3015 void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
3016 void write(const std::string& fileName) throw(INTERP_KERNEL::Exception);
3017 void setCpyGrpIfOnASingleFamilyStatus(bool status) throw(INTERP_KERNEL::Exception);
3018 bool getCpyGrpIfOnASingleFamilyStatus() const throw(INTERP_KERNEL::Exception);
3021 SauvWriter() throw(INTERP_KERNEL::Exception)
3023 return SauvWriter::New();
3030 class MEDFileMeshStruct;
3032 class MEDFileField1TSStructItem
3035 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
3038 class MEDFileMeshStruct : public RefCountObject
3041 static MEDFileMeshStruct *New(const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception);
3043 ~MEDFileMeshStruct();
3046 class MEDMeshMultiLev : public RefCountObject
3049 virtual MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception);
3050 DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception);
3056 PyObject *retrieveFamilyIdsOnCells() const throw(INTERP_KERNEL::Exception)
3058 DataArrayInt *famIds(0);
3059 bool isWithoutCopy(false);
3060 self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
3061 PyObject *ret=PyTuple_New(2);
3062 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3064 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3065 PyTuple_SetItem(ret,1,ret1Py);
3069 PyObject *retrieveNumberIdsOnCells() const throw(INTERP_KERNEL::Exception)
3071 DataArrayInt *numIds(0);
3072 bool isWithoutCopy(false);
3073 self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
3074 PyObject *ret=PyTuple_New(2);
3075 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3077 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3078 PyTuple_SetItem(ret,1,ret1Py);
3082 PyObject *retrieveFamilyIdsOnNodes() const throw(INTERP_KERNEL::Exception)
3084 DataArrayInt *famIds(0);
3085 bool isWithoutCopy(false);
3086 self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
3087 PyObject *ret=PyTuple_New(2);
3088 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3090 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3091 PyTuple_SetItem(ret,1,ret1Py);
3095 PyObject *retrieveNumberIdsOnNodes() const throw(INTERP_KERNEL::Exception)
3097 DataArrayInt *numIds(0);
3098 bool isWithoutCopy(false);
3099 self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
3100 PyObject *ret=PyTuple_New(2);
3101 PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
3103 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3104 PyTuple_SetItem(ret,1,ret1Py);
3108 PyObject *getGeoTypes() const throw(INTERP_KERNEL::Exception)
3110 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
3111 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
3112 PyObject *res(PyList_New(result.size()));
3113 for(int i=0;iL!=result.end(); i++, iL++)
3114 PyList_SetItem(res,i,PyInt_FromLong(*iL));
3120 class MEDUMeshMultiLev : public MEDMeshMultiLev
3123 ~MEDUMeshMultiLev();
3127 PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
3129 DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
3130 bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
3131 PyObject *ret0Py=ncc?Py_True:Py_False;
3133 PyObject *ret=PyTuple_New(7);
3134 PyTuple_SetItem(ret,0,ret0Py);
3135 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3136 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_ParaMEDMEM__DataArrayByte, SWIG_POINTER_OWN | 0 ));
3137 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3138 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3139 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3140 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3146 class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
3149 ~MEDStructuredMeshMultiLev();
3152 class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
3155 ~MEDCMeshMultiLev();
3159 PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
3162 std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
3163 std::size_t sz(objs.size());
3164 PyObject *ret(PyTuple_New(2));
3165 PyObject *ret0=PyList_New(sz);
3166 for(std::size_t i=0;i<sz;i++)
3167 PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3168 PyTuple_SetItem(ret,0,ret0);
3169 PyObject *ret1Py(isInternal?Py_True:Py_False);
3171 PyTuple_SetItem(ret,1,ret1Py);
3177 class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
3180 ~MEDCurveLinearMeshMultiLev();
3184 PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
3186 DataArrayDouble *ret0(0);
3187 std::vector<int> ret1;
3189 self->buildVTUArrays(ret0,ret1,ret2);
3190 std::size_t sz(ret1.size());
3191 PyObject *ret=PyTuple_New(3);
3192 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3193 PyObject *ret1Py=PyList_New(sz);
3194 for(std::size_t i=0;i<sz;i++)
3195 PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
3196 PyTuple_SetItem(ret,1,ret1Py);
3197 PyObject *ret2Py(ret2?Py_True:Py_False);
3199 PyTuple_SetItem(ret,2,ret2Py);
3205 class MEDFileFastCellSupportComparator : public RefCountObject
3208 static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception);
3209 MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
3210 bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
3211 int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
3213 ~MEDFileFastCellSupportComparator();
3217 PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const throw(INTERP_KERNEL::Exception)
3219 std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
3220 std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
3221 PyObject *res(PyList_New(result.size()));
3222 for(int i=0;iL!=result.end(); i++, iL++)
3223 PyList_SetItem(res,i,PyInt_FromLong(*iL));