bug fix in resolve Range type routines + some clean up
This commit is contained in:
parent
c043008217
commit
3c72dc98a0
3 changed files with 11 additions and 9 deletions
|
@ -66,6 +66,7 @@ namespace MultiArrayTools
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
virtual size_t dim() const override;
|
virtual size_t dim() const override;
|
||||||
|
|
||||||
|
size_t anonymousDim() const;
|
||||||
size_t get(size_t pos) const;
|
size_t get(size_t pos) const;
|
||||||
size_t getMeta(size_t metaPos) const;
|
size_t getMeta(size_t metaPos) const;
|
||||||
|
|
||||||
|
@ -129,6 +130,7 @@ namespace MultiArrayTools
|
||||||
void AnonymousRangeFactory::append(std::shared_ptr<Range> r)
|
void AnonymousRangeFactory::append(std::shared_ptr<Range> r)
|
||||||
{
|
{
|
||||||
if(mProductCreated){
|
if(mProductCreated){
|
||||||
|
|
||||||
mProd = std::shared_ptr<oType>( new AnonymousRange( *std::dynamic_pointer_cast<oType>(mProd) ) );
|
mProd = std::shared_ptr<oType>( new AnonymousRange( *std::dynamic_pointer_cast<oType>(mProd) ) );
|
||||||
mProductCreated = false;
|
mProductCreated = false;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +155,9 @@ namespace MultiArrayHelper
|
||||||
size_t origpos, size_t size)
|
size_t origpos, size_t size)
|
||||||
{
|
{
|
||||||
AnonymousRangeFactory arf;
|
AnonymousRangeFactory arf;
|
||||||
|
//VCHECK(size);
|
||||||
for(size_t op = origpos; op != origpos + size; ++op){
|
for(size_t op = origpos; op != origpos + size; ++op){
|
||||||
|
//VCHECK(op);
|
||||||
arf.append(orig[op]);
|
arf.append(orig[op]);
|
||||||
}
|
}
|
||||||
rp = std::dynamic_pointer_cast<AnonymousRange>( arf.create() );
|
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) :
|
SingleRange<size_t,SpaceType::ANON>::SingleRange(const std::tuple<std::shared_ptr<RangeTypes>...>& origs) :
|
||||||
RangeInterface<AnonymousIndex>()
|
RangeInterface<AnonymousIndex>()
|
||||||
{
|
{
|
||||||
mOrig.resize(sizeof...(RangeTypes));
|
|
||||||
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( origs, mOrig );
|
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( origs, mOrig );
|
||||||
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( origs );
|
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( origs );
|
||||||
}
|
}
|
||||||
|
@ -190,7 +193,6 @@ namespace MultiArrayTools
|
||||||
RangeInterface<AnonymousIndex>()
|
RangeInterface<AnonymousIndex>()
|
||||||
{
|
{
|
||||||
auto rst = std::make_tuple(origs...);
|
auto rst = std::make_tuple(origs...);
|
||||||
//mOrig.resize(sizeof...(RangeTypes));
|
|
||||||
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( rst, mOrig );
|
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( rst, mOrig );
|
||||||
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( rst );
|
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( rst );
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,6 @@ namespace MultiArrayHelper
|
||||||
std::intptr_t idxPtrNum)
|
std::intptr_t idxPtrNum)
|
||||||
{
|
{
|
||||||
auto& siPtr = std::get<N>(ip);
|
auto& siPtr = std::get<N>(ip);
|
||||||
//VCHECK(siPtr.id());
|
|
||||||
if(reinterpret_cast<std::intptr_t>(siPtr.get()) == idxPtrNum){
|
if(reinterpret_cast<std::intptr_t>(siPtr.get()) == idxPtrNum){
|
||||||
return RPackNum<N-1>::pp(ip, bs, idxPtrNum);
|
return RPackNum<N-1>::pp(ip, bs, idxPtrNum);
|
||||||
}
|
}
|
||||||
|
@ -277,9 +276,7 @@ namespace MultiArrayHelper
|
||||||
const auto& ni = ii.template get<N>();
|
const auto& ni = ii.template get<N>();
|
||||||
const size_t max = ni.max();
|
const size_t max = ni.max();
|
||||||
const size_t tmp = getStepSize(ni, j);
|
const size_t tmp = getStepSize(ni, j);
|
||||||
//VCHECK(tmp);
|
|
||||||
ss += tmp * sx;
|
ss += tmp * sx;
|
||||||
//VCHECK(ss);
|
|
||||||
sx *= max;
|
sx *= max;
|
||||||
RPackNum<N-1>::getStepSizeX(ii, j, ss, sx);
|
RPackNum<N-1>::getStepSizeX(ii, j, ss, sx);
|
||||||
}
|
}
|
||||||
|
@ -480,9 +477,7 @@ namespace MultiArrayHelper
|
||||||
const auto& ni = ii.template get<0>();
|
const auto& ni = ii.template get<0>();
|
||||||
const size_t max = ni.max();
|
const size_t max = ni.max();
|
||||||
const size_t tmp = getStepSize(ni, j);
|
const size_t tmp = getStepSize(ni, j);
|
||||||
//VCHECK(tmp);
|
|
||||||
ss += tmp * sx;
|
ss += tmp * sx;
|
||||||
//VCHECK(ss);
|
|
||||||
sx *= max;
|
sx *= max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,11 @@ namespace MultiArrayTools
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t AnonymousRange::anonymousDim() const
|
||||||
|
{
|
||||||
|
return mOrig.size();
|
||||||
|
}
|
||||||
|
|
||||||
typename AnonymousRange::IndexType AnonymousRange::begin() const
|
typename AnonymousRange::IndexType AnonymousRange::begin() const
|
||||||
{
|
{
|
||||||
AnonymousIndex i
|
AnonymousIndex i
|
||||||
|
|
Loading…
Reference in a new issue