+ class MEDFileUMesh : public MEDFileMesh
+ {
+ public:
+ static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
+ static MEDFileUMesh *New(DataArrayByte *db);
+ static MEDFileUMesh *New();
+ static const char *GetSpeStr4ExtMesh();
+ ~MEDFileUMesh();
+ int getSpaceDimension() const;
+ int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ void checkConsistency() const;
+ void checkSMESHConsistency() const;
+ void clearNodeAndCellNumbers();
+ //
+ MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
+ MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
+ MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
+ MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
+ MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
+ MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
+ MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
+ void forceComputationOfParts() const;
+ //
+ void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
+ void setCoords(DataArrayDouble *coords);
+ void setCoordsForced(DataArrayDouble *coords);
+ void eraseGroupsAtLevel(int meshDimRelToMaxExt);
+ void removeMeshAtLevel(int meshDimRelToMax);
+ void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
+ void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
+ void optimizeFamilies();
+ DataArrayInt *zipCoords();
+ DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
+ MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
+ MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
+ MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
+ %extend
+ {
+ MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
+ {
+ return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
+ }
+
+ MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
+ {
+ return MEDFileUMesh::New(fileName,mrs);
+ }
+
+ MEDFileUMesh(const MEDCouplingMappedExtrudedMesh *mem)
+ {
+ return MEDFileUMesh::New(mem);
+ }
+
+ MEDFileUMesh(DataArrayByte *db)
+ {
+ return MEDFileUMesh::New(db);
+ }
+
+ MEDFileUMesh()
+ {
+ return MEDFileUMesh::New();
+ }
+
+ 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)
+ {
+ std::vector<int> typesCpp1;
+ convertPyToNewIntArr3(types,typesCpp1);
+ std::size_t sz(typesCpp1.size());
+ std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
+ for(std::size_t ii=0;ii<sz;ii++)
+ typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
+ return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
+ }
+
+ PyObject *__getstate__()
+ {
+ std::vector<double> a0;
+ std::vector<int> a1;
+ std::vector<std::string> a2;
+ std::vector< MCAuto<DataArrayInt> > a3;
+ MCAuto<DataArrayDouble> a4;
+ self->serialize(a0,a1,a2,a3,a4);
+ PyObject *ret(PyTuple_New(5));
+ PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
+ PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
+ int sz(a2.size());
+ PyObject *ret2(PyList_New(sz));
+ for(int i=0;i<sz;i++)
+ PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
+ PyTuple_SetItem(ret,2,ret2);
+ sz=a3.size();
+ PyObject *ret3(PyList_New(sz));
+ for(int i=0;i<sz;i++)
+ {
+ DataArrayInt *elt(a3[i]);
+ if(elt)
+ elt->incrRef();
+ PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ }
+ PyTuple_SetItem(ret,3,ret3);
+ DataArrayDouble *ret4(a4);
+ if(ret4)
+ ret4->incrRef();
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ void __setstate__(PyObject *inp)
+ {
+ static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
+ if(!PyTuple_Check(inp))
+ throw INTERP_KERNEL::Exception(MSG);
+ int sz(PyTuple_Size(inp));
+ if(sz!=5)
+ throw INTERP_KERNEL::Exception(MSG);
+ std::vector<double> a0;
+ std::vector<int> a1;
+ std::vector<std::string> a2;
+ std::vector< MCAuto<DataArrayInt> > a3;
+ MCAuto<DataArrayDouble> a4;
+ //
+ PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
+ int tmp(-1);
+ fillArrayWithPyListDbl3(a0py,tmp,a0);
+ convertPyToNewIntArr3(a1py,a1);
+ fillStringVector(a2py,a2);
+ //
+ PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
+ void *argp(0);
+ int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0));
+ if(!SWIG_IsOK(status))
+ throw INTERP_KERNEL::Exception(MSG);
+ a4=reinterpret_cast<DataArrayDouble *>(argp);
+ if((DataArrayDouble *)a4)
+ a4->incrRef();
+ {
+ std::vector< DataArrayInt * > a3Tmp;
+ convertFromPyObjVectorOfObj<MEDCoupling::DataArrayInt *>(b0py,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",a3Tmp);
+ std::size_t sz(a3Tmp.size());
+ a3.resize(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ a3[i]=a3Tmp[i];
+ if(a3Tmp[i])
+ a3Tmp[i]->incrRef();
+ }
+ self->unserialize(a0,a1,a2,a3,a4);
+ }
+ }
+
+ void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh)
+ {
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
+ MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
+ if(m0)
+ {
+ self->setMeshAtLevel(meshDimRelToMax,m0,false);
+ return ;
+ }
+ MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
+ if(m1)
+ {
+ self->setMeshAtLevel(meshDimRelToMax,m1);
+ return ;
+ }
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
+ }
+
+ void __delitem__(int meshDimRelToMax)
+ {
+ self->removeMeshAtLevel(meshDimRelToMax);
+ }
+
+ MEDFileUMesh *symmetry3DPlane(PyObject *point, PyObject *normalVector) const
+ {
+ const char msg[]="Python wrap of MEDFileUMesh::symmetry3DPlane : ";
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
+ const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
+ MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
+ return ret.retn();
+ }
+
+ static MEDFileUMesh *Aggregate(PyObject *meshes)
+ {
+ std::vector<const MEDFileUMesh *> meshesCpp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDFileUMesh *>(meshes,SWIGTYPE_p_MEDCoupling__MEDFileUMesh,"MEDFileUMesh",meshesCpp);
+ MCAuto<MEDFileUMesh> ret(MEDFileUMesh::Aggregate(meshesCpp));
+ return ret.retn();
+ }
+
+ PyObject *getAllDistributionOfTypes() const
+ {
+ std::vector< std::pair<int,int> > ret(self->getAllDistributionOfTypes());
+ return convertVecPairIntToPy(ret);
+ }
+
+ DataArrayInt *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
+ {
+ std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ convertToMapIntDataArrayInt(extractDef,extractDefCpp);
+ return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
+ }
+
+ MEDFileUMesh *extractPart(PyObject *extractDef) const
+ {
+ std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ convertToMapIntDataArrayInt(extractDef,extractDefCpp);
+ return self->extractPart(extractDefCpp);
+ }
+
+ void setMeshes(PyObject *li, bool renum=false)
+ {
+ std::vector<const MEDCouplingUMesh *> ms;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
+ self->setMeshes(ms,renum);
+ }
+
+ void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false)
+ {
+ std::vector<const MEDCouplingUMesh *> ms;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
+ self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
+ }
+
+ void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false)
+ {
+ std::vector<const MEDCouplingUMesh *> ms;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
+ self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
+ }
+
+ DataArrayDouble *getCoords() const
+ {
+ DataArrayDouble *ret=self->getCoords();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const
+ {
+ const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
+ if(ret)
+ ret->incrRef();
+ return const_cast<PartDefinition *>(ret);
+ }
+
+ PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
+ {
+ DataArrayInt *ret0=0,*ret1=0,*ret2=0;
+ self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
+ PyObject *ret=PyTuple_New(3);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const
+ {
+ MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const
+ {
+ std::vector<MEDCoupling1GTUMesh *> tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax));
+ std::size_t sz(tmp.size());
+ PyObject *ret=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ if(tmp[i])
+ tmp[i]->incrRef();
+ PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 ));
+ }
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileStructuredMesh : public MEDFileMesh
+ {
+ public:
+ %extend
+ {
+ MEDCoupling1SGTUMesh *getImplicitFaceMesh() const
+ {
+ MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileCMesh : public MEDFileStructuredMesh
+ {
+ public:
+ static MEDFileCMesh *New();
+ static MEDFileCMesh *New(DataArrayByte *db);
+ static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ void setMesh(MEDCouplingCMesh *m);
+ int getSpaceDimension() const;
+ %extend
+ {
+ MEDFileCMesh()
+ {
+ return MEDFileCMesh::New();
+ }
+
+ MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
+ {
+ return MEDFileCMesh::New(fileName,mrs);
+ }
+
+ MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
+ {
+ return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
+ }
+
+ MEDFileCMesh(DataArrayByte *db)
+ {
+ return MEDFileCMesh::New(db);
+ }
+
+ PyObject *getMesh() const
+ {
+ const MEDCouplingCMesh *tmp=self->getMesh();
+ if(tmp)
+ tmp->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 );
+ }
+ }
+ };
+
+ class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
+ {
+ public:
+ static MEDFileCurveLinearMesh *New();
+ static MEDFileCurveLinearMesh *New(DataArrayByte *db);
+ static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+ static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ void setMesh(MEDCouplingCurveLinearMesh *m);
+ %extend
+ {
+ MEDFileCurveLinearMesh()
+ {
+ return MEDFileCurveLinearMesh::New();
+ }
+
+ MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0)
+ {
+ return MEDFileCurveLinearMesh::New(fileName,mrs);
+ }
+
+ MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
+ {
+ return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
+ }
+
+ MEDFileCurveLinearMesh(DataArrayByte *db)
+ {
+ return MEDFileCurveLinearMesh::New(db);
+ }
+
+ PyObject *getMesh() const
+ {
+ const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
+ if(tmp)
+ tmp->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
+ }
+ }
+ };
+
+ class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritableStandAlone
+ {
+ public:
+ static MEDFileMeshMultiTS *New();
+ static MEDFileMeshMultiTS *New(const std::string& fileName);
+ static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
+ MEDFileMeshMultiTS *deepCopy() const;
+ std::string getName() const;
+ void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
+ void cartesianizeMe();
+ %extend
+ {
+ MEDFileMeshMultiTS()
+ {
+ return MEDFileMeshMultiTS::New();
+ }
+
+ MEDFileMeshMultiTS(const std::string& fileName)
+ {
+ return MEDFileMeshMultiTS::New(fileName);
+ }
+
+ MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
+ {
+ return MEDFileMeshMultiTS::New(fileName,mName);
+ }
+
+ MEDFileMesh *getOneTimeStep() const
+ {
+ MEDFileMesh *ret=self->getOneTimeStep();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileMeshesIterator
+ {
+ public:
+ %extend
+ {
+ PyObject *next()
+ {
+ MEDFileMesh *ret=self->nextt();
+ if(ret)
+ {
+ ret->incrRef();
+ return convertMEDFileMesh(ret,SWIG_POINTER_OWN | 0 );
+ }
+ else
+ {
+ PyErr_SetString(PyExc_StopIteration,"No more data.");
+ return 0;
+ }
+ }
+ }
+ };
+
+ class MEDFileMeshes : public RefCountObject, public MEDFileWritableStandAlone
+ {
+ public:
+ static MEDFileMeshes *New();
+ static MEDFileMeshes *New(DataArrayByte *db);
+ MEDFileMeshes *deepCopy() const;
+ int getNumberOfMeshes() const;
+ std::vector<std::string> getMeshesNames() const;
+ //
+ void resize(int newSize);
+ void pushMesh(MEDFileMesh *mesh);
+ void setMeshAtPos(int i, MEDFileMesh *mesh);
+ void destroyMeshAtPos(int i);
+ void cartesianizeMe();
+ bool presenceOfStructureElements() const;
+ void killStructureElements();
+ %extend
+ {
+ MEDFileMeshes()
+ {
+ return MEDFileMeshes::New();
+ }
+
+ MEDFileMeshes(const std::string& fileName)
+ {
+ return MEDFileMeshes::New(fileName);
+ }
+
+ MEDFileMeshes(DataArrayByte *db)
+ {
+ return MEDFileMeshes::New(db);
+ }
+
+ std::string __str__() const
+ {
+ return self->simpleRepr();
+ }
+
+ MEDFileMesh *__getitem__(PyObject *obj)
+ {
+ static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
+ if(PyInt_Check(obj))
+ {
+ MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh)
+ {
+ self->setMeshAtPos(obj,mesh);
+ return self;
+ }
+
+ MEDFileMeshesIterator *__iter__()
+ {
+ return self->iterator();
+ }
+
+ int __len__() const
+ {
+ return self->getNumberOfMeshes();
+ }
+
+ MEDFileMesh *getMeshAtPos(int i) const
+ {
+ MEDFileMesh *ret=self->getMeshAtPos(i);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ MEDFileMesh *getMeshWithName(const std::string& mname) const
+ {
+ MEDFileMesh *ret=self->getMeshWithName(mname);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileFieldLoc : public RefCountObject
+ {
+ public:
+ std::string getName() const;
+ int getDimension() const;
+ int getNumberOfGaussPoints() const;
+ int getNumberOfPointsInCells() const;
+ const std::vector<double>& getRefCoords() const;
+ const std::vector<double>& getGaussCoords() const;
+ const std::vector<double>& getGaussWeights() const;
+ bool isEqual(const MEDFileFieldLoc& other, double eps) const;
+ %extend
+ {
+ std::string __str__() const
+ {
+ return self->repr();
+ }
+ }
+ };
+
+ class MEDFileFieldGlobsReal
+ {
+ public:
+ void resetContent();
+ void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
+ void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
+ void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
+ void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other);
+ void appendGlobs(const MEDFileFieldGlobsReal& other, double eps);
+ void checkGlobsCoherency() const;
+ void checkGlobsPflsPartCoherency() const;
+ void checkGlobsLocsPartCoherency() const;
+ std::vector<std::string> getPfls() const;
+ std::vector<std::string> getLocs() const;
+ bool existsPfl(const std::string& pflName) const;
+ bool existsLoc(const std::string& locName) const;
+ std::string createNewNameOfPfl() const;
+ std::string createNewNameOfLoc() const;
+ std::vector< std::vector<int> > whichAreEqualProfiles() const;
+ std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
+ virtual std::vector<std::string> getPflsReallyUsed() const;
+ virtual std::vector<std::string> getLocsReallyUsed() const;
+ virtual std::vector<std::string> getPflsReallyUsedMulti() const;
+ virtual std::vector<std::string> getLocsReallyUsedMulti() const;
+ void killProfileIds(const std::vector<int>& pflIds);
+ void killLocalizationIds(const std::vector<int>& locIds);
+ void changePflName(const std::string& oldName, const std::string& newName);
+ void changeLocName(const std::string& oldName, const std::string& newName);
+ int getNbOfGaussPtPerCell(int locId) const;
+ int getLocalizationId(const std::string& loc) const;
+ int getProfileId(const std::string& pfl) const;
+ void killStructureElementsInGlobs();
+ %extend
+ {
+ PyObject *getProfile(const std::string& pflName) const
+ {
+ const DataArrayInt *ret=self->getProfile(pflName);
+ if(ret)
+ ret->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ }
+
+ PyObject *getProfileFromId(int pflId) const
+ {
+ const DataArrayInt *ret=self->getProfileFromId(pflId);
+ if(ret)
+ ret->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ }
+
+ PyObject *getLocalizationFromId(int locId) const
+ {
+ const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
+ if(loc)
+ loc->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
+ }
+
+ PyObject *getLocalization(const std::string& locName) const
+ {
+ const MEDFileFieldLoc *loc=&self->getLocalization(locName);
+ if(loc)
+ loc->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
+ }
+
+ PyObject *zipPflsNames()
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
+ return convertVecPairVecStToPy(ret);
+ }
+
+ PyObject *zipLocsNames(double eps)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
+ return convertVecPairVecStToPy(ret);
+ }
+
+ void changePflsNames(PyObject *li)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changePflsNames(v);
+ }
+
+ void changePflsRefsNamesGen(PyObject *li)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changePflsRefsNamesGen(v);
+ }
+
+ void changePflsNamesInStruct(PyObject *li)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changePflsNamesInStruct(v);
+ }
+
+ void changeLocsNames(PyObject *li)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changeLocsNames(v);
+ }
+
+ void changeLocsRefsNamesGen(PyObject *li)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changeLocsRefsNamesGen(v);
+ }
+
+ void changeLocsNamesInStruct(PyObject *li)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changeLocsNamesInStruct(v);
+ }
+
+ std::string simpleReprGlobs() const
+ {
+ std::ostringstream oss;
+ self->simpleReprGlobs(oss);
+ return oss.str();
+ }
+ }
+ };
+
+ class MEDFileEntities
+ {
+ public:
+ %extend
+ {
+ static MEDFileEntities *BuildFrom(PyObject *entities)
+ {
+ std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > inp;
+ std::vector< std::pair<int,int> > inp0(convertTimePairIdsFromPy(entities));
+ {
+ std::size_t sz(inp0.size());
+ inp.resize(sz);
+ for(std::size_t i=0;i<sz;i++)
+ inp[i]=std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType>((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second);
+ }
+ return MEDFileEntities::BuildFrom(&inp);
+ }
+ }
+ private:
+ MEDFileEntities();
+ };
+
+ class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
+ {
+ public:
+ static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
+ static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+ static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
+ static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities);
+ void loadArrays();
+ void loadArraysIfNecessary();
+ void unloadArrays();
+ void unloadArraysWithoutDataLoss();
+ int getDimension() const;
+ int getIteration() const;
+ int getOrder() const;
+ std::string getName();
+ void setName(const std::string& name);
+ std::string getMeshName();
+ void setMeshName(const std::string& newMeshName);
+ int getMeshIteration() const;
+ int getMeshOrder() const;
+ int getNumberOfComponents() const;
+ bool isDealingTS(int iteration, int order) const;
+ void setInfo(const std::vector<std::string>& infos);
+ const std::vector<std::string>& getInfo() const;
+ bool presenceOfMultiDiscPerGeoType() const;
+ void setTime(int iteration, int order, double val);
+ virtual MEDFileAnyTypeField1TS *shallowCpy() const;
+ MEDFileAnyTypeField1TS *deepCopy() const;
+ std::string getDtUnit() const;
+ void setDtUnit(const std::string& dtUnit);
+ %extend
+ {
+ PyObject *getTime()
+ {
+ int tmp1,tmp2;
+ double tmp0=self->getTime(tmp1,tmp2);
+ PyObject *res = PyList_New(3);
+ PyList_SetItem(res,0,SWIG_From_int(tmp1));
+ PyList_SetItem(res,1,SWIG_From_int(tmp2));
+ PyList_SetItem(res,2,SWIG_From_double(tmp0));
+ return res;
+ }
+
+ PyObject *getDtIt() const
+ {
+ std::pair<int,int> res=self->getDtIt();
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
+ PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
+ return elt;
+ }
+
+ void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false)
+ {
+ self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
+ }
+
+ void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false)
+ {
+ self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
+ }
+
+ bool changeMeshNames(PyObject *li)
+ {
+ std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
+ return self->changeMeshNames(modifTab);
+ }
+
+ PyObject *getTypesOfFieldAvailable() const
+ {
+ std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
+ PyObject *ret2=PyList_New(ret.size());
+ for(int i=0;i<(int)ret.size();i++)
+ PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
+ return ret2;
+ }
+
+ PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const
+ {
+ std::vector<int> ret1;
+ int ret0=self->getNonEmptyLevels(mname,ret1);
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
+ PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
+ return elt;
+ }
+
+ PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const
+ {
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ std::vector< std::vector<TypeOfField> > typesF;
+ std::vector< std::vector<std::string> > pfls;
+ std::vector< std::vector<std::string> > locs;
+ std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
+ int sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector<TypeOfField>& typesFI=typesF[i];
+ const std::vector<std::string>& pflsI=pfls[i];
+ const std::vector<std::string>& locsI=locs[i];
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
+ int sz2=ret[i].size();
+ PyObject *elt2=PyList_New(sz2);
+ for(int j=0;j<sz2;j++)
+ {
+ PyObject *elt3=PyTuple_New(4);
+ PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
+ 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));
+ PyTuple_SetItem(elt3,1,elt4);
+ PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
+ PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
+ PyList_SetItem(elt2,j,elt3);
+ }
+ PyTuple_SetItem(elt,1,elt2);
+ PyList_SetItem(ret2,i,elt);
+ }
+ return ret2;
+ }
+
+ PyObject *splitComponents() const
+ {
+ std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ PyObject *splitDiscretizations() const
+ {
+ std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ PyObject *splitMultiDiscrPerGeoTypes() const
+ {
+ std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
+ {
+ std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ convertToMapIntDataArrayInt(extractDef,extractDefCpp);
+ return self->extractPart(extractDefCpp,mm);
+ }
+ }
+ };
+
+ class MEDFileField1TS : public MEDFileAnyTypeField1TS
+ {
+ public:
+ static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
+ static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+ static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
+ static MEDFileField1TS *New(DataArrayByte *db);
+ static MEDFileField1TS *New();
+ MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
+ void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf);
+ MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
+ MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
+ MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
+ MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
+ void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
+ %extend
+ {
+ MEDFileField1TS(const std::string& fileName, bool loadAll=true)
+ {
+ return MEDFileField1TS::New(fileName,loadAll);
+ }
+
+ MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
+ {
+ return MEDFileField1TS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
+ {
+ return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
+ }
+
+ MEDFileField1TS(DataArrayByte *db)
+ {
+ return MEDFileField1TS::New(db);
+ }
+
+ MEDFileField1TS()
+ {
+ return MEDFileField1TS::New();
+ }
+
+ void copyTinyInfoFrom(const MEDCouplingFieldDouble *field)
+ {
+ const DataArrayDouble *arr=0;
+ if(field)
+ arr=field->getArray();
+ self->copyTinyInfoFrom(field,arr);
+ }
+
+ std::string __str__() const
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
+ {
+ return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
+ }
+
+ PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const
+ {
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ std::vector< std::vector<TypeOfField> > typesF;
+ std::vector< std::vector<std::string> > pfls;
+ std::vector< std::vector<std::string> > locs;
+ std::vector< std::vector<DataArrayDouble *> > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
+ int sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ const std::vector<DataArrayDouble *>& dadsI=ret[i];
+ const std::vector<TypeOfField>& typesFI=typesF[i];
+ const std::vector<std::string>& pflsI=pfls[i];
+ const std::vector<std::string>& locsI=locs[i];
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
+ int sz2=ret[i].size();
+ PyObject *elt2=PyList_New(sz2);
+ for(int j=0;j<sz2;j++)
+ {
+ PyObject *elt3=PyTuple_New(4);
+ PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
+ PyTuple_SetItem(elt3,1,SWIG_NewPointerObj(SWIG_as_voidptr(dadsI[j]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
+ PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
+ PyList_SetItem(elt2,j,elt3);
+ }
+ PyTuple_SetItem(elt,1,elt2);
+ PyList_SetItem(ret2,i,elt);
+ }
+ return ret2;
+ }
+
+ DataArrayDouble *getUndergroundDataArray() const
+ {
+ DataArrayDouble *ret=self->getUndergroundDataArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getUndergroundDataArrayExt() const
+ {
+ return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
+ }
+ }
+ };
+
+ class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
+ {
+ public:
+ static MEDFileIntField1TS *New();
+ static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
+ static MEDFileIntField1TS *New(DataArrayByte *db);
+ static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+ static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
+ MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
+ void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
+ MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
+ MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
+ MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
+ MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
+ MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
+ MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
+ %extend
+ {
+ MEDFileIntField1TS()
+ {
+ return MEDFileIntField1TS::New();
+ }
+
+ MEDFileIntField1TS(const std::string& fileName, bool loadAll=true)
+ {
+ return MEDFileIntField1TS::New(fileName,loadAll);
+ }
+
+ MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
+ {
+ return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
+ {
+ return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
+ }
+
+ MEDFileIntField1TS(DataArrayByte *db)
+ {
+ return MEDFileIntField1TS::New(db);
+ }
+
+ std::string __str__() const
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
+ {
+ return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
+ }
+
+ DataArrayInt *getUndergroundDataArray() const
+ {
+ DataArrayInt *ret=self->getUndergroundDataArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getUndergroundDataArrayExt() const
+ {
+ return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
+ }
+ }
+ };
+
+ class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
+ {
+ public:
+ static MEDFileFloatField1TS *New();
+ static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true);
+ static MEDFileFloatField1TS *New(DataArrayByte *db);
+ static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+ static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
+ MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
+ void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
+ MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
+ MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
+ MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
+ MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
+ MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
+ MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
+ %extend
+ {
+ MEDFileFloatField1TS()
+ {
+ return MEDFileFloatField1TS::New();
+ }
+
+ MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true)
+ {
+ return MEDFileFloatField1TS::New(fileName,loadAll);
+ }
+
+ MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true)
+ {
+ return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true)
+ {
+ return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
+ }
+
+ MEDFileFloatField1TS(DataArrayByte *db)
+ {
+ return MEDFileFloatField1TS::New(db);
+ }
+
+ std::string __str__() const
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const
+ {
+ return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
+ }
+
+ DataArrayFloat *getUndergroundDataArray() const
+ {
+ DataArrayFloat *ret=self->getUndergroundDataArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getUndergroundDataArrayExt() const
+ {
+ return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
+ }
+ }
+ };
+
+ class MEDFileAnyTypeFieldMultiTSIterator
+ {
+ public:
+ %extend
+ {
+ PyObject *next()
+ {
+ MEDFileAnyTypeField1TS *ret=self->nextt();
+ if(ret)
+ return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
+ else
+ {
+ PyErr_SetString(PyExc_StopIteration,"No more data.");
+ return 0;
+ }
+ }
+ }
+ };
+
+ class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone
+ {
+ public:
+ static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
+ static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+ MEDFileAnyTypeFieldMultiTS *deepCopy() const;
+ virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
+ std::string getName() const;
+ void setName(const std::string& name);
+ std::string getDtUnit() const;
+ void setDtUnit(const std::string& dtUnit);
+ std::string getMeshName() const;
+ void setMeshName(const std::string& newMeshName);
+ const std::vector<std::string>& getInfo() const;
+ bool presenceOfMultiDiscPerGeoType() const;
+ int getNumberOfComponents() const;
+ int getNumberOfTS() const;
+ void eraseEmptyTS();
+ int getPosOfTimeStep(int iteration, int order) const;
+ int getPosGivenTime(double time, double eps=1e-8) const;
+ void loadArrays();
+ void loadArraysIfNecessary();
+ void unloadArrays();
+ void unloadArraysWithoutDataLoss();
+ //
+ virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
+ MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
+ MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
+ void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts);
+ void synchronizeNameScope();
+ MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const;
+ %extend
+ {
+ int __len__() const
+ {
+ return self->getNumberOfTS();
+ }
+
+ int getTimeId(PyObject *elt0) const
+ {
+ if(elt0 && PyInt_Check(elt0))
+ {//fmts[3]
+ int pos=PyInt_AS_LONG(elt0);
+ return pos;
+ }
+ else if(elt0 && PyTuple_Check(elt0))
+ {
+ if(PyTuple_Size(elt0)==2)
+ {
+ PyObject *o0=PyTuple_GetItem(elt0,0);
+ PyObject *o1=PyTuple_GetItem(elt0,1);
+ if(PyInt_Check(o0) && PyInt_Check(o1))
+ {//fmts(1,-1)
+ int iter=PyInt_AS_LONG(o0);
+ int order=PyInt_AS_LONG(o1);
+ return self->getPosOfTimeStep(iter,order);
+ }
+ else
+ 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 !");
+ }
+ else
+ 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 !");
+ }
+ else if(elt0 && PyFloat_Check(elt0))
+ {
+ double val=PyFloat_AS_DOUBLE(elt0);
+ return self->getPosGivenTime(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
+ }
+
+ PyObject *getIterations() const
+ {
+ std::vector< std::pair<int,int> > res(self->getIterations());
+ return convertVecPairIntToPy(res);
+ }
+
+ PyObject *getTimeSteps() const
+ {
+ std::vector<double> ret1;
+ std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
+ std::size_t sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ PyObject *elt=PyTuple_New(3);
+ PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
+ PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
+ PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
+ PyList_SetItem(ret2,i,elt);
+ }
+ return ret2;
+ }
+
+ PyObject *getTypesOfFieldAvailable() const
+ {
+ std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
+ PyObject *ret2=PyList_New(ret.size());
+ for(int i=0;i<(int)ret.size();i++)
+ {
+ const std::vector<TypeOfField>& rett=ret[i];
+ PyObject *ret3=PyList_New(rett.size());
+ for(int j=0;j<(int)rett.size();j++)
+ PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
+ PyList_SetItem(ret2,i,ret3);
+ }
+ return ret2;
+ }
+
+ PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const
+ {
+ std::vector<int> ret1;
+ int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
+ PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
+ return elt;
+ }
+
+ PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const
+ {
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ std::vector< std::vector<TypeOfField> > typesF;
+ std::vector< std::vector<std::string> > pfls;
+ std::vector< std::vector<std::string> > locs;
+ std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
+ int sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector<TypeOfField>& typesFI=typesF[i];
+ const std::vector<std::string>& pflsI=pfls[i];
+ const std::vector<std::string>& locsI=locs[i];
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
+ int sz2=ret[i].size();
+ PyObject *elt2=PyList_New(sz2);
+ for(int j=0;j<sz2;j++)
+ {
+ PyObject *elt3=PyTuple_New(4);
+ PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
+ 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));
+ PyTuple_SetItem(elt3,1,elt4);
+ PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
+ PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
+ PyList_SetItem(elt2,j,elt3);
+ }
+ PyTuple_SetItem(elt,1,elt2);
+ PyList_SetItem(ret2,i,elt);
+ }
+ return ret2;
+ }
+
+ std::vector<int> getTimeIds(PyObject *elts) const
+ {
+ if(PyList_Check(elts))
+ {
+ int sz=PyList_Size(elts);
+ std::vector<int> ret(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *elt=PyList_GetItem(elts,i);
+ ret[i]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
+ }
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret(1);
+ ret[0]=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
+ return ret;
+ }
+ }
+
+ void __delitem__(PyObject *elts)
+ {
+ if(PySlice_Check(elts))
+ {
+ Py_ssize_t strt=2,stp=2,step=2;
+ GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
+ self->eraseTimeStepIds2(strt,stp,step);
+ }
+ else
+ {
+ std::vector<int> idsToRemove=MEDCoupling_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
+ if(!idsToRemove.empty())
+ self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+ }
+ }
+
+ void eraseTimeStepIds(PyObject *li)
+ {
+ int sw;
+ int pos1;
+ std::vector<int> pos2;
+ DataArrayInt *pos3=0;
+ DataArrayIntTuple *pos4=0;
+ convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->eraseTimeStepIds(&pos1,&pos1+1);
+ return;
+ }
+ case 2:
+ {
+ if(pos2.empty())
+ return;
+ self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
+ return ;
+ }
+ case 3:
+ {
+ self->eraseTimeStepIds(pos3->begin(),pos3->end());
+ return ;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
+ }
+ }
+
+ MEDFileAnyTypeFieldMultiTSIterator *__iter__()
+ {
+ return self->iterator();
+ }
+
+ PyObject *__getitem__(PyObject *elt0) const
+ {
+ if(elt0 && PyList_Check(elt0))
+ {
+ int sz=PyList_Size(elt0);
+ MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ int *pt=da->getPointer();
+ for(int i=0;i<sz;i++,pt++)
+ {
+ PyObject *elt1=PyList_GetItem(elt0,i);
+ *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
+ }
+ return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
+ }
+ else if(elt0 && PySlice_Check(elt0))
+ {
+ Py_ssize_t strt=2,stp=2,step=2;
+ GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
+ return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
+ }
+ else
+ return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
+ }
+
+ bool changeMeshNames(PyObject *li)
+ {
+ std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
+ return self->changeMeshNames(modifTab);
+ }
+
+ PyObject *splitComponents() const
+ {
+ std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ PyObject *splitDiscretizations() const
+ {
+ std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ PyObject *splitMultiDiscrPerGeoTypes() const
+ {
+ std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ void pushBackTimeSteps(PyObject *li)
+ {
+ void *argp(0);
+ int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,0|0));
+ if(SWIG_IsOK(status))
+ {
+ self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
+ }
+ else
+ {
+ std::vector<MEDFileAnyTypeField1TS *> tmp;
+ convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
+ self->pushBackTimeSteps(tmp);
+ }
+ }
+
+ MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
+ {
+ std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ convertToMapIntDataArrayInt(extractDef,extractDefCpp);
+ return self->extractPart(extractDefCpp,mm);
+ }
+
+ static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li)
+ {
+ std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
+ convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
+ std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS);
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ std::size_t sz2=ret[i].size();
+ PyObject *ret1Py=PyList_New(sz2);
+ for(std::size_t j=0;j<sz2;j++)
+ {
+ MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
+ if(elt)
+ elt->incrRef();
+ PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
+ }
+ PyList_SetItem(retPy,i,ret1Py);
+ }
+ return retPy;
+ }
+
+ static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh)
+ {
+ std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
+ convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
+ std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
+ std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
+ if(ret2.size()!=ret.size())
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport (PyWrap) : internal error ! Size of 2 vectors must match ! (" << ret.size() << "!=" << ret2.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ std::size_t sz2=ret[i].size();
+ PyObject *ret0Py=PyTuple_New(2);
+ PyObject *ret1Py=PyList_New(sz2);
+ for(std::size_t j=0;j<sz2;j++)
+ {
+ MEDFileAnyTypeFieldMultiTS *elt(ret[i][j]);
+ if(elt)
+ elt->incrRef();
+ PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 ));
+ }
+ PyTuple_SetItem(ret0Py,0,ret1Py);
+ PyTuple_SetItem(ret0Py,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret2[i].retn()),SWIGTYPE_p_MEDCoupling__MEDFileFastCellSupportComparator, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(retPy,i,ret0Py);
+ }
+ return retPy;
+ }
+ }
+ };
+
+ class MEDFileIntFieldMultiTS;
+
+ class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS