1#ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_LOCALDOFSTORAGE_HH
2#define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_LOCALDOFSTORAGE_HH
23 template<
class GlobalKey >
28 using container = std::vector< GlobalKey >;
85 std::size_t
size ()
const {
return size_; }
94 template<
class Function >
101 const std::size_t old_size = dofs_.size();
102 if( old_size < new_size_ )
104 dofs_.resize( new_size );
105 for( std::size_t i = old_size; i < new_size; ++i )
106 dofs_[ i ] = function();
109 return std::move( function );
113 template<
class Function >
116 assert( new_size_ <= dofs_.size() );
119 const std::size_t holes = dofs_.size() - size_;
120 std::for_each( dofs_.rbegin(), dofs_.rbegin() + holes, function );
122 dofs_.resize( size_ );
125 return std::move( function );
135 GlobalKey &
operator[] ( std::size_t n ) {
return dofs_[ n ]; }
138 const GlobalKey &
operator[] ( std::size_t n )
const {
return dofs_[ n ]; }
146 const auto &
dofs = storage.dofs_;
147 const std::size_t
size =
dofs.size();
148 for( std::size_t i = 0; i <
size; ++i )
149 ostream <<
dofs[ i ] <<
" ";
150 ostream <<
"[" << storage.size_ <<
"; " << storage.new_size_ <<
"]";
157 std::size_t size_, new_size_;
158 std::vector< GlobalKey > dofs_;
Definition: bindguard.hh:11
OutStreamInterface< StreamTraits > & operator<<(OutStreamInterface< StreamTraits > &out, const DiscreteFunctionInterface< Impl > &df)
write a discrete function into an output stream
Definition: discretefunction_inline.hh:396
IteratorRange< typename DF::DofIteratorType > dofs(DF &df)
Iterates over all DOFs.
Definition: rangegenerators.hh:76
Abstract class representing a function.
Definition: common/function.hh:50
Definition: localdofstorage.hh:25
iterator begin()
return iterator to beginning
Definition: localdofstorage.hh:69
ThisType & operator=(const ThisType &)=default
assignment operator
std::size_t size() const
return number of dofs
Definition: localdofstorage.hh:85
Function resize(Function function)
remove marked dofs from dof vector
Definition: localdofstorage.hh:114
GlobalKey value_type
global key type
Definition: localdofstorage.hh:32
const_iterator begin() const
return iterator to beginning
Definition: localdofstorage.hh:72
iterator end()
return iterator to end
Definition: localdofstorage.hh:75
LocalDofStorage(ThisType &&)=default
move constructor
typename container::iterator iterator
iterator type
Definition: localdofstorage.hh:35
LocalDofStorage()
default constructor
Definition: localdofstorage.hh:44
typename container::const_iterator const_iterator
iterator type
Definition: localdofstorage.hh:37
GlobalKey & operator[](std::size_t n)
access element
Definition: localdofstorage.hh:135
const_iterator end() const
return iterator to end
Definition: localdofstorage.hh:78
Function reserve(std::size_t new_size, Function function)
enlarge dof vector
Definition: localdofstorage.hh:95
LocalDofStorage(const ThisType &)=default
copy constructor