im com; TODO: rootSteps, mkOpExpr
This commit is contained in:
parent
ec844f5b68
commit
87a699a445
3 changed files with 24 additions and 27 deletions
|
@ -108,7 +108,7 @@ namespace MultiArrayTools
|
||||||
inline void operator()(size_t start = 0);
|
inline void operator()(size_t start = 0);
|
||||||
inline void operator()(size_t start, ExtType last);
|
inline void operator()(size_t start, ExtType last);
|
||||||
|
|
||||||
auto rootSteps(std::intptr_t iPtrNum = 0) -> ExtType;
|
auto rootSteps(std::intptr_t iPtrNum = 0) const -> ExtType;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
const Block<T>& get() const;
|
const Block<T>& get() const;
|
||||||
|
|
||||||
template <class ET, size_t SITE>
|
template <class ET>
|
||||||
inline const T& get(const ET& pos) const;
|
inline const T& get(const ET& pos) const;
|
||||||
|
|
||||||
std::vector<BTSS> block(const IndexInfo* blockIndex, bool init = false) const;
|
std::vector<BTSS> block(const IndexInfo* blockIndex, bool init = false) const;
|
||||||
|
@ -218,10 +218,10 @@ namespace MultiArrayTools
|
||||||
const MBlock<T>& get() const;
|
const MBlock<T>& get() const;
|
||||||
MBlock<T>& get();
|
MBlock<T>& get();
|
||||||
|
|
||||||
template <class ET, size_t SITE>
|
template <class ET>
|
||||||
inline const T& get(const ET& pos) const;
|
inline const T& get(const ET& pos) const;
|
||||||
|
|
||||||
template <class ET, size_t SITE>
|
template <class ET>
|
||||||
inline T& get(const ET& pos);
|
inline T& get(const ET& pos);
|
||||||
|
|
||||||
OperationRoot& set(const IndexInfo* blockIndex);
|
OperationRoot& set(const IndexInfo* blockIndex);
|
||||||
|
@ -363,7 +363,7 @@ namespace MultiArrayTools
|
||||||
-> decltype(mOp.rootSteps(iPtrNum));
|
-> decltype(mOp.rootSteps(iPtrNum));
|
||||||
|
|
||||||
template <class Expr>
|
template <class Expr>
|
||||||
auto loop(Expr&& exp) const -> decltype(mInd->iforh(exp))&&;
|
auto loop(Expr exp) const -> decltype(mInd->iforh(exp));
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ namespace MultiArrayTools
|
||||||
template <typename T, class OpClass, class... Ranges>
|
template <typename T, class OpClass, class... Ranges>
|
||||||
typename OperationMaster<T,OpClass,Ranges...>::AssignmentExpr::ExtType
|
typename OperationMaster<T,OpClass,Ranges...>::AssignmentExpr::ExtType
|
||||||
OperationMaster<T,OpClass,Ranges...>::AssignmentExpr::
|
OperationMaster<T,OpClass,Ranges...>::AssignmentExpr::
|
||||||
rootSteps(std::intptr_t iPtrNum)
|
rootSteps(std::intptr_t iPtrNum) const
|
||||||
{
|
{
|
||||||
return mSec.rootSteps(iPtrNum);
|
return mSec.rootSteps(iPtrNum);
|
||||||
}
|
}
|
||||||
|
@ -650,10 +650,10 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
template <class ET, size_t SITE>
|
template <class ET>
|
||||||
inline const T& ConstOperationRoot<T,Ranges...>::get(const ET& pos) const
|
inline const T& ConstOperationRoot<T,Ranges...>::get(const ET& pos) const
|
||||||
{
|
{
|
||||||
return mData[std::get<SITE>(pos)];
|
return mData[pos.val()];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
|
@ -739,17 +739,17 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
template <class ET, size_t SITE>
|
template <class ET>
|
||||||
inline const T& OperationRoot<T,Ranges...>::get(const ET& pos) const
|
inline const T& OperationRoot<T,Ranges...>::get(const ET& pos) const
|
||||||
{
|
{
|
||||||
return mData[std::get<SITE>( pos )];
|
return mData[pos.val()];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
template <class ET, size_t SITE>
|
template <class ET>
|
||||||
inline T& OperationRoot<T,Ranges...>::get(const ET& pos)
|
inline T& OperationRoot<T,Ranges...>::get(const ET& pos)
|
||||||
{
|
{
|
||||||
return mData[std::get<SITE>( pos )];
|
return mData[pos.val()];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include "base_def.h"
|
#include "base_def.h"
|
||||||
|
#include "xfor/exttype.h"
|
||||||
|
|
||||||
namespace MultiArrayHelper
|
namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
|
@ -67,14 +68,12 @@ namespace MultiArrayHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
// call with -2 (instead of -1)
|
// call with -2 (instead of -1)
|
||||||
template <typename T, class ETuple, class OpTuple, class OpFunction, size_t START>
|
template <typename T, class ETuple, class OpTuple, class OpFunction, typename... Args>
|
||||||
static T mkOpExpr(const ETuple& pos, const OpTuple& ops)
|
static inline T mkOpExpr(const ETuple& pos, const OpTuple& ops, const Args&... args)
|
||||||
{
|
{
|
||||||
typedef typename std::tuple_element<N,OpTuple>::type SubOpTypeRef;
|
|
||||||
typedef typename std::remove_reference<SubOpTypeRef>::type SubOpType;
|
return PackNum<N-1>::template mkOpExpr<ETuple,OpTuple,OpFunction,decltype(std::get<N>(ops)),Args...>
|
||||||
static const size_t NEXT = START - SubOpType::SIZE;
|
( pos, ops, std::get<N>(ops).get(Getter<>::template get<ETuple>( pos )), args...);
|
||||||
return OpFunction::apply( std::get<N+1>(ops).template get<ETuple,START>(pos),
|
|
||||||
PackNum<N-1>::template mkOpExpr<ETuple,OpTuple,OpFunction,NEXT>(pos, ops) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class OpTuple, class Expr>
|
template <class OpTuple, class Expr>
|
||||||
|
@ -138,11 +137,9 @@ namespace MultiArrayHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class ETuple, class OpTuple, class OpFunction, size_t START>
|
template <typename T, class ETuple, class OpTuple, class OpFunction, size_t START>
|
||||||
static T mkOpExpr(const ETuple& pos, const OpTuple& ops)
|
static inline T mkOpExpr(const ETuple& pos, const OpTuple& ops)
|
||||||
{
|
{
|
||||||
typedef typename std::tuple_element<1,OpTuple>::type SubOpTypeRef;
|
static constexpr size_t NEXT = START - SubOpType::SIZE;
|
||||||
typedef typename std::remove_reference<SubOpTypeRef>::type SubOpType;
|
|
||||||
static const size_t NEXT = START - SubOpType::SIZE;
|
|
||||||
return OpFunction::apply( std::get<1>(ops).template get<ETuple,START>(pos),
|
return OpFunction::apply( std::get<1>(ops).template get<ETuple,START>(pos),
|
||||||
std::get<0>(ops).template get<ETuple,NEXT>(pos) );
|
std::get<0>(ops).template get<ETuple,NEXT>(pos) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
namespace XFOR
|
namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class X>
|
template <class X>
|
||||||
|
@ -102,13 +102,13 @@ namespace XFOR
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace XFOR
|
} // end namespace MultiArrayHelper
|
||||||
|
|
||||||
/* ========================= *
|
/* ========================= *
|
||||||
* --- TEMPLATE CODE --- *
|
* --- TEMPLATE CODE --- *
|
||||||
* ========================= */
|
* ========================= */
|
||||||
|
|
||||||
namespace XFOR
|
namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class X>
|
template <class X>
|
||||||
|
@ -172,7 +172,7 @@ namespace XFOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end namespace XFOR
|
} // end namespace MultiArrayHelper
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue