This commit is contained in:
Christian Zimmermann 2024-04-03 23:53:53 +02:00
parent 2fddb42e6c
commit 7db80fd255
4 changed files with 8 additions and 13 deletions

View file

@ -142,7 +142,7 @@ namespace CNORXZ
template <class Index, typename Meta>
UPos XIndex<Index,Meta>::stepSize(const IndexId<0>& id) const
{
return mI->stepSize(id);
return UPos(mI->stepSize(id).val());
}
template <class Index, typename Meta>

View file

@ -205,7 +205,7 @@ namespace CNORXZ
template <SizeT I>
decltype(auto) RIndex<IndexI,IndexK>::stepSize(const IndexId<I>& id) const
{
return getRankStepSize(id) * mI->pmax() + mI->stepSize(id);
return getRankStepSize(id);
}
template <class IndexI, class IndexK>

View file

@ -168,27 +168,23 @@ namespace CNORXZ
decltype(auto) getRankStepSize(const IndexId<I>& id) const
{
auto ss = mI->stepSize(id);
FPos x;
VCHECK(typeid(ss).name());
VCHECK(typeid(x).name());
assert(0);
if constexpr(std::is_same<decltype(ss),FPos>::value){
assert(0);
if(mRankMap.count(id.id()) != 0){
return FPos(ss.val(), mRankMap[id.id()].data());
return FPos(ss.val(), mRankMap[id.id()].data(), ss.max(), ss.max2());
}
else {
Vector<SizeT> mp(ss.max());
const SizeT b = mI->pmax().val() / ss.val();
for(SizeT i = 0; i != mp.size(); ++i){
//max2 = num ranks in this dir (preliminary solution)!!!
mp[i] = ( ss.map()[i] / ss.max() ) % ss.max2();
mp[i] = ( ( ss.map()[i] / ss.max() ) % ss.max2() ) * b + ss.map()[i];
}
mRankMap[id.id()] = mp;
return FPos(ss.val(), mp.data());
return FPos(ss.val(), mp.data(), ss.max(), ss.max2());
}
}
else {
return SPos<0> {};
return ss;
}
}
};

View file

@ -74,7 +74,6 @@ namespace
decltype(auto) stepSize(const IndexId<I>& id) const
{
// TODO: new Pos Type!!!
//assert(0);
return FPos( mI->stepSize(id).val(), mMap.data(), mI->lmax().val(), mR->lmax().val() );
}