Loading...
Searching...
No Matches
subspacebasis.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_SUBSPACEBASIS_HH
#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_SUBSPACEBASIS_HH
#include <dune/common/reservedvector.hh>
#include <dune/common/typeutilities.hh>
#include <dune/common/concept.hh>
#include <dune/common/typetree/treepath.hh>
#include <dune/functions/common/type_traits.hh>
#include <dune/functions/functionspacebases/subspacelocalview.hh>
#include <dune/functions/functionspacebases/concepts.hh>
namespace Dune {
namespace Functions {
template<class RB, class TP>
class SubspaceBasis
{
public:
using RootBasis = RB;
using RootLocalView = typename RootBasis::LocalView;
using PrefixPath = TP;
using GridView = typename RootBasis::GridView;
using MultiIndex = typename RootBasis::MultiIndex;
using size_type = std::size_t;
using LocalView = SubspaceLocalView<RootLocalView, PrefixPath>;
using SizePrefix = typename RootBasis::SizePrefix;
SubspaceBasis(const RootBasis& rootBasis, const PrefixPath& prefixPath) :
rootBasis_(&rootBasis),
prefixPath_(prefixPath)
{}
template<class RootRootBasis, class InnerTP, class OuterTP>
SubspaceBasis(const SubspaceBasis<RootRootBasis, InnerTP>& rootBasis, const OuterTP& prefixPath) :
SubspaceBasis(rootBasis.rootBasis(), Dune::TypeTree::join(rootBasis.prefixPath(), prefixPath))
{}
const GridView& gridView() const
{
return rootBasis_->gridView();
}
size_type dimension() const
{
return rootBasis_->dimension();
}
size_type size() const
{
return rootBasis_->size();
}
size_type size(const SizePrefix& prefix) const
{
return rootBasis_->size(prefix);
}
LocalView localView() const
{
return LocalView(*this, prefixPath_);
}
const RootBasis& rootBasis() const
{
return *rootBasis_;
}
const PrefixPath& prefixPath() const
{
return prefixPath_;
}
auto containerDescriptor() const
{
return rootBasis_->containerDescriptor();
}
protected:
const RootBasis* rootBasis_;
PrefixPath prefixPath_;
};
// CTAD guide for a non-SubspaceBasis root basis
template<class RB, class TP>
SubspaceBasis(const RB&, const TP) -> SubspaceBasis<RB, TP>;
// CTAD guide for a SubspaceBasis root basis
template<class RootRootBasis, class InnerTP, class OuterTP>
SubspaceBasis(const SubspaceBasis<RootRootBasis, InnerTP>& rootBasis, const OuterTP& prefixPath)
-> SubspaceBasis<std::decay_t<decltype(rootBasis.rootBasis())>, decltype(Dune::TypeTree::join(rootBasis.prefixPath(), prefixPath))>;
template<class RootBasis, class... PrefixTreeIndices>
auto subspaceBasis(const RootBasis& rootBasis, const TypeTree::TreePath<PrefixTreeIndices...>& prefixPath)
{
return SubspaceBasis(rootBasis, prefixPath);
}
template<class RootBasis, class... PrefixTreeIndices>
auto subspaceBasis(const RootBasis& rootBasis, const PrefixTreeIndices&... prefixTreeIndices)
{
return subspaceBasis(rootBasis, TypeTree::treePath(prefixTreeIndices...));
}
} // end namespace Functions
} // end namespace Dune
#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTGLOBALBASIS_HH
subspacelocalview.hh
type_traits.hh
Dune
Definition monomialset.hh:19
Dune::Functions
Definition monomialset.hh:19
Dune::Functions::SubspaceBasis
SubspaceBasis(const RB &, const TP) -> SubspaceBasis< RB, TP >
Dune::Functions::subspaceBasis
auto subspaceBasis(const RootBasis &rootBasis, const TypeTree::TreePath< PrefixTreeIndices... > &prefixPath)
Create SubspaceBasis from a root basis and a prefixPath.
Definition subspacebasis.hh:148
Dune::Functions::SubspaceBasis
Definition subspacebasis.hh:29
Dune::Functions::SubspaceBasis::RootLocalView
typename RootBasis::LocalView RootLocalView
Definition subspacebasis.hh:34
Dune::Functions::SubspaceBasis::localView
LocalView localView() const
Return local view for basis.
Definition subspacebasis.hh:99
Dune::Functions::SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath >::rootBasis_
const RootBasis * rootBasis_
Definition subspacebasis.hh:121
Dune::Functions::SubspaceBasis::SizePrefix
typename RootBasis::SizePrefix SizePrefix
Definition subspacebasis.hh:49
Dune::Functions::SubspaceBasis::PrefixPath
TP PrefixPath
Definition subspacebasis.hh:36
Dune::Functions::SubspaceBasis::LocalView
SubspaceLocalView< RootLocalView, PrefixPath > LocalView
Type of the local view on the restriction of the basis to a single element.
Definition subspacebasis.hh:47
Dune::Functions::SubspaceBasis::size
size_type size(const SizePrefix &prefix) const
Return number possible values for next position in multi index.
Definition subspacebasis.hh:91
Dune::Functions::SubspaceBasis::GridView
typename RootBasis::GridView GridView
The grid view that the FE space is defined on.
Definition subspacebasis.hh:39
Dune::Functions::SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath >::prefixPath
const PrefixPath & prefixPath() const
Definition subspacebasis.hh:109
Dune::Functions::SubspaceBasis::SubspaceBasis
SubspaceBasis(const SubspaceBasis< RootRootBasis, InnerTP > &rootBasis, const OuterTP &prefixPath)
Constructor from another SubspaceBasis.
Definition subspacebasis.hh:64
Dune::Functions::SubspaceBasis::gridView
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition subspacebasis.hh:71
Dune::Functions::SubspaceBasis::containerDescriptor
auto containerDescriptor() const
Return the associated container descriptor.
Definition subspacebasis.hh:115
Dune::Functions::SubspaceBasis::RootBasis
RB RootBasis
Definition subspacebasis.hh:32
Dune::Functions::SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath >::prefixPath_
PrefixPath prefixPath_
Definition subspacebasis.hh:122
Dune::Functions::SubspaceBasis::size
size_type size() const
Return number of possible values for next position in empty multi index.
Definition subspacebasis.hh:85
Dune::Functions::SubspaceBasis< typename RootLocalView::GlobalBasis, PrefixPath >::rootBasis
const RootBasis & rootBasis() const
Definition subspacebasis.hh:104
Dune::Functions::SubspaceBasis::MultiIndex
typename RootBasis::MultiIndex MultiIndex
Type used for global numbering of the basis vectors.
Definition subspacebasis.hh:42
Dune::Functions::SubspaceBasis::dimension
size_type dimension() const
Definition subspacebasis.hh:79
Dune::Functions::SubspaceBasis::size_type
std::size_t size_type
Definition subspacebasis.hh:44
Dune::Functions::SubspaceBasis::SubspaceBasis
SubspaceBasis(const RootBasis &rootBasis, const PrefixPath &prefixPath)
Constructor for a given grid view object.
Definition subspacebasis.hh:53
Dune::Functions::SubspaceLocalView
The restriction of a finite element basis to a single element.
Definition subspacelocalview.hh:34
concepts.hh