X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderCommon.i;h=a0368584d4bc57a67e1ca624370634ca6b0d2edd;hb=aafcf704892f03308a84407e898d9e8b19496a1c;hp=741e4adeab3d3e7c5927878a378f3cf9cf458f41;hpb=9ce755f83045baa31871e61e3f0a919c181d151c;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 741e4adea..a0368584d 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2020 CEA/DEN, EDF R&D +// Copyright (C) 2017-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,6 +42,8 @@ #include "MEDLoaderTypemaps.i" #include "SauvReader.hxx" #include "SauvWriter.hxx" +#include "MeshFormatReader.hxx" +#include "MeshFormatWriter.hxx" using namespace MEDCoupling; %} @@ -183,6 +185,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld; %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray; %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt; +%newobject MEDCoupling::MEDFileFieldMultiTS::Aggregate; %newobject MEDCoupling::MEDFileInt32FieldMultiTS::New; %newobject MEDCoupling::MEDFileInt32FieldMultiTS::field; @@ -227,6 +230,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevelOld; %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray; %newobject MEDCoupling::MEDFileField1TS::convertToInt; +%newobject MEDCoupling::MEDFileField1TS::convertToInt64; %newobject MEDCoupling::MEDFileInt32Field1TS::New; %newobject MEDCoupling::MEDFileInt32Field1TS::field; @@ -309,6 +313,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::SauvReader::New; %newobject MEDCoupling::SauvReader::loadInMEDFileDS; + %newobject MEDCoupling::MEDFileMeshStruct::New; %newobject MEDCoupling::MEDMeshMultiLev::prepare; %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray; @@ -316,6 +321,10 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileFastCellSupportComparator::New; %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport; +%newobject MEDCoupling::MeshFormatReader::loadInMEDFileDS; +%newobject MEDCoupling::MeshFormatReader::MeshFormatReader; +%newobject MEDCoupling::MeshFormatWriter::MeshFormatWriter; + %feature("unref") MEDFileMesh "$this->decrRef();" %feature("unref") MEDFileUMesh "$this->decrRef();" %feature("unref") MEDFileCMesh "$this->decrRef();" @@ -445,7 +454,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,1,b.retn()); return ret.retn(); } - + MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName) { MCAuto ret(MEDCoupling::ReadField(fileName)); @@ -457,13 +466,13 @@ namespace MEDCoupling MCAuto ret(MEDCoupling::ReadField(fileName,fieldName)); return ret.retn(); } - + MEDCoupling::MEDCouplingField *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order) { MCAuto ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order)); return ret.retn(); } - + MEDCoupling::MEDCouplingField *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MCAuto ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order)); @@ -484,7 +493,7 @@ namespace MEDCoupling } return ret; } - + PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName) { std::vector< std::pair< std::pair, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName); @@ -500,7 +509,7 @@ namespace MEDCoupling } return ret; } - + PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { std::vector< std::pair > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName); @@ -574,7 +583,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes)); return ret; } - + PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, PyObject *liIts) { @@ -582,28 +591,28 @@ namespace MEDCoupling std::vector res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its); return convertFieldDoubleVecToPy(res); } - + void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) { std::vector v; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch); } - + void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) { std::vector v; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch); } - + void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch) { std::vector v; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch); } - + PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName); @@ -613,7 +622,7 @@ namespace MEDCoupling PyList_SetItem(ret,i,PyInt_FromLong((int)v[i])); return ret; } - + MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) { std::vector grps; @@ -640,7 +649,7 @@ namespace MEDCoupling int getZipConnPolicy(); void setZipConnPolicy(int newVal); }; - + class MEDFileWritableStandAlone : public MEDFileWritable { public: @@ -666,7 +675,7 @@ namespace MEDCoupling } } }; - + class MEDFileMeshReadSelector { public: @@ -698,7 +707,7 @@ namespace MEDCoupling self->reprAll(oss); return oss.str(); } - + std::string __repr__() const { std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ")."; @@ -751,7 +760,7 @@ namespace MEDCoupling { return self->simpleRepr(); } - + DataArrayIdType *getCorrespondence() const { const DataArrayIdType *ret(self->getCorrespondence()); @@ -775,6 +784,7 @@ namespace MEDCoupling void setIteration(int it); int getIteration() const; void pushCorrespondence(MEDFileJointCorrespondence* correspondence); + void clearCorrespondences(); int getNumberOfCorrespondences() const; void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const; std::string simpleRepr() const; @@ -794,7 +804,7 @@ namespace MEDCoupling { return self->simpleRepr(); } - + MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const { MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i)); @@ -839,7 +849,7 @@ namespace MEDCoupling { return MEDFileJoint::New(); } - + MEDFileJoint(const std::string& fileName, const std::string& mName, int num) { return MEDFileJoint::New(fileName,mName,num); @@ -854,7 +864,7 @@ namespace MEDCoupling { return self->simpleRepr(); } - + MEDFileJointOneStep *getStepAtPos(int i) const { MEDFileJointOneStep *ret(self->getStepAtPos(i)); @@ -891,7 +901,7 @@ namespace MEDCoupling { return MEDFileJoints::New(); } - + MEDFileJoints(const std::string& fileName, const std::string& meshName) { return MEDFileJoints::New(fileName,meshName); @@ -940,7 +950,7 @@ namespace MEDCoupling } } }; - + class MEDFileEquivalenceBase : public RefCountObject, public MEDFileWritableStandAlone { private: @@ -987,7 +997,7 @@ namespace MEDCoupling if(ret) ret->incrRef(); return ret; } - + PyObject *getTypes() const { std::vector result(self->getTypes()); @@ -1025,14 +1035,14 @@ namespace MEDCoupling if(ret) ret->incrRef(); return ret; } - + MEDFileEquivalenceCell *getCell() { MEDFileEquivalenceCell *ret(self->getCell()); if(ret) ret->incrRef(); return ret; } - + MEDFileEquivalenceNode *getNode() { MEDFileEquivalenceNode *ret(self->getNode()); @@ -1041,7 +1051,7 @@ namespace MEDCoupling } } }; - + class MEDFileEquivalences : public RefCountObject, public MEDFileWritableStandAlone { private: @@ -1261,7 +1271,7 @@ namespace MEDCoupling convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt",grps); self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum); } - + PyObject *areFamsEqual(const MEDFileMesh *other) const { std::string what; @@ -1337,7 +1347,7 @@ namespace MEDCoupling tmp->incrRef(); return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } - + PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const { const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt); @@ -1355,7 +1365,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,1,SWIG_From_bool(ret1)); return ret; } - + PyObject *unPolyze() { DataArrayIdType *ret3=0; @@ -1450,7 +1460,7 @@ namespace MEDCoupling 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); @@ -1630,7 +1640,7 @@ namespace MEDCoupling std::vector< std::pair > ret(self->getAllDistributionOfTypes()); return convertVecPairIntToPy(ret); } - + DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const { std::map > extractDefCpp; @@ -1658,7 +1668,7 @@ namespace MEDCoupling convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",ms); self->setGroupsFromScratch(meshDimRelToMax,ms,renum); } - + void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) { std::vector ms; @@ -1692,7 +1702,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - + MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt)); @@ -1762,7 +1772,7 @@ namespace MEDCoupling { return MEDFileCMesh::New(db); } - + PyObject *getMesh() const { const MEDCouplingCMesh *tmp=self->getMesh(); @@ -1804,7 +1814,7 @@ namespace MEDCoupling { return MEDFileCurveLinearMesh::New(db); } - + PyObject *getMesh() const { const MEDCouplingCurveLinearMesh *tmp=self->getMesh(); @@ -1826,7 +1836,7 @@ namespace MEDCoupling void setOneTimeStep(MEDFileMesh *mesh1TimeStep); void cartesianizeMe(); %extend - { + { MEDFileMeshMultiTS() { return MEDFileMeshMultiTS::New(); @@ -1943,7 +1953,7 @@ namespace MEDCoupling { return self->getNumberOfMeshes(); } - + MEDFileMesh *getMeshAtPos(int i) const { MEDFileMesh *ret=self->getMeshAtPos(i); @@ -2038,7 +2048,7 @@ namespace MEDCoupling 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); @@ -2046,7 +2056,7 @@ namespace MEDCoupling loc->incrRef(); return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_MEDCoupling__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 ); } - + PyObject *zipPflsNames() { std::vector< std::pair, std::string > > ret=self->zipPflsNames(); @@ -2088,7 +2098,7 @@ namespace MEDCoupling std::vector< std::pair, std::string > > v=convertVecPairVecStFromPy(li); self->changeLocsRefsNamesGen(v); } - + void changeLocsNamesInStruct(PyObject *li) { std::vector< std::pair, std::string > > v=convertVecPairVecStFromPy(li); @@ -2182,7 +2192,7 @@ namespace MEDCoupling { 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); @@ -2193,7 +2203,7 @@ namespace MEDCoupling std::vector< std::pair > modifTab=convertVecPairStStFromPy(li); return self->changeMeshNames(modifTab); } - + PyObject *getTypesOfFieldAvailable() const { std::vector ret=self->getTypesOfFieldAvailable(); @@ -2296,6 +2306,7 @@ namespace MEDCoupling static MEDFileField1TS *New(DataArrayByte *db); static MEDFileField1TS *New(); MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const; + MEDCoupling::MEDFileInt64Field1TS *convertToInt64(bool isDeepCpyGlobs=true) const; void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf); MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const; MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; @@ -2315,7 +2326,7 @@ namespace MEDCoupling { return MEDFileField1TS::New(fileName,loadAll); } - + MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) { return MEDFileField1TS::New(fileName,fieldName,loadAll); @@ -2335,7 +2346,7 @@ namespace MEDCoupling { return MEDFileField1TS::New(); } - + void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) { const DataArrayDouble *arr=0; @@ -2343,12 +2354,12 @@ namespace MEDCoupling 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(self,type,meshDimRelToMax,mesh); @@ -2459,7 +2470,7 @@ namespace MEDCoupling { return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); } - + DataArrayInt32 *getUndergroundDataArray() const { DataArrayInt32 *ret=self->getUndergroundDataArray(); @@ -2531,7 +2542,7 @@ namespace MEDCoupling { return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); } - + DataArrayInt64 *getUndergroundDataArray() const { DataArrayInt64 *ret=self->getUndergroundDataArray(); @@ -2603,7 +2614,7 @@ namespace MEDCoupling { return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); } - + DataArrayFloat *getUndergroundDataArray() const { DataArrayFloat *ret=self->getUndergroundDataArray(); @@ -2611,7 +2622,7 @@ namespace MEDCoupling ret->incrRef(); return ret; } - + PyObject *getUndergroundDataArrayExt() const { return MEDFileField1TS_getUndergroundDataArrayExt(self); @@ -2709,13 +2720,13 @@ namespace MEDCoupling 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 > res(self->getIterations()); return convertVecPairIntToPy(res); } - + PyObject *getTimeSteps() const { std::vector ret1; @@ -2732,7 +2743,7 @@ namespace MEDCoupling } return ret2; } - + PyObject *getTypesOfFieldAvailable() const { std::vector< std::vector > ret=self->getTypesOfFieldAvailable(); @@ -2747,7 +2758,7 @@ namespace MEDCoupling } return ret2; } - + PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const { std::vector ret1; @@ -2757,7 +2768,7 @@ namespace MEDCoupling PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1)); return elt; } - + PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const { std::vector types; @@ -2813,7 +2824,7 @@ namespace MEDCoupling return ret; } } - + void __delitem__(PyObject *elts) { if(PySlice_Check(elts)) @@ -2829,7 +2840,7 @@ namespace MEDCoupling self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size()); } } - + void eraseTimeStepIds(PyObject *li) { mcIdType sw; @@ -2972,7 +2983,7 @@ namespace MEDCoupling } return retPy; } - + static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh) { std::vector vectFMTS; @@ -3009,7 +3020,7 @@ namespace MEDCoupling class MEDFileInt32FieldMultiTS; class MEDFileInt64FieldMultiTS; - + class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS { public: @@ -3030,6 +3041,17 @@ namespace MEDCoupling MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; %extend { + static MEDFileAnyTypeFieldMultiTS *Aggregate(PyObject *fmtssPy, PyObject *dtsPy) + { + std::vector fmtss; + convertFromPyObjVectorOfObj(fmtssPy,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",fmtss); + std::vector< std::vector< std::pair > > dts2; + convertPyToVectorVectorPairInt(dtsPy,dts2); + std::vector< std::vector< std::pair > > dts(MEDVectorVectorMIIterator(0,dts2),MEDVectorVectorMIIterator(dts2.size(),dts2)); + MCAuto ret = MEDFileFieldMultiTS::Aggregate(fmtss,dts); + return ret.retn(); + } + MEDFileFieldMultiTS() { return MEDFileFieldMultiTS::New(); @@ -3044,7 +3066,7 @@ namespace MEDCoupling { return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll); } - + MEDFileFieldMultiTS(DataArrayByte *db) { return MEDFileFieldMultiTS::New(db); @@ -3062,7 +3084,7 @@ namespace MEDCoupling } return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll); } - + std::string __str__() const { return self->simpleRepr(); @@ -3118,7 +3140,7 @@ namespace MEDCoupling ret->incrRef(); return ret; } - + PyObject *getUndergroundDataArrayExt(int iteration, int order) const { std::vector< std::pair,std::pair > > elt1Cpp; @@ -3190,12 +3212,12 @@ namespace MEDCoupling { return MEDFileInt32FieldMultiTS::New(); } - + MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true) { return MEDFileInt32FieldMultiTS::New(fileName,loadAll); } - + MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) { return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll); @@ -3205,7 +3227,7 @@ namespace MEDCoupling { return MEDFileInt32FieldMultiTS::New(db); } - + static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) { std::vector > tmp(convertTimePairIdsFromPy(entities)); @@ -3261,12 +3283,12 @@ namespace MEDCoupling { return MEDFileInt64FieldMultiTS::New(); } - + MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true) { return MEDFileInt64FieldMultiTS::New(fileName,loadAll); } - + MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) { return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll); @@ -3276,7 +3298,7 @@ namespace MEDCoupling { return MEDFileInt64FieldMultiTS::New(db); } - + static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) { std::vector > tmp(convertTimePairIdsFromPy(entities)); @@ -3332,12 +3354,12 @@ namespace MEDCoupling { return MEDFileFloatFieldMultiTS::New(); } - + MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true) { return MEDFileFloatFieldMultiTS::New(fileName,loadAll); } - + MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) { return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll); @@ -3347,7 +3369,7 @@ namespace MEDCoupling { return MEDFileFloatFieldMultiTS::New(db); } - + static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) { std::vector > tmp(convertTimePairIdsFromPy(entities)); @@ -3379,7 +3401,7 @@ namespace MEDCoupling } } }; - + class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone { public: @@ -3397,7 +3419,7 @@ namespace MEDCoupling } } }; - + class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone { public: @@ -3461,12 +3483,12 @@ namespace MEDCoupling { return MEDFileFields::NewAdv(fileName,loadAll,entities); } - + std::string __str__() const { return self->simpleRepr(); } - + MEDFileFields *partOfThisOnStructureElements() const { MCAuto ret(self->partOfThisOnStructureElements()); @@ -3478,7 +3500,7 @@ namespace MEDCoupling MCAuto ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName)); return ret.retn(); } - + static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true) { std::vector > tmp(convertTimePairIdsFromPy(entities)); @@ -3530,7 +3552,7 @@ namespace MEDCoupling std::vector< std::pair > ts=convertTimePairIdsFromPy(timeSteps); return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts); } - + PyObject *__getitem__(PyObject *obj) { if(obj && PyList_Check(obj)) @@ -3564,7 +3586,7 @@ namespace MEDCoupling { return self->iterator(); } - + bool changeMeshNames(PyObject *li) { std::vector< std::pair > modifTab=convertVecPairStStFromPy(li); @@ -3582,7 +3604,7 @@ namespace MEDCoupling } return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg)); } - + std::vector getPosOfFields(PyObject *elts) const { if(PyList_Check(elts)) @@ -3610,7 +3632,7 @@ namespace MEDCoupling convertFromPyObjVectorOfObj(fields,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp); self->pushFields(tmp); } - + void __delitem__(PyObject *elts) { if(elts && PySlice_Check(elts)) @@ -3697,7 +3719,7 @@ namespace MEDCoupling { return MEDFileParameterDouble1TS::New(); } - + MEDFileParameterDouble1TS(const std::string& fileName) { return MEDFileParameterDouble1TS::New(fileName); @@ -3754,7 +3776,7 @@ namespace MEDCoupling { return MEDFileParameterMultiTS::New(); } - + MEDFileParameterMultiTS(const std::string& fileName) { return MEDFileParameterMultiTS::New(fileName); @@ -3769,7 +3791,7 @@ namespace MEDCoupling { return self->simpleRepr(); } - + PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const { std::string what; @@ -3781,7 +3803,7 @@ namespace MEDCoupling PyList_SetItem(res,1,PyString_FromString(what.c_str())); return res; } - + void eraseTimeStepIds(PyObject *ids) { mcIdType sw; @@ -3883,7 +3905,7 @@ namespace MEDCoupling if(!idsToRemove.empty()) self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size()); } - + MEDFileParameter1TS *getTimeStepAtPos(int posId) const { MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId); @@ -3947,7 +3969,7 @@ namespace MEDCoupling { return MEDFileParameters::New(); } - + MEDFileParameters(const std::string& fileName) { return MEDFileParameters::New(fileName); @@ -3957,7 +3979,7 @@ namespace MEDCoupling { return MEDFileParameters::New(db); } - + std::string __str__() const { return self->simpleRepr(); @@ -3983,7 +4005,7 @@ namespace MEDCoupling { return self->getNumberOfParams(); } - + MEDFileParameterMultiTS *getParamAtPos(int i) const { MEDFileParameterMultiTS *ret=self->getParamAtPos(i); @@ -3999,7 +4021,7 @@ namespace MEDCoupling ret->incrRef(); return ret; } - + PyObject *isEqual(const MEDFileParameters *other, double eps) const { std::string what; @@ -4126,7 +4148,7 @@ namespace MEDCoupling } } }; - + /////////////// class MEDFileMeshStruct; @@ -4144,7 +4166,7 @@ namespace MEDCoupling protected: ~MEDFileMeshStruct(); }; - + class MEDMeshMultiLev : public RefCountObject { public: @@ -4181,7 +4203,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,1,ret1Py); return ret; } - + PyObject *retrieveFamilyIdsOnNodes() const { DataArrayIdType *famIds(0); @@ -4328,6 +4350,32 @@ namespace MEDCoupling } } }; + + class MeshFormatReader + { + public: + MeshFormatReader(const std::string& meshFileName, const std::vector& fieldFileName); + MeshFormatReader(); + MEDFileData* loadInMedFileDS(); + void setMeshName(const std::string& theMeshName); + std::string getMeshName() const; + void setFile(const std::string& theFileName); + void setFieldFileNames(const std::vector& theFieldFileNames); + std::vector getFieldFileNames() const; + }; + class MeshFormatWriter + { + public: + MeshFormatWriter(const std::string& meshFileName, const std::vector& fieldFileNames); + MeshFormatWriter(); + void setMeshFileName(const std::string& meshFileName); + std::string getMeshFileName() const; + void setFieldFileNames(const std::vector& fieldFileNames); + std::vector getFieldFileNames() const; + void setMEDFileDS(MEDCoupling::MEDFileData* mfd); + void write(); + }; + } %pythoncode %{