extend helper tools according to last commit
This commit is contained in:
parent
3ccc5277e3
commit
811054f14f
3 changed files with 39 additions and 16 deletions
|
@ -45,31 +45,45 @@ namespace MultiArrayTools
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Func, class... RangeTypes>
|
template <SpaceType STYPE, class Func, class... RangeTypes>
|
||||||
auto mkMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
|
auto mkGenMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> std::shared_ptr<MapRange<FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...>,
|
-> std::shared_ptr<GenMapRange<FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...>,
|
||||||
RangeTypes...> >
|
STYPE,RangeTypes...> >
|
||||||
{
|
{
|
||||||
typedef FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...> FMA;
|
typedef FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...> FMA;
|
||||||
std::shared_ptr<MapRangeFactory<FMA,RangeTypes...>> mrfptr;
|
std::shared_ptr<GenMapRangeFactory<FMA,STYPE,RangeTypes...>> mrfptr;
|
||||||
if(Func::FISSTATIC){
|
if(Func::FISSTATIC){
|
||||||
FMA fma(ranges...);
|
FMA fma(ranges...);
|
||||||
mrfptr = std::make_shared<MapRangeFactory<FMA,RangeTypes...> >( fma, ranges... );
|
mrfptr = std::make_shared<GenMapRangeFactory<FMA,STYPE,RangeTypes...> >( fma, ranges... );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FMA fma(ranges...,f);
|
FMA fma(ranges...,f);
|
||||||
mrfptr = std::make_shared<MapRangeFactory<FMA,RangeTypes...> >( fma, ranges... );
|
mrfptr = std::make_shared<GenMapRangeFactory<FMA,STYPE,RangeTypes...> >( fma, ranges... );
|
||||||
}
|
}
|
||||||
return std::dynamic_pointer_cast<MapRange<FMA,RangeTypes...> >( mrfptr->create() );
|
return std::dynamic_pointer_cast<GenMapRange<FMA,STYPE,RangeTypes...> >( mrfptr->create() );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <SpaceType STYPE, class Func, class... IndexTypes>
|
||||||
|
auto mkGenMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
|
-> decltype( getIndex( mkGenMapR( f, indices->range()... ) ) )
|
||||||
|
{
|
||||||
|
auto mi = getIndex( mkGenMapR( f, indices->range()... ) );
|
||||||
|
(*mi)(indices...);
|
||||||
|
return mi;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Func, class... RangeTypes>
|
||||||
|
auto mkMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
|
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) )
|
||||||
|
{
|
||||||
|
return mkGenMapR<SpaceType::ANY>(f, ranges... );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Func, class... IndexTypes>
|
template <class Func, class... IndexTypes>
|
||||||
auto mkMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
|
auto mkMapI(const Func& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
-> decltype( getIndex( mkMapR( f, indices->range()... ) ) )
|
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) )
|
||||||
{
|
{
|
||||||
auto mi = getIndex( mkMapR( f, indices->range()... ) );
|
return mkGenMapI<SpaceType::ANY>(f, indices... );
|
||||||
(*mi)(indices...);
|
|
||||||
return mi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... RangeTypes>
|
template <class... RangeTypes>
|
||||||
|
|
|
@ -27,14 +27,22 @@ namespace MultiArrayTools
|
||||||
auto mkMulti(std::shared_ptr<RangeTypes>... ranges)
|
auto mkMulti(std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> std::shared_ptr<MultiRange<RangeTypes...> >;
|
-> std::shared_ptr<MultiRange<RangeTypes...> >;
|
||||||
|
|
||||||
|
template <SpaceType STYPE, class Func, class... RangeTypes>
|
||||||
|
auto mkGenMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
|
-> std::shared_ptr<GenMapRange<FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...>,
|
||||||
|
STYPE,RangeTypes...> >;
|
||||||
|
|
||||||
|
template <SpaceType STYPE, class Func, class... IndexTypes>
|
||||||
|
auto mkGenMapI(const Func& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
|
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) );
|
||||||
|
|
||||||
template <class Func, class... RangeTypes>
|
template <class Func, class... RangeTypes>
|
||||||
auto mkMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
|
auto mkMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> std::shared_ptr<MapRange<FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...>,
|
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) );
|
||||||
RangeTypes...> >;
|
|
||||||
|
|
||||||
template <class Func, class... IndexTypes>
|
template <class Func, class... IndexTypes>
|
||||||
auto mkMapI(const Func& f, std::shared_ptr<IndexTypes>... indices)
|
auto mkMapI(const Func& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
-> decltype( getIndex( mkMapR( f, indices->range()... ) ) );
|
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) );
|
||||||
|
|
||||||
template <class... IndexTypes>
|
template <class... IndexTypes>
|
||||||
auto mkMIndex(std::shared_ptr<IndexTypes>... indices)
|
auto mkMIndex(std::shared_ptr<IndexTypes>... indices)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "map_range.h"
|
#include "map_range.h"
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace MultiArrayTools
|
namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue