DUNE-ACFEM (unstable)

Some additional utitliy functions for tuple-likes and integer-sequences. More...

Modules

 SequenceElementAccess
 Random access to sequence elements.
 
 SequenceAccumulate
 Accumulate over all elements of a sequence using functors.
 
 SequenceFilter
 Create sub-sequences by filtering out elements of a given sequence.
 
 Loops
 
 SequenceGenerators
 Generate integer sequences.
 
 SequenceTransform
 Apply transformation functors to given integer sequences.
 
 SequenceMask
 Bit-mask and strictly monotone sequences and conversion utilities.
 
 SubTuple
 Generating sub- and super-tuples and related stuff.
 

Classes

struct  Dune::ACFem::CanPromoteTupleTypes< T, SFINAE >
 
struct  Dune::ACFem::CanPromoteTupleTypes< T, std::enable_if_t< sizeof(TupleScalarPromotionType< T >) >=0 >
 TrueType if the type of the tuple T can be promoted to another type. More...
 

Typedefs

template<class... T>
using Dune::ACFem::IsIntegralPack = decltype(isIntegralPack(std::declval< T >()...))
 Decide whether the given parameter pack contains only integral types.
 
template<class T >
using Dune::ACFem::IsIntegralTuple = decltype(isIntegralTuple(std::declval< T >()))
 Decide whether the given tuple contains only integral types.
 
template<class Tuple , template< class... > class Predicate, class... Rest>
using Dune::ACFem::PredicateMatch = PredicateMatchHelper< std::decay_t< Tuple >, PredicateProxy< Predicate, Rest... >::template ForwardFirst >
 Apply the predicate to each tuple type in turn. More...
 
template<template< class... > class Predicate, class... T>
using Dune::ACFem::IndexOfMatching = IndexConstant< PredicateMatch< std::tuple< T... >, Predicate >::index_ >
 Obtain the index of the first matching tuple type.
 
template<template< class... > class Predicate, class... T>
using Dune::ACFem::AnyIs = BoolConstant<(...||Predicate< T >::value)>
 TrueType if any type matches the predicate.
 
template<template< class... > class Predicate, class... T>
using Dune::ACFem::AllAre = BoolConstant<(... &&Predicate< T >::value)>
 TrueType if all types match the predicate.
 
template<std::size_t N, template< class... > class Predicate, class... T>
using Dune::ACFem::NthIs = Predicate< TypePackElement< N, T... > >
 Instantiates to Predicate applied to the N-th element of T...
 
template<class Permutation >
using Dune::ACFem::InversePermutation = typename SortSequence< Permutation >::Permutation
 Compute the inverse of the given permutation.
 
template<class Permutation , std::size_t N>
using Dune::ACFem::ResizedPermutation = typename ResizedPermutationHelper< Permutation, N >::Type
 Pad or truncate the permuation at the given size.
 
template<class Sequence , class Perm >
using Dune::ACFem::PermuteSequenceValues = typename PermuteSequenceValuesHelper< Perm, Sequence >::Type
 Apply the given permutation to the values of the given sequence.
 
template<class Sequence , class Perm >
using Dune::ACFem::PermuteSequence = std::decay_t< decltype(permute(Sequence{}, Perm{}))>
 Apply the given permutation to the positions of the given sequence.
 
template<std::size_t I0, std::size_t I1, std::size_t N = I1 + 1>
using Dune::ACFem::Transposition = typename TranspositionHelper< I0, I1, N >::Type
 Generate the transposition of I0 and I1 as permutation. More...
 
template<class Seq0 , class Seq1 , std::size_t N = Head<Seq1>::value+Seq1::size()>
using Dune::ACFem::BlockTransposition = typename BlockTranspositionHelper< Seq0, Seq1, N >::Type
 Generate the block-transposition of the I0 and the I1-block as permutation. More...
 
template<class Tuple >
using Dune::ACFem::TupleScalarPromotionType = typename ScalarTupleTypePromotionHelper< Tuple, MakeSequenceFor< Tuple > >::Type
 Generate the type resulting from summing up all tuple elements.
 

Functions

template<class T , T T0, T... Ts>
constexpr bool Dune::ACFem::isConstant (Sequence< T, T0, Ts... >)
 
template<class T >
constexpr bool Dune::ACFem::isConstant (Sequence< T >)
 Mark one element and empty sequences as pairwise equal.
 
template<class T , T I, T... Rest>
constexpr bool Dune::ACFem::isConsecutive (Sequence< T, I, Rest... > seq)
 
template<class T >
constexpr bool Dune::ACFem::isConsecutive (Sequence< T >)
 
template<template< std::size_t, std::size_t > class DoSwap, class T , T... Ts>
constexpr bool Dune::ACFem::isSorted (Sequence< T, Ts... >)
 
template<class T , T... Ts>
constexpr bool Dune::ACFem::isSorted (Sequence< T, Ts... > seq)
 
template<class T , T... V>
constexpr bool Dune::ACFem::isSimple (Sequence< T, V... > seq)
 
template<std::size_t Align, class T , T V0, T... V>
constexpr bool Dune::ACFem::isAlignedBlock (Sequence< T, V0, V... >, IndexConstant< Align >=IndexConstant< Align >{})
 
template<std::size_t... Ind>
constexpr bool Dune::ACFem::isPermutation (IndexSequence< Ind... >=IndexSequence< Ind... >{})
 
template<class... T>
constexpr auto Dune::ACFem::isIntegralPack (T &&...)
 Decide whether the given parameter pack contains only integral types.
 
template<class T , std::size_t N>
constexpr auto Dune::ACFem::isIntegralTuple (const std::array< T, N > &)
 Decide whether the given tuple contains only integral types.
 
template<class T1 , class T2 >
constexpr auto Dune::ACFem::isIntegralTuple (const std::pair< T1, T2 > &)
 Decide whether the given tuple contains only integral types.
 
template<class... T>
constexpr auto Dune::ACFem::isIntegralTuple (const std::tuple< T... > &)
 Decide whether the given tuple contains only integral types.
 
template<class Tuple , std::enable_if_t< IsTupleLike< Tuple >::value, int > = 0>
constexpr bool Dune::ACFem::isConstant (Tuple &&t)
 true if all elements of the tuple compare equal.
 
template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::pushBackIf (Tuple &&t, E &&e, PredicateWrapper< F >=PredicateWrapper< F >{})
 Enforce kind of uniqueness. More...
 
template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&!PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::pushBackUnless (Tuple &&t, E &&e, PredicateWrapper< F >=PredicateWrapper< F >{})
 Enforce kind of uniqueness. More...
 
template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::addFrontIf (Tuple &&t, E &&e, PredicateWrapper< F >=PredicateWrapper< F >{})
 Enforce kind of uniqueness. More...
 
template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&!PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::addFrontUnless (Tuple &&t, E &&e, PredicateWrapper< F >=PredicateWrapper< F >{})
 Enforce kind of uniqueness. More...
 
template<template< class... > class F, class T , class... Arg, std::enable_if_t<(!IsAlwaysTrue< F >::value &&IsTupleLike< T >::value &&sizeof...(Arg)==1 &&size< decltype(joinIfHelper< 0, F >(std::declval< T >(), std::declval< Arg >()...))>() > size< T >()), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::joinIf (T &&t, Arg &&... arg)
 Add the elements of Arg... More...
 
template<template< class... > class F, class T , class... Arg, std::enable_if_t<(!IsAlwaysTrue< F >::value &&IsTupleLike< T >::value &&sizeof...(Arg)==1 &&size< decltype(joinIfHelper< 0, F >(std::declval< T >(), std::declval< Arg >()...))>()==size< T >()), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::joinIf (T &&t, Arg &&...)
 Version of joinIf() which avoids runtime computations if it is clear that nothing is added.
 
template<template< class... > class F, class T , class... Arg, std::enable_if_t<(!IsAlwaysFalse< F >::value &&IsTupleLike< T >::value &&sizeof...(Arg)==1 &&size< decltype(joinUnlessHelper< 0, F >(std::declval< T >(), std::declval< Arg >()...))>() > size< T >()), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::joinUnless (T &&t, Arg &&... arg)
 Add the elements of Arg... More...
 
template<template< class... > class F, class T , class... Arg, std::enable_if_t<(!IsAlwaysFalse< F >::value &&IsTupleLike< T >::value &&sizeof...(Arg)==1 &&size< decltype(joinUnlessHelper< 0, F >(std::declval< T >(), std::declval< Arg >()...))>()==size< T >()), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::joinUnless (T &&t, Arg &&...)
 Version of joinUnless() which avoids runtime computations if it is clear that nothing is added.
 
template<std::size_t... Ps, class Seq , std::enable_if_t< IsSequence< Seq >::value, int > = 0>
constexpr auto Dune::ACFem::permute (Seq, IndexSequence< Ps... >=IndexSequence< Ps... >{})
 Permute the given sequence.
 
template<std::size_t... Ps, class T , std::enable_if_t< IsTupleLike< T >::value &&!isSimple(IndexSequence< Ps... >{}), int > = 0>
constexpr auto Dune::ACFem::permute (T &&t, IndexSequence< Ps... >=IndexSequence< Ps... >{})
 Permute the given tuple like.
 
template<class T , T... I, std::size_t... P, std::enable_if_t< sizeof...(I)==sizeof...(P), int > = 0>
constexpr auto Dune::ACFem::isInvariant (Sequence< T, I... >, IndexSequence< P... >)
 Return true if applying the given permutation to the value positions leaves the sequence invariant.
 
template<class T , T... Ind>
auto Dune::ACFem::toArray (Sequence< T, Ind... >)
 Convert a compile-time constant integer sequence to a rutime-object with the same values.
 
template<class T , class Tuple , std::enable_if_t< IsTupleLike< Tuple >::value, int > = 0>
auto Dune::ACFem::toArray (Tuple &&t)
 Convert tuples and pairs to arrays.
 
template<class Tuple , std::enable_if_t<(IsTupleLike< Tuple >::value &&CanPromoteTupleTypes< Tuple >::value), int > = 0>
auto Dune::ACFem::toArray (Tuple &&t)
 Convert tuples and pairs to arrays.
 
template<class T , T I0>
auto Dune::ACFem::toString (Sequence< T, I0 >)
 Generate a compact string representation as a comma separated list of the values, without spaces.
 
template<class T , T I0, T I1, T... Rest>
auto Dune::ACFem::toString (Sequence< T, I0, I1, Rest... >)
 Generate a compact string representation as a comma separated list of the values, without spaces.
 
template<class T >
auto Dune::ACFem::toString (Sequence< T >)
 

Variables

template<class Seq , class Perm >
constexpr bool Dune::ACFem::HasInvariantValuesV = std::is_same<Seq, PermuteSequenceValues<Seq, Perm> >::value
 Evaluate to true if applying the permutation Perm to the values of Seq leaves the values invariant.
 

Detailed Description

Some additional utitliy functions for tuple-likes and integer-sequences.

Typedef Documentation

◆ BlockTransposition

template<class Seq0 , class Seq1 , std::size_t N = Head<Seq1>::value+Seq1::size()>
using Dune::ACFem::BlockTransposition = typedef typename BlockTranspositionHelper<Seq0, Seq1, N>::Type

Generate the block-transposition of the I0 and the I1-block as permutation.

Passing I0 > I1 will result in undefined behaviour.

◆ PredicateMatch

template<class Tuple , template< class... > class Predicate, class... Rest>
using Dune::ACFem::PredicateMatch = typedef PredicateMatchHelper<std::decay_t<Tuple>, PredicateProxy<Predicate, Rest...>::template ForwardFirst>

Apply the predicate to each tuple type in turn.

Derive from TrueType if any type matches, otherwise derive from FalseType.

◆ Transposition

template<std::size_t I0, std::size_t I1, std::size_t N = I1 + 1>
using Dune::ACFem::Transposition = typedef typename TranspositionHelper<I0, I1, N>::Type

Generate the transposition of I0 and I1 as permutation.

Passing I0 > I1 will result in undefined behaviour.

Function Documentation

◆ addFrontIf()

template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::addFrontIf ( Tuple &&  t,
E &&  e,
PredicateWrapper< F >  = PredicateWrapper<F>{} 
)
constexpr

Enforce kind of uniqueness.

If we do not have a match then just forward the given tuple.

The effort, however, is linear in the tuple size for adding a single element.

◆ addFrontUnless()

template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&!PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::addFrontUnless ( Tuple &&  t,
E &&  e,
PredicateWrapper< F >  = PredicateWrapper<F>{} 
)
constexpr

Enforce kind of uniqueness.

If we do not have a match then just forward the given tuple.

The effort, however, is linear in the tuple size for adding a single element.

◆ isAlignedBlock()

template<std::size_t Align, class T , T V0, T... V>
constexpr bool Dune::ACFem::isAlignedBlock ( Sequence< T, V0, V... >  ,
IndexConstant< Align >  = IndexConstant<Align>{} 
)
constexpr
Returns
true if the given sequence is consecutive and start aligned to Align.

◆ isConsecutive() [1/2]

template<class T >
constexpr bool Dune::ACFem::isConsecutive ( Sequence< T >  )
constexpr
Returns
true if the sequence is a consecutive sequence without holes.

◆ isConsecutive() [2/2]

template<class T , T I, T... Rest>
constexpr bool Dune::ACFem::isConsecutive ( Sequence< T, I, Rest... >  seq)
constexpr
Returns
true if the sequence is a consecutive sequence without holes.

◆ isConstant()

template<class T , T T0, T... Ts>
constexpr bool Dune::ACFem::isConstant ( Sequence< T, T0, Ts... >  )
constexpr
Returns
true if given non-empty sequence is constant, i.e. all value ares equal to each other.

Referenced by Dune::ACFem::Tensor::BlockEye< BlockRank, Seq< Dimensions... >, Field >::operator()(), and Dune::ACFem::Tensor::Eye< Seq< Dimensions... >, Field >::operator()().

◆ isPermutation()

template<std::size_t... Ind>
constexpr bool Dune::ACFem::isPermutation ( IndexSequence< Ind... >  = IndexSequence<Ind...>{})
constexpr
Returns
true if the sequence is a permutation of the sequence <0, 1, 2, ...>.

◆ isSimple()

template<class T , T... V>
constexpr bool Dune::ACFem::isSimple ( Sequence< T, V... >  seq)
constexpr
Returns
true for a simple consecutive sequence starting at 0.

◆ isSorted() [1/2]

template<class T , T... Ts>
constexpr bool Dune::ACFem::isSorted ( Sequence< T, Ts... >  seq)
constexpr
Returns
true if the sequence is sorted.

◆ isSorted() [2/2]

template<template< std::size_t, std::size_t > class DoSwap, class T , T... Ts>
constexpr bool Dune::ACFem::isSorted ( Sequence< T, Ts... >  )
constexpr
Returns
true if the sequence is sorted.

◆ joinIf()

template<template< class... > class F, class T , class... Arg, std::enable_if_t<(!IsAlwaysTrue< F >::value &&IsTupleLike< T >::value &&sizeof...(Arg)==1 &&size< decltype(joinIfHelper< 0, F >(std::declval< T >(), std::declval< Arg >()...))>() > size< T >()), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::joinIf ( T &&  t,
Arg &&...  arg 
)
constexpr

Add the elements of Arg...

in turn to T if the predicate F matches.

◆ joinUnless()

template<template< class... > class F, class T , class... Arg, std::enable_if_t<(!IsAlwaysFalse< F >::value &&IsTupleLike< T >::value &&sizeof...(Arg)==1 &&size< decltype(joinUnlessHelper< 0, F >(std::declval< T >(), std::declval< Arg >()...))>() > size< T >()), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::joinUnless ( T &&  t,
Arg &&...  arg 
)
constexpr

Add the elements of Arg...

in turn to T if the predicate F matches.

◆ pushBackIf()

template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::pushBackIf ( Tuple &&  t,
E &&  e,
PredicateWrapper< F >  = PredicateWrapper<F>{} 
)
constexpr

Enforce kind of uniqueness.

If we do not have a match then just forward the given tuple.

The effort, however, is linear in the tuple size for adding a single element. F is instantiated with the types of the elements of t as first argument and the type E as second argument.

◆ pushBackUnless()

template<template< class... > class F, class Tuple , class E , std::enable_if_t<(IsTupleLike< Tuple >::value &&!PredicateMatch< Tuple, PredicateProxy< F, E >::template ForwardFirst >::value), int > = 0>
constexpr auto Dune::ACFem::TupleUtilities::pushBackUnless ( Tuple &&  t,
E &&  e,
PredicateWrapper< F >  = PredicateWrapper<F>{} 
)
constexpr

Enforce kind of uniqueness.

If we do not have a match then just forward the given tuple.

The effort, however, is linear in the tuple size for adding a single element. F is instantiated with the types of the elements of t as first argument and the type E as second argument.

◆ toString()

template<class T >
auto Dune::ACFem::toString ( Sequence< T >  )

Special case: empty sequence yields an empty string.

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 14, 22:29, 2024)