3 #ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_PQ1NODALBASIS_HH 4 #define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_PQ1NODALBASIS_HH 7 #include <dune/common/exceptions.hh> 9 #include <dune/localfunctions/lagrange/pqkfactory.hh> 11 #include <dune/typetree/leafnode.hh> 33 template<
typename GV,
typename TP>
36 template<
typename GV,
class MI,
class TP>
39 template<
typename GV,
class MI>
53 template<
typename GV,
class MI>
56 static const int dim = GV::dimension;
141 if (prefix.size() == 0)
143 if (prefix.size() == 1)
145 DUNE_THROW(RangeError,
"Method size() can only be called for prefixes of length up to one");
166 template<
typename GV,
typename TP>
170 static const int dim = GV::dimension;
174 using FiniteElementCache =
typename Dune::PQkLocalFiniteElementCache<typename GV::ctype, double, dim, 1>;
180 using Element =
typename GV::template Codim<0>::Entity;
185 finiteElement_(nullptr),
201 return *finiteElement_;
208 finiteElement_ = &(cache_.get(element_->type()));
209 this->setSize(finiteElement_->size());
221 template<
typename GV,
class MI,
class TP>
224 enum {dim = GV::dimension};
262 return (
size_type)(node_->finiteElement().size());
266 template<
typename It>
271 Dune::LocalKey localKey = node_->finiteElement().localCoefficients().localKey(i);
272 const auto& gridIndexSet = preBasis_->gridView().indexSet();
273 const auto& element = node_->element();
275 *it = {{ (
size_type)(gridIndexSet.subIndex(element,localKey.subEntity(),dim)) }};
297 template<
typename GV>
303 #endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_PQ1NODALBASIS_HH MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: pq1nodalbasis.hh:75
void bind(const Element &e)
Bind to element.
Definition: pq1nodalbasis.hh:205
TP TreePath
Definition: nodes.hh:126
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: pq1nodalbasis.hh:155
IndexSet< TP > indexSet() const
Create tree node index set with given root tree path.
Definition: pq1nodalbasis.hh:127
std::size_t size_type
Definition: nodes.hh:127
size_type size() const
Size of subtree rooted in this node (element-local)
Definition: pq1nodalbasis.hh:260
const Node * node_
Definition: pq1nodalbasis.hh:283
Definition: pq1nodalbasis.hh:34
MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: pq1nodalbasis.hh:231
It indices(It it) const
Maps from subtree index set [0..size-1] to a globally unique multi index in global basis...
Definition: pq1nodalbasis.hh:267
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: pq1nodalbasis.hh:96
std::size_t size_type
Type used for indices and size information.
Definition: pq1nodalbasis.hh:64
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition: pq1nodalbasis.hh:149
size_type size() const
Same as size(prefix) with empty prefix.
Definition: pq1nodalbasis.hh:133
typename GV::template Codim< 0 >::Entity Element
Definition: pq1nodalbasis.hh:180
size_type size(const SizePrefix prefix) const
Return number of possible values for next position in multi index.
Definition: pq1nodalbasis.hh:139
PQ1NodeIndexSet(const PreBasis &preBasis)
Definition: pq1nodalbasis.hh:237
Global basis for given pre-basis.
Definition: defaultglobalbasis.hh:42
const FiniteElement * finiteElement_
Definition: pq1nodalbasis.hh:215
void initializeIndices()
Initialize the global indices.
Definition: pq1nodalbasis.hh:86
std::size_t size_type
Definition: pq1nodalbasis.hh:228
Pre-basis for a first order PQ-lagrange basis.
Definition: pq1nodalbasis.hh:40
GridView gridView_
Definition: pq1nodalbasis.hh:161
PQ1Node(const TreePath &treePath)
Definition: pq1nodalbasis.hh:183
Node< TP > node(const TP &tp) const
Create tree node with given root tree path.
Definition: pq1nodalbasis.hh:112
const Element & element() const
Return current element, throw if unbound.
Definition: pq1nodalbasis.hh:190
void unbind()
Unbind the view.
Definition: pq1nodalbasis.hh:253
auto power(ChildPreBasisFactory &&childPreBasisFactory, const IndexMergingStrategy &ims)
Create a pre-basis factory that can build a PowerPreBasis.
Definition: powerbasis.hh:493
typename FiniteElementCache::FiniteElementType FiniteElement
Definition: pq1nodalbasis.hh:181
Definition: pq1nodalbasis.hh:37
typename PreBasis::template Node< TP > Node
Definition: pq1nodalbasis.hh:235
FiniteElementCache cache_
Definition: pq1nodalbasis.hh:214
const Element * element_
Definition: pq1nodalbasis.hh:216
Definition: polynomial.hh:7
PQ1PreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition: pq1nodalbasis.hh:81
void bind(const Node &node)
Bind the view to a grid element.
Definition: pq1nodalbasis.hh:246
Dune::ReservedVector< size_type, 2 > SizePrefix
Type used for prefixes handed to the size() method.
Definition: pq1nodalbasis.hh:78
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition: pq1nodalbasis.hh:90
const PreBasis * preBasis_
Definition: pq1nodalbasis.hh:281
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to.
Definition: pq1nodalbasis.hh:199
GV GridView
The grid view that the FE basis is defined on.
Definition: pq1nodalbasis.hh:61