From: Anthony Geay Date: Thu, 31 Jan 2019 13:43:46 +0000 (+0100) Subject: Prepare int64 management - example 2 X-Git-Tag: V9_3_0a1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8d3cc43453fc3ffe4e0d3b28dce5c2a0587086a;p=tools%2Fmedcoupling.git Prepare int64 management - example 2 --- diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx index ad0764591..2bb14a2f5 100644 --- a/src/MEDCoupling/MCType.hxx +++ b/src/MEDCoupling/MCType.hxx @@ -28,6 +28,8 @@ namespace MEDCoupling using Int64 = std::int64_t; using Int32 = std::int32_t; using mcIdType = std::int32_t; + + inline mcIdType ToIdType(std::size_t val) { return mcIdType(val); } } #define DataArrayInt DataArrayInt32 diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 6ff8d9cf5..714f8d34f 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -4450,17 +4450,17 @@ DataArrayIntIterator *DataArrayInt::iterator() * \throw If \a this->getNumberOfComponents() != 1. * \sa DataArrayInt::findIdsEqualTuple */ -DataArrayInt *DataArrayInt::findIdsEqual(int val) const +DataArrayIdType *DataArrayInt::findIdsEqual(int val) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); const int *cptr(getConstPointer()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); std::size_t nbOfTuples(getNumberOfTuples()); for(std::size_t i=0;ipushBackSilent(i); + ret->pushBackSilent(ToIdType(i)); return ret.retn(); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 56e0e9329..f1a8fe036 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -599,7 +599,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool hasUniqueValues() const; MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt32 *a, const std::vector& compoIds); MEDCOUPLING_EXPORT DataArrayInt32Iterator *iterator(); - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqual(int val) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(int val) const; MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqual(int val) const; MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualList(const int *valsBg, const int *valsEnd) const; MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqualList(const int *valsBg, const int *valsEnd) const;