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
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)
return false;
}
+bool MEDFileStaticEntities::areAllStaticPresentAndNoDyn() const
+{
+ return false;
+}
+
//////////////
return true;
}
+bool MEDFileAllStaticEntites::areAllStaticPresentAndNoDyn() const
+{
+ return true;
+}
+
//////////////
MEDFileAllStaticEntitiesPlusDyn::MEDFileAllStaticEntitiesPlusDyn(const MEDFileStructureElements *se):_se(se)
return true;
}
+bool MEDFileAllStaticEntitiesPlusDyn::areAllStaticPresentAndNoDyn() const
+{
+ return false;
+}
+
const MEDFileStructureElement *MEDFileAllStaticEntitiesPlusDyn::getWithGT(int idGT) const
{
return _se->getWithGT(idGT);
static MEDFileEntities *BuildFrom(const MEDFileStructureElements& se);
virtual std::vector<int> getDynGTAvail() const = 0;
virtual bool areAllStaticTypesPresent() const = 0;
+ virtual bool areAllStaticPresentAndNoDyn() const = 0;
virtual ~MEDFileEntities();
};
const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& getEntries() const { return _entities; }
std::vector<int> getDynGTAvail() const;
bool areAllStaticTypesPresent() const;
+ bool areAllStaticPresentAndNoDyn() const override;
private:
std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > _entities;
};
MEDFileAllStaticEntites() { }
std::vector<int> getDynGTAvail() const;
bool areAllStaticTypesPresent() const;
+ bool areAllStaticPresentAndNoDyn() const override;
};
class MEDLOADER_EXPORT MEDFileAllStaticEntitiesPlusDyn : public MEDFileEntities
MEDFileAllStaticEntitiesPlusDyn(const MEDFileStructureElements *se);
std::vector<int> getDynGTAvail() const;
bool areAllStaticTypesPresent() const;
+ bool areAllStaticPresentAndNoDyn() const override;
const MEDFileStructureElement *getWithGT(int idGT) const;
const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
private:
INTERP_KERNEL::AutoCppPtr<MEDFileEntities> 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<med_entity_type> types(new med_entity_type[nentitype]);