1 #ifndef DUNE_FEM_NONBLOCKMAPPER_HH 2 #define DUNE_FEM_NONBLOCKMAPPER_HH 18 template<
class BlockMapper,
int blockSize >
22 namespace __NonBlockMapper
28 template<
class BlockMapper,
int bS >
35 typedef typename BlockMapper::SizeType
SizeType;
49 typedef Base< T > BaseType;
51 template<
class,
template<
class >
class >
56 typedef typename BaseType::Traits
Traits;
68 template<
class Functor >
71 explicit BlockFunctor ( Functor functor )
75 template<
class GlobalKey >
76 void operator() (
int localBlock,
const GlobalKey globalKey )
78 int localDof = blockSize*localBlock;
79 SizeType globalDof = blockSize*globalKey;
80 const int localEnd = localDof +
blockSize;
81 while( localDof != localEnd )
82 functor_( localDof++, globalDof++ );
92 : blockMapper_( blockMapper )
95 SizeType
size ()
const {
return blockSize * blockMapper_.size(); }
97 bool contains (
const int codim )
const {
return blockMapper_.contains( codim ); }
99 bool fixedDataSize (
int codim )
const {
return blockMapper_.fixedDataSize( codim ); }
101 template<
class Functor >
102 void mapEach (
const ElementType &element, Functor f )
const 104 blockMapper_.mapEach( element, BlockFunctor< Functor >( f ) );
107 void map (
const ElementType &element, std::vector< std::size_t > &indices )
const 108 DUNE_DEPRECATED_MSG(
"This function is out dated and will be deleted in version 1.5" )
110 indices.resize( numDofs( element ) );
111 mapEach( element,
AssignFunctor< std::vector< std::size_t > >( indices ) );
114 template<
class Entity,
class Functor >
117 blockMapper_.mapEachEntityDof( entity, BlockFunctor< Functor >( f ) );
120 int maxNumDofs ()
const {
return blockSize * blockMapper_.maxNumDofs(); }
122 SizeType
numDofs (
const ElementType &element )
const {
return blockSize * blockMapper_.numDofs( element ); }
124 template<
class Entity >
125 SizeType
numEntityDofs (
const Entity &entity )
const {
return blockSize * blockMapper_.numEntityDofs( entity ); }
131 DUNE_THROW( NotImplemented,
"Method numBlocks() called on non-adaptive block mapper" );
136 DUNE_THROW( NotImplemented,
"Method numberOfHoles() called on non-adaptive block mapper" );
141 DUNE_THROW( NotImplemented,
"Method oldIndex() called on non-adaptive block mapper" );
146 DUNE_THROW( NotImplemented,
"Method newIndex() called on non-adaptive block mapper" );
151 DUNE_THROW( NotImplemented,
"Method oldOffSet() called on non-adaptive block mapper" );
156 DUNE_THROW( NotImplemented,
"Method offSet() called on non-adaptive block mapper" );
160 const BlockMapperType &
blockMapper ()
const {
return blockMapper_; }
163 BlockMapperType &blockMapper_;
172 :
public DofMapper< T, Dune::Fem::AdaptiveDofMapper >
186 using BaseType::blockMapper;
194 : BaseType( blockMapper )
199 SizeType
numBlocks ()
const {
return blockMapper().numBlocks(); }
201 SizeType
numberOfHoles (
const int block )
const {
return blockSize * blockMapper().numberOfHoles( block ); }
203 GlobalKeyType
oldIndex (
const int hole,
const int block )
const 207 return blockMapper().oldIndex( blockHole, block ) * blockSize + i;
210 GlobalKeyType
newIndex (
const int hole,
const int block )
const 214 return blockMapper().newIndex( blockHole, block ) * blockSize + i;
217 SizeType
oldOffSet (
const int block )
const {
return blockMapper().oldOffSet( block ) *
blockSize; }
219 SizeType
offSet (
const int block )
const {
return blockMapper().offSet( block ) *
blockSize; }
226 template< class BlockMapper, int blockSize, bool adaptive = Capabilities::isAdaptiveDofMapper< BlockMapper >::v >
232 typedef typename std::conditional< adaptive,
244 template<
class BlockMapper,
int blockSize >
253 : BaseType( blockMapper )
261 template<
class BlockMapper,
int innerBlockSize,
int outerBlockSize >
263 :
public NonBlockMapper< BlockMapper, innerBlockSize *outerBlockSize >
270 : BaseType( blockMapper.blockMapper_ )
278 namespace Capabilities
280 template<
class BlockMapper,
int blockSize >
292 #endif // #ifndef DUNE_FEM_NONBLOCKMAPPER_HH Traits::SizeType SizeType
Definition: nonblockmapper.hh:190
SizeType size() const
Definition: nonblockmapper.hh:95
AdaptiveDofMapper(BlockMapperType &blockMapper)
Definition: nonblockmapper.hh:193
Traits::ElementType ElementType
Definition: nonblockmapper.hh:189
SizeType numDofs(const ElementType &element) const
Definition: nonblockmapper.hh:122
NonBlockMapper(BlockMapper &blockMapper)
Definition: nonblockmapper.hh:252
GlobalKeyType newIndex(const int hole, const int block) const
Definition: nonblockmapper.hh:210
NonBlockMapper(const NonBlockMapper< BlockMapper, innerBlockSize > &blockMapper)
Definition: nonblockmapper.hh:269
Definition: nonblockmapper.hh:46
GlobalKeyType oldIndex(const int hole, const int block) const
Definition: nonblockmapper.hh:203
NonBlockMapper< BlockMapper, bS > DofMapperType
Definition: nonblockmapper.hh:31
Definition: nonblockmapper.hh:262
SizeType offSet(const int block) const
Definition: nonblockmapper.hh:219
Definition: nonblockmapper.hh:171
Definition: nonblockmapper.hh:227
Traits::GlobalKeyType GlobalKeyType
Definition: nonblockmapper.hh:191
static constexpr bool consecutive() noexcept
Definition: nonblockmapper.hh:127
Traits::GlobalKeyType GlobalKeyType
Definition: nonblockmapper.hh:65
Interface for calculating the size of a function space for a grid on a specified level. Furthermore the local to global mapping of dof number is done. Also during grid adaptation this mapper knows about old and new indices of entities.
Definition: mapper/dofmapper.hh:40
BlockMapper::GlobalKeyType GlobalKeyType
Definition: nonblockmapper.hh:36
Definition: misc/functor.hh:30
Definition: nonblockmapper.hh:19
std::conditional< adaptive, AdaptiveDofMapper< Traits >, DofMapper< Traits > >::type Type
Definition: nonblockmapper.hh:234
BlockMapper::SizeType SizeType
Definition: nonblockmapper.hh:35
SizeType numBlocks() const
Definition: nonblockmapper.hh:129
void map(const ElementType &element, std::vector< std::size_t > &indices) const
Definition: nonblockmapper.hh:107
const BlockMapperType & blockMapper() const
Definition: nonblockmapper.hh:160
Definition: coordinate.hh:4
void mapEach(const ElementType &element, Functor f) const
Definition: nonblockmapper.hh:102
bool consecutive() const
Definition: nonblockmapper.hh:197
SizeType numberOfHoles(const int block) const
Definition: nonblockmapper.hh:201
DofMapper(BlockMapperType &blockMapper)
Definition: nonblockmapper.hh:91
Traits::BlockMapperType BlockMapperType
Definition: nonblockmapper.hh:183
SizeType numBlocks() const
Definition: nonblockmapper.hh:199
int maxNumDofs() const
Definition: nonblockmapper.hh:120
Traits::SizeType SizeType
Definition: nonblockmapper.hh:64
SizeType oldOffSet(int) const
Definition: nonblockmapper.hh:149
SizeType oldOffSet(const int block) const
Definition: nonblockmapper.hh:217
bool contains(const int codim) const
Definition: nonblockmapper.hh:97
SizeType numberOfHoles(int) const
Definition: nonblockmapper.hh:134
static const int blockSize
Definition: nonblockmapper.hh:38
Definition: space/mapper/capabilities.hh:21
bool fixedDataSize(int codim) const
Definition: nonblockmapper.hh:99
GlobalKeyType newIndex(int hole, int) const
Definition: nonblockmapper.hh:144
GlobalKeyType oldIndex(int hole, int) const
Definition: nonblockmapper.hh:139
Traits::BlockMapperType BlockMapperType
Definition: nonblockmapper.hh:59
SizeType numEntityDofs(const Entity &entity) const
Definition: nonblockmapper.hh:125
BlockMapper::ElementType ElementType
Definition: nonblockmapper.hh:34
BlockMapper BlockMapperType
Definition: nonblockmapper.hh:33
Traits::ElementType ElementType
Definition: nonblockmapper.hh:63
BaseType::Traits Traits
Definition: nonblockmapper.hh:180
void mapEachEntityDof(const Entity &entity, Functor f) const
Definition: nonblockmapper.hh:115
Definition: nonblockmapper.hh:29
BaseType::Traits Traits
Definition: nonblockmapper.hh:56
SizeType offSet(int) const
Definition: nonblockmapper.hh:154