3 #ifndef DUNE_PDELAB_FUNCTION_SELECTCOMPONENT_HH 4 #define DUNE_PDELAB_FUNCTION_SELECTCOMPONENT_HH 10 #include <dune/common/exceptions.hh> 24 template<
typename GF, std::
size_t dimR = 1>
28 typename GF::Traits::GridViewType,
29 typename GF::Traits::RangeFieldType, dimR,
30 FieldVector<typename GF::Traits::RangeFieldType, dimR>
32 SelectComponentGridFunctionAdapter<GF, dimR>
37 typename GF::Traits::GridViewType,
38 typename GF::Traits::RangeFieldType, dimR,
39 FieldVector<typename GF::Traits::RangeFieldType, dimR>
48 std::size_t remap[dimR];
50 void checkRemap()
const {
51 for(std::size_t c = 0; c < dimR; ++c)
52 if(remap[c] >= GF::Traits::dimRange)
53 DUNE_THROW(InvalidStateException,
"remap[" << c <<
"] = " 54 << remap[c] <<
" >= GF::Traits::dimRange = " 55 << GF::Traits::dimRange);
62 for(std::size_t c = 0; c < dimR; ++c)
69 ( GF& gf_,
const std::vector<std::size_t> remap_) :
72 if(remap_.size() != dimR)
73 DUNE_THROW(
Exception,
"Got an index map of size " 74 << remap_.size() <<
" but size " << dimR <<
" was " 76 std::copy(remap_.begin(), remap_.end(), remap);
84 typename GF::Traits::RangeType y_;
86 for(std::size_t c = 0; c < dimR; ++c)
91 {
return gf.getGridView(); }
93 template<
typename Time>
94 void setTime(Time time) { gf.setTime(time); }
100 #endif // DUNE_PDELAB_FUNCTION_SELECTCOMPONENT_HH GridFunctionTraits< typename GF::Traits::GridViewType, typename GF::Traits::RangeFieldType, dimR, FieldVector< typename GF::Traits::RangeFieldType, dimR > > Traits
Definition: selectcomponent.hh:40
Base class for all PDELab exceptions.
Definition: exceptions.hh:17
Select certain component(s) of a gridfunction.
Definition: selectcomponent.hh:25
SelectComponentGridFunctionAdapter(GF &gf_, std::size_t first)
construct with a consecutive range of indices
Definition: selectcomponent.hh:59
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:114
Definition: adaptivity.hh:27
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:117
const Entity & e
Definition: localfunctionspace.hh:111
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: selectcomponent.hh:80
void setTime(Time time)
Definition: selectcomponent.hh:94
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:48
const Traits::GridViewType & getGridView() const
Definition: selectcomponent.hh:90
R RangeType
range type
Definition: function.hh:60
leaf of a function tree
Definition: function.hh:576
traits class holding the function signature, same as in local function
Definition: function.hh:175