From 6f46251b7c7f1db9cd9eed9a085b4deb686d6572 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 12 Mar 2020 11:27:59 +0100 Subject: [PATCH] MED4.1 is ready --- src/MEDCoupling_Swig/MEDCouplingMemArray.i | 6 ++++-- src/MEDLoader/MEDFileEntities.cxx | 15 +++++++++++++++ src/MEDLoader/MEDFileEntities.hxx | 4 ++++ src/MEDLoader/MEDFileFieldMultiTS.cxx | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 4c988d334..6d7020b4b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -674,7 +674,8 @@ typedef DataArrayInt64 DataArrayIdType; GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !"); mcIdType a,b; DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b); - return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step)); + AutoPyPtr ap(PyInt_FromLong(a)),bp(PyInt_FromLong(b)),stepp(PyInt_FromLong(step)); + return PySlice_New(ap,bp,stepp); } PyObject *getSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices) const @@ -685,7 +686,8 @@ typedef DataArrayInt64 DataArrayIdType; GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !"); mcIdType a,b; DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b); - return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step)); + AutoPyPtr ap(PyInt_FromLong(a)),bp(PyInt_FromLong(b)),stepp(PyInt_FromLong(step)); + return PySlice_New(ap,bp,stepp); } static mcIdType GetNumberOfItemGivenBES(PyObject *slic) diff --git a/src/MEDLoader/MEDFileEntities.cxx b/src/MEDLoader/MEDFileEntities.cxx index b6e96938c..dd8398d34 100644 --- a/src/MEDLoader/MEDFileEntities.cxx +++ b/src/MEDLoader/MEDFileEntities.cxx @@ -54,6 +54,11 @@ bool MEDFileStaticEntities::areAllStaticTypesPresent() const return false; } +bool MEDFileStaticEntities::areAllStaticPresentAndNoDyn() const +{ + return false; +} + ////////////// @@ -67,6 +72,11 @@ bool MEDFileAllStaticEntites::areAllStaticTypesPresent() const return true; } +bool MEDFileAllStaticEntites::areAllStaticPresentAndNoDyn() const +{ + return true; +} + ////////////// MEDFileAllStaticEntitiesPlusDyn::MEDFileAllStaticEntitiesPlusDyn(const MEDFileStructureElements *se):_se(se) @@ -85,6 +95,11 @@ bool MEDFileAllStaticEntitiesPlusDyn::areAllStaticTypesPresent() const return true; } +bool MEDFileAllStaticEntitiesPlusDyn::areAllStaticPresentAndNoDyn() const +{ + return false; +} + const MEDFileStructureElement *MEDFileAllStaticEntitiesPlusDyn::getWithGT(int idGT) const { return _se->getWithGT(idGT); diff --git a/src/MEDLoader/MEDFileEntities.hxx b/src/MEDLoader/MEDFileEntities.hxx index 7b7bcbcfc..6192660da 100644 --- a/src/MEDLoader/MEDFileEntities.hxx +++ b/src/MEDLoader/MEDFileEntities.hxx @@ -37,6 +37,7 @@ namespace MEDCoupling static MEDFileEntities *BuildFrom(const MEDFileStructureElements& se); virtual std::vector getDynGTAvail() const = 0; virtual bool areAllStaticTypesPresent() const = 0; + virtual bool areAllStaticPresentAndNoDyn() const = 0; virtual ~MEDFileEntities(); }; @@ -47,6 +48,7 @@ namespace MEDCoupling const std::vector< std::pair >& getEntries() const { return _entities; } std::vector getDynGTAvail() const; bool areAllStaticTypesPresent() const; + bool areAllStaticPresentAndNoDyn() const override; private: std::vector< std::pair > _entities; }; @@ -57,6 +59,7 @@ namespace MEDCoupling MEDFileAllStaticEntites() { } std::vector getDynGTAvail() const; bool areAllStaticTypesPresent() const; + bool areAllStaticPresentAndNoDyn() const override; }; class MEDLOADER_EXPORT MEDFileAllStaticEntitiesPlusDyn : public MEDFileEntities @@ -65,6 +68,7 @@ namespace MEDCoupling MEDFileAllStaticEntitiesPlusDyn(const MEDFileStructureElements *se); std::vector getDynGTAvail() const; bool areAllStaticTypesPresent() const; + bool areAllStaticPresentAndNoDyn() const override; const MEDFileStructureElement *getWithGT(int idGT) const; const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; private: diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 087f8cd85..00c118f74 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -490,7 +490,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR INTERP_KERNEL::AutoCppPtr entitiesFast; const MEDFileEntities *entitiesForSubInstances(entities); MEDFileCapability mfcap(fid); - if(!entities && mfcap.isFastReader()) + if( ( !entities || entities->areAllStaticPresentAndNoDyn() ) && mfcap.isFastReader()) {// no entities int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT)); INTERP_KERNEL::AutoPtr types(new med_entity_type[nentitype]); -- 2.39.2