Loading...
Searching...
No Matches
subspacelocalview.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
#include <tuple>
#include <dune/common/concept.hh>
#include <dune/common/typetree/childaccess.hh>
#include <dune/functions/functionspacebases/concepts.hh>
namespace Dune {
namespace Functions {
template<class RB, class PP>
class SubspaceBasis;
template<class RLV, class PP>
class SubspaceLocalView
{
using PrefixPath = PP;
public:
using RootLocalView = RLV;
using GlobalBasis = SubspaceBasis<typename RootLocalView::GlobalBasis, PrefixPath>;
using GridView = typename GlobalBasis::GridView;
using Element = typename GridView::template Codim<0>::Entity;
using size_type = std::size_t;
using RootTree = typename RootLocalView::Tree;
using Tree = typename TypeTree::ChildForTreePath<RootTree, PrefixPath>;
using MultiIndex = typename RootLocalView::MultiIndex;
SubspaceLocalView(const GlobalBasis& globalBasis, const PrefixPath& /*prefixPath*/) :
globalBasis_(&globalBasis),
rootLocalView_(globalBasis.rootBasis().localView())
{
// static_assert(models<Concept::BasisTree<GridView>, Tree>(), "Tree type passed to SubspaceLocalView does not model the BasisNode concept.");
}
void bind(const Element& e)
{
rootLocalView_.bind(e);
}
const Element& element() const
{
return rootLocalView_.element();
}
void unbind()
{
rootLocalView_.unbind();
}
bool bound() const
{
return rootLocalView_.bound();
}
const Tree& tree() const
{
return TypeTree::child(rootLocalView_.tree(), globalBasis_->prefixPath());
}
size_type size() const
{
return rootLocalView_.size();
}
size_type maxSize() const
{
return rootLocalView_.maxSize();
}
MultiIndex index(size_type i) const
{
return rootLocalView_.index(i);
}
const GlobalBasis& globalBasis() const
{
return *globalBasis_;
}
const RootLocalView& rootLocalView() const
{
return rootLocalView_;
}
protected:
const GlobalBasis* globalBasis_;
RootLocalView rootLocalView_;
};
} // end namespace Functions
} // end namespace Dune
#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACELOCALVIEW_HH
Dune
Definition monomialset.hh:19
Dune::Functions
Definition monomialset.hh:19
Dune::Functions::SubspaceBasis
Definition subspacebasis.hh:29
Dune::Functions::SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath >::GridView
typename RootBasis::GridView GridView
Definition subspacebasis.hh:39
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::Tree
typename TypeTree::ChildForTreePath< RootTree, PrefixPath > Tree
Definition subspacelocalview.hh:57
Dune::Functions::SubspaceLocalView::unbind
void unbind()
Unbind from the current element.
Definition subspacelocalview.hh:93
Dune::Functions::SubspaceLocalView::element
const Element & element() const
Return the grid element that the view is bound to.
Definition subspacelocalview.hh:84
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::globalBasis_
const GlobalBasis * globalBasis_
Definition subspacelocalview.hh:151
Dune::Functions::SubspaceLocalView::bound
bool bound() const
Return if the view is bound to a grid element.
Definition subspacelocalview.hh:100
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::MultiIndex
typename RootLocalView::MultiIndex MultiIndex
Definition subspacelocalview.hh:60
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::GlobalBasis
SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath > GlobalBasis
Definition subspacelocalview.hh:42
Dune::Functions::SubspaceLocalView::size
size_type size() const
Total number of degrees of freedom on this element.
Definition subspacelocalview.hh:116
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::rootLocalView_
RootLocalView rootLocalView_
Definition subspacelocalview.hh:152
Dune::Functions::SubspaceLocalView::bind
void bind(const Element &e)
Bind the view to a grid element.
Definition subspacelocalview.hh:75
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::GridView
typename GlobalBasis::GridView GridView
Definition subspacelocalview.hh:45
Dune::Functions::SubspaceLocalView::SubspaceLocalView
SubspaceLocalView(const GlobalBasis &globalBasis, const PrefixPath &)
Construct local view for a given global finite element basis.
Definition subspacelocalview.hh:63
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::RootLocalView
RootLocalView RootLocalView
Definition subspacelocalview.hh:39
Dune::Functions::SubspaceLocalView::rootLocalView
const RootLocalView & rootLocalView() const
Definition subspacelocalview.hh:145
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::size_type
std::size_t size_type
Definition subspacelocalview.hh:51
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::Element
typename GridView::template Codim< 0 >::Entity Element
Definition subspacelocalview.hh:48
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::globalBasis
const GlobalBasis & globalBasis() const
Definition subspacelocalview.hh:140
Dune::Functions::SubspaceLocalView::maxSize
size_type maxSize() const
Maximum local size for any element on the GridView.
Definition subspacelocalview.hh:127
Dune::Functions::SubspaceLocalView::tree
const Tree & tree() const
Return the local ansatz tree associated to the bound entity.
Definition subspacelocalview.hh:109
Dune::Functions::SubspaceLocalView::index
MultiIndex index(size_type i) const
Maps from subtree index set [0..size-1] to a globally unique multi index in global basis.
Definition subspacelocalview.hh:133
Dune::Functions::SubspaceLocalView< RootLocalView, PrefixPath >::RootTree
typename RootLocalView::Tree RootTree
Definition subspacelocalview.hh:54
concepts.hh