add missing FType in special ranges

This commit is contained in:
Christian Zimmermann 2019-02-06 14:11:17 +01:00
parent 811054f14f
commit 8db40f0610
7 changed files with 19 additions and 15 deletions

View file

@ -65,22 +65,22 @@ namespace MultiArrayTools
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()... ) ) )
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) )
{
auto mi = getIndex( mkGenMapR( f, indices->range()... ) );
auto mi = getIndex( mkGenMapR<STYPE>( f, indices->range()... ) );
(*mi)(indices...);
return mi;
}
template <class Func, class... RangeTypes>
auto mkMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
auto mkMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) )
{
return mkGenMapR<SpaceType::ANY>(f, ranges... );
}
template <class Func, class... IndexTypes>
auto mkMapI(const Func& f, std::shared_ptr<IndexTypes>... indices)
auto mkMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) )
{
return mkGenMapI<SpaceType::ANY>(f, indices... );

View file

@ -28,20 +28,20 @@ namespace MultiArrayTools
-> std::shared_ptr<MultiRange<RangeTypes...> >;
template <SpaceType STYPE, class Func, class... RangeTypes>
auto mkGenMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
auto mkGenMapR(const std::shared_ptr<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)
auto mkGenMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) );
template <class Func, class... RangeTypes>
auto mkMapR(const Func& f, std::shared_ptr<RangeTypes>... ranges)
auto mkMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) );
template <class Func, class... IndexTypes>
auto mkMapI(const Func& f, std::shared_ptr<IndexTypes>... indices)
auto mkMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) );
template <class... IndexTypes>

View file

@ -1,6 +1,6 @@
#include "map_range.h"
#include <type_traits>
//#include <type_traits>
namespace MultiArrayTools
{
@ -398,8 +398,8 @@ namespace MultiArrayTools
template <class MapF, class ORType>
static void mk(std::shared_ptr<ORType>& outRange, MultiArray<size_t,ORType>& mapMult, const MapF& mapf)
{
static_assert( std::is_same<size_t,typename MapF::value_type>::value,
"out range value type for NONE must be size_t" );
//static_assert( std::is_same<size_t,typename MapF::value_type>::value,
// "out range value type for NONE must be size_t" );
size_t max = 0;
for(auto ii = mapf.begin(); ii.max() != ii.pos(); ++ii) {
max = mapf[ii] > max ? mapf[ii]+1 : max;
@ -529,7 +529,7 @@ namespace MultiArrayTools
template <class MapF, SpaceType XSTYPE, class... Ranges>
typename GenMapRange<MapF,XSTYPE,Ranges...>::IndexType GenMapRange<MapF,XSTYPE,Ranges...>::begin() const
{
MapIndex<MapF,typename Ranges::IndexType...>
GenMapIndex<MapF,XSTYPE,typename Ranges::IndexType...>
i( std::dynamic_pointer_cast<GenMapRange<MapF,XSTYPE,Ranges...> >
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
i = 0;
@ -539,7 +539,7 @@ namespace MultiArrayTools
template <class MapF, SpaceType XSTYPE, class... Ranges>
typename GenMapRange<MapF,XSTYPE,Ranges...>::IndexType GenMapRange<MapF,XSTYPE,Ranges...>::end() const
{
MapIndex<MapF,typename Ranges::IndexType...>
GenMapIndex<MapF,XSTYPE,typename Ranges::IndexType...>
i( std::dynamic_pointer_cast<GenMapRange<MapF,XSTYPE,Ranges...> >
( std::shared_ptr<RangeBase>( RB::mThis )) );
i = size();

View file

@ -34,7 +34,8 @@ namespace MultiArrayTools
typedef typename RangeInterface<SingleIndex<size_t,SpaceType::NONE> >::IndexType IndexType;
typedef SingleRange<size_t,SpaceType::NONE> RangeType;
typedef size_t MetaType;
typedef SingleRangeFactory<size_t,SpaceType::NONE> FType;
virtual size_t size() const final;
virtual size_t dim() const final;

View file

@ -41,6 +41,7 @@ namespace MultiArrayTools
typedef typename RangeInterface<SingleIndex<size_t,SpaceType::NUL> >::IndexType IndexType;
typedef SingleRange<size_t,SpaceType::NUL> RangeType;
typedef size_t MetaType;
typedef SingleRangeFactory<size_t,SpaceType::NUL> FType;
virtual size_t size() const final;
virtual size_t dim() const final;

View file

@ -33,6 +33,7 @@ namespace MultiArrayTools
typedef typename RangeInterface<SingleIndex<int,SpaceType::PSPACE> >::IndexType IndexType;
typedef SingleRange<int,SpaceType::PSPACE> RangeType;
typedef int MetaType;
typedef SingleRangeFactory<int,SpaceType::PSPACE> FType;
virtual size_t size() const final;
virtual size_t dim() const final;

View file

@ -34,7 +34,8 @@ namespace MultiArrayTools
typedef typename RangeInterface<SingleIndex<size_t,SpaceType::SPIN> >::IndexType IndexType;
typedef SingleRange<size_t,SpaceType::SPIN> RangeType;
typedef size_t MetaType;
typedef SingleRangeFactory<size_t,SpaceType::SPIN> FType;
virtual size_t size() const final;
virtual size_t dim() const final;