WIP: rank op (concept)

This commit is contained in:
Christian Zimmermann 2024-03-26 00:36:29 +01:00
parent 6a433b237e
commit c972a9db52
2 changed files with 9 additions and 10 deletions

View file

@ -14,17 +14,13 @@ namespace CNORXZ
template <class PosT> template <class PosT>
constexpr decltype(auto) CROpRoot<T,IndexT>::operator()(const PosT& pos) const constexpr decltype(auto) CROpRoot<T,IndexT>::operator()(const PosT& pos) const
{ {
const SizeT L = mIndex->lmax().val(); return (mData+mPos[pos.val()])[pos.next().val()];
const SizeT m = mIndex->myrank();
const SizeT dst = ( m + pos.val() ) % L;
const SizeT src = ( m - pos.val() + L ) % L;
} }
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr decltype(auto) CROpRoot<T,IndexT>::operator()() const constexpr decltype(auto) CROpRoot<T,IndexT>::operator()() const
{ {
return (mData+mPos[0])[0];
} }
template <typename T, class IndexT> template <typename T, class IndexT>

View file

@ -20,7 +20,7 @@ namespace CNORXZ
class CROpRoot : public COpInterface<CROpRoot<T,IndexT>> class CROpRoot : public COpInterface<CROpRoot<T,IndexT>>
{ {
public: public:
typedef COpInterface<CROpRoot<T,IndexT>> OI; typedef COpInterface<CROpRoot<T,IndexT >> OI;
constexpr CROpRoot() = default; constexpr CROpRoot() = default;
@ -33,8 +33,11 @@ namespace CNORXZ
constexpr decltype(auto) rootSteps(const IndexId<I>& id) const; constexpr decltype(auto) rootSteps(const IndexId<I>& id) const;
private: private:
const T* mData; //
COpRoot const T* mData; // must include all needed data, also that of other ranks (to be transmitted before!)
// maps the global (!) position to mData!!
const SizeT* mPos; // position map (needed to indicate position to data transmitted from other ranks)
Sptr<IndexT> mIndex;
}; };
template <typename T, class IndexT> template <typename T, class IndexT>