bug fix in resolve Range type routines + some clean up

This commit is contained in:
Christian Zimmermann 2018-07-19 21:27:09 +02:00
parent c043008217
commit 3c72dc98a0
3 changed files with 11 additions and 9 deletions

View file

@ -66,6 +66,7 @@ namespace MultiArrayTools
virtual size_t size() const override;
virtual size_t dim() const override;
size_t anonymousDim() const;
size_t get(size_t pos) const;
size_t getMeta(size_t metaPos) const;
@ -129,6 +130,7 @@ namespace MultiArrayTools
void AnonymousRangeFactory::append(std::shared_ptr<Range> r)
{
if(mProductCreated){
mProd = std::shared_ptr<oType>( new AnonymousRange( *std::dynamic_pointer_cast<oType>(mProd) ) );
mProductCreated = false;
}
@ -153,7 +155,9 @@ namespace MultiArrayHelper
size_t origpos, size_t size)
{
AnonymousRangeFactory arf;
//VCHECK(size);
for(size_t op = origpos; op != origpos + size; ++op){
//VCHECK(op);
arf.append(orig[op]);
}
rp = std::dynamic_pointer_cast<AnonymousRange>( arf.create() );
@ -180,7 +184,6 @@ namespace MultiArrayTools
SingleRange<size_t,SpaceType::ANON>::SingleRange(const std::tuple<std::shared_ptr<RangeTypes>...>& origs) :
RangeInterface<AnonymousIndex>()
{
mOrig.resize(sizeof...(RangeTypes));
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( origs, mOrig );
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( origs );
}
@ -190,7 +193,6 @@ namespace MultiArrayTools
RangeInterface<AnonymousIndex>()
{
auto rst = std::make_tuple(origs...);
//mOrig.resize(sizeof...(RangeTypes));
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( rst, mOrig );
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( rst );
}

View file

@ -90,7 +90,6 @@ namespace MultiArrayHelper
std::intptr_t idxPtrNum)
{
auto& siPtr = std::get<N>(ip);
//VCHECK(siPtr.id());
if(reinterpret_cast<std::intptr_t>(siPtr.get()) == idxPtrNum){
return RPackNum<N-1>::pp(ip, bs, idxPtrNum);
}
@ -277,9 +276,7 @@ namespace MultiArrayHelper
const auto& ni = ii.template get<N>();
const size_t max = ni.max();
const size_t tmp = getStepSize(ni, j);
//VCHECK(tmp);
ss += tmp * sx;
//VCHECK(ss);
sx *= max;
RPackNum<N-1>::getStepSizeX(ii, j, ss, sx);
}
@ -480,9 +477,7 @@ namespace MultiArrayHelper
const auto& ni = ii.template get<0>();
const size_t max = ni.max();
const size_t tmp = getStepSize(ni, j);
//VCHECK(tmp);
ss += tmp * sx;
//VCHECK(ss);
sx *= max;
}

View file

@ -77,6 +77,11 @@ namespace MultiArrayTools
return 1;
}
size_t AnonymousRange::anonymousDim() const
{
return mOrig.size();
}
typename AnonymousRange::IndexType AnonymousRange::begin() const
{
AnonymousIndex i