1#warning LOOKS LIKE AN UNUSED HEADER THAT WILL BE REMOVE - IF YOU SEE THIS THE THAT STATEMENT IS APPARENTLY WRONG 
    3#ifndef DUNE_FEM_DYNAMICNONBLOCKMAPPER_HH 
    4#define DUNE_FEM_DYNAMICNONBLOCKMAPPER_HH 
    8#include <dune/fem/gridpart/common/indexset.hh> 
    9#include <dune/fem/misc/functor.hh> 
   10#include <dune/fem/space/mapper/dofmapper.hh> 
   11#include <dune/fem/space/mapper/nonblockmapper.hh> 
   22    template< 
class BlockMapper >
 
   23    class DynamicNonBlockMapper;
 
   26    namespace __DynamicNonBlockMapper
 
   32      template< 
class BlockMapper >
 
   35        typedef DynamicNonBlockMapper< BlockMapper > DofMapperType;
 
   37        typedef BlockMapper BlockMapperType;
 
   38        typedef typename BlockMapper::ElementType ElementType;
 
   39        typedef typename BlockMapper::SizeType SizeType;
 
   40        typedef typename BlockMapper::GlobalKeyType GlobalKeyType;
 
   51        typedef Base< T > BaseType;
 
   53        template< 
class, 
template< 
class > 
class >
 
   54        friend class DofMapper;
 
   57        typedef typename BaseType::Traits Traits;
 
   59        typedef typename Traits::BlockMapperType BlockMapperType;
 
   61        typedef typename Traits::ElementType ElementType;
 
   62        typedef typename Traits::SizeType SizeType;
 
   63        typedef typename Traits::GlobalKeyType GlobalKeyType;
 
   66        template< 
class Functor >
 
   69          explicit BlockFunctor ( 
int blockSize, Functor functor )
 
   70            : blockSize_( blockSize ), functor_( functor )
 
   73          template< 
class GlobalKey >
 
   74          void operator() ( 
int localBlock, 
const GlobalKey globalKey )
 
   76            int localDof = blockSize_*localBlock;
 
   77            SizeType globalDof = blockSize_*globalKey;
 
   78            const int localEnd = localDof + blockSize_;
 
   79            while( localDof != localEnd )
 
   80              functor_( localDof++, globalDof++ );
 
   89        DofMapper ( BlockMapperType &blockMapper, 
int blockSize )
 
   90          : blockMapper_( blockMapper ), blockSize_( blockSize )
 
   93        SizeType 
size ()
 const { 
return blockSize() * blockMapper_.size(); }
 
   95        bool contains ( 
const int codim )
 const { 
return blockMapper_.contains( codim ); }
 
   97        bool fixedDataSize ( 
int codim )
 const { 
return blockMapper_.fixedDataSize( codim ); }
 
   99        template< 
class Functor >
 
  100        void mapEach ( 
const ElementType &element, Functor f )
 const 
  102          blockMapper_.mapEach( element, BlockFunctor< Functor >( blockSize(), f ) );
 
  105        void map ( 
const ElementType &element, std::vector< GlobalKeyType > &indices )
 const 
  107          indices.resize( 
numDofs( element ) );
 
  108          mapEach( element, [ &indices ] ( 
int local, GlobalKeyType global ) { indices[ local ] = global; } );
 
  111        [[deprecated(
"Use onSubEntity method with char vector instead")]]
 
  112        void onSubEntity ( 
const ElementType &element, 
int i, 
int c, std::vector< bool > &indices )
 const 
  114          std::vector< char > _idx;
 
  115          onSubEntity(element, i, c, _idx);
 
  116          indices.resize( _idx.size() );
 
  117          for (std::size_t i=0; i<_idx.size();++i)
 
  118            _idx[i] = indices[i] > 0;
 
  128        void onSubEntity ( 
const ElementType &element, 
int i, 
int c, std::vector< char > &indices )
 const 
  130          const SizeType 
numDofs = blockMapper_.numDofs( element );
 
  131          blockMapper_.onSubEntity( element, i, c, indices );
 
  132          indices.resize( blockSize() * numDofs );
 
  133          for( SizeType i = numDofs-1; i!=SizeType(-1) ; --i )
 
  135            for( 
int j = 0; j < blockSize(); ++j )
 
  136              indices[ i*blockSize() + j ] = ( indices[ i ]==0)? 0 : j+1;
 
  140        template< 
class Entity, 
class Functor >
 
  141        void mapEachEntityDof ( 
const Entity &entity, Functor f )
 const 
  143          blockMapper_.mapEachEntityDof( entity, BlockFunctor< Functor >( blockSize(), f ) );
 
  146        template< 
class Entity >
 
  147        void mapEntityDofs ( 
const Entity &entity, std::vector< GlobalKeyType > &indices )
 const 
  149          indices.resize( numEntityDofs( entity ) );
 
  150          mapEachEntityDof( entity, [ &indices ] ( 
int local, GlobalKeyType global ) { indices[ local ] = global; } );
 
  153        int maxNumDofs ()
 const { 
return blockSize() * blockMapper_.maxNumDofs(); }
 
  155        SizeType numDofs ( 
const ElementType &element )
 const { 
return blockSize() * blockMapper_.numDofs( element ); }
 
  157        template< 
class Entity >
 
  158        SizeType numEntityDofs ( 
const Entity &entity )
 const { 
return blockSize() * blockMapper_.numEntityDofs( entity ); }
 
  160        static constexpr bool consecutive () noexcept { 
return false; }
 
  162        SizeType numBlocks ()
 const 
  164          DUNE_THROW( NotImplemented, 
"Method numBlocks() called on non-adaptive block mapper" );
 
  167        SizeType numberOfHoles ( 
int )
 const 
  169          DUNE_THROW( NotImplemented, 
"Method numberOfHoles() called on non-adaptive block mapper" );
 
  172        GlobalKeyType oldIndex ( 
int hole, 
int )
 const 
  174          DUNE_THROW( NotImplemented, 
"Method oldIndex() called on non-adaptive block mapper" );
 
  177        GlobalKeyType newIndex ( 
int hole, 
int )
 const 
  179          DUNE_THROW( NotImplemented, 
"Method newIndex() called on non-adaptive block mapper" );
 
  182        SizeType oldOffSet ( 
int )
 const 
  184          DUNE_THROW( NotImplemented, 
"Method oldOffSet() called on non-adaptive block mapper" );
 
  187        SizeType offSet ( 
int )
 const 
  189          DUNE_THROW( NotImplemented, 
"Method offSet() called on non-adaptive block mapper" );
 
  192        const BlockMapperType &blockMapper ()
 const { 
return blockMapper_; }
 
  193        int blockSize ()
 const { 
return blockSize_; }
 
  196        BlockMapperType &blockMapper_;
 
  205      class AdaptiveDofMapper
 
  206        : 
public DofMapper< T, Dune::Fem::AdaptiveDofMapper >
 
  208        typedef DofMapper< T, Dune::Fem::AdaptiveDofMapper > BaseType;
 
  211        friend class AdaptiveDofMapper;
 
  214        typedef typename BaseType::Traits Traits;
 
  216        typedef typename Traits::BlockMapperType BlockMapperType;
 
  218        using BaseType::blockMapper;
 
  219        using BaseType::blockSize;
 
  221        typedef typename Traits::ElementType ElementType;
 
  222        typedef typename Traits::SizeType SizeType;
 
  223        typedef typename Traits::GlobalKeyType GlobalKeyType;
 
  225        AdaptiveDofMapper ( BlockMapperType &blockMapper, 
int blockSize )
 
  226          : BaseType( blockMapper, blockSize )
 
  229        bool consecutive ()
 const { 
return blockMapper().consecutive(); }
 
  231        SizeType numBlocks ()
 const { 
return blockMapper().numBlocks(); }
 
  233        SizeType numberOfHoles ( 
int block )
 const { 
return blockSize() * blockMapper().numberOfHoles( block ); }
 
  235        GlobalKeyType oldIndex ( 
int hole, 
int block )
 const 
  237          const int i = hole % blockSize();
 
  238          const int blockHole = hole / blockSize();
 
  239          return blockMapper().oldIndex( blockHole, block ) * blockSize() + i;
 
  242        GlobalKeyType newIndex ( 
int hole, 
int block )
 const 
  244          const int i = hole % blockSize;
 
  245          const int blockHole = hole / blockSize();
 
  246          return blockMapper().newIndex( blockHole, block ) * blockSize() + i;
 
  249        SizeType oldOffSet ( 
const int block )
 const { 
return blockMapper().oldOffSet( block ) * blockSize(); }
 
  251        SizeType offSet ( 
const int block )
 const { 
return blockMapper().offSet( block ) * blockSize(); }
 
  258      template< class BlockMapper, bool adaptive = Capabilities::isAdaptiveDofMapper< BlockMapper >::v >
 
  261        typedef __DynamicNonBlockMapper::Traits< BlockMapper > Traits;
 
  264        typedef typename std::conditional< adaptive, AdaptiveDofMapper< Traits >, DofMapper< Traits > >::type Type;
 
  275    template< 
class BlockMapper >
 
  277      : 
public __DynamicNonBlockMapper::template Implementation< BlockMapper >::Type
 
  279      typedef typename __DynamicNonBlockMapper::template Implementation< BlockMapper >::Type BaseType;
 
  283        : BaseType( blockMapper, blockSize )
 
  292    template< 
class BlockMapper >
 
  301        : BaseType( blockMapper.blockMapper(), blockMapper.blockSize() * blockSize )
 
  310    template< 
class BlockMapper, 
int innerBlockSize >
 
  311    class DynamicNonBlockMapper< NonBlockMapper< BlockMapper, innerBlockSize > >
 
  312      : 
public DynamicNonBlockMapper< BlockMapper >
 
  314      typedef DynamicNonBlockMapper< NonBlockMapper< BlockMapper, innerBlockSize > > ThisType;
 
  315      typedef DynamicNonBlockMapper< BlockMapper > BaseType;
 
  318      explicit DynamicNonBlockMapper ( 
const NonBlockMapper< BlockMapper, innerBlockSize > &blockMapper, 
int blockSize )
 
  319        : BaseType( blockMapper.blockMapper(), innerBlockSize * blockSize )
 
  328    template< 
class BlockMapper, 
int outerBlockSize >
 
  329    class NonBlockMapper< DynamicNonBlockMapper< BlockMapper >, outerBlockSize >
 
  330      : 
public DynamicNonBlockMapper< BlockMapper >
 
  332      typedef NonBlockMapper< DynamicNonBlockMapper< BlockMapper >, outerBlockSize > ThisType;
 
  333      typedef DynamicNonBlockMapper< BlockMapper > BaseType;
 
  336      explicit NonBlockMapper ( 
const DynamicNonBlockMapper< BlockMapper > &blockMapper )
 
  337        : BaseType( blockMapper.blockMapper(), outerBlockSize * blockMapper.blockSize() )
 
  346    namespace Capabilities
 
  348      template< 
class BlockMapper >
 
  349      struct isAdaptiveDofMapper< DynamicNonBlockMapper< BlockMapper > >
 
  351        static const bool v = isAdaptiveDofMapper< BlockMapper >::v;
 
  354      template< 
class BlockMapper >
 
  355      struct isConsecutiveIndexSet< __DynamicNonBlockMapper::AdaptiveDofMapper< __DynamicNonBlockMapper::Traits< BlockMapper > > >
 
  357        static const bool v = isConsecutiveIndexSet< BlockMapper >::v;
 
Interface for calculating the size of a function space for a grid on a specified level....
Definition: dofmapper.hh:43
 
SizeType numDofs(const ElementType &element) const
obtain number of DoFs on an entity
Definition: dofmapper.hh:164
 
void mapEach(const ElementType &element, Functor f) const
map each local DoF number to a global key
Definition: dofmapper.hh:116
 
Definition: dynamicnonblockmapper.hh:278
 
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
 
Dune namespace.
Definition: alignedallocator.hh:13
 
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
 
constexpr std::bool_constant<((II==value)||...)> contains(std::integer_sequence< T, II... >, std::integral_constant< T, value >)
Checks whether or not a given sequence contains a value.
Definition: integersequence.hh:137