Loading...
Searching...
No Matches
defaultglobalbasis.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_DEFAULTGLOBALBASIS_HH
#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTGLOBALBASIS_HH
#include <cstddef>
#include <type_traits>
#include <utility>
#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/defaultlocalview.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <dune/functions/functionspacebases/containerdescriptors.hh>
namespace Dune {
namespace Functions {
template<class PB>
class DefaultGlobalBasis
{
public:
using PreBasis = PB;
using PrefixPath = TypeTree::TreePath<>;
using GridView = typename PreBasis::GridView;
using size_type = std::size_t;
using LocalView = DefaultLocalView<DefaultGlobalBasis<PreBasis>>;
using MultiIndex = typename LocalView::MultiIndex;
using SizePrefix = Dune::ReservedVector<std::size_t, PreBasis::multiIndexBufferSize>;
template<class... T,
disableCopyMove<DefaultGlobalBasis, T...> = 0,
enableIfConstructible<PreBasis, T...> = 0>
DefaultGlobalBasis(T&&... t) :
preBasis_(std::forward<T>(t)...),
prefixPath_()
{
static_assert(models<Concept::PreBasis<GridView>, PreBasis>(), "Type passed to DefaultGlobalBasis does not model the PreBasis concept.");
preBasis_.initializeIndices();
}
template<class PreBasisFactory,
std::enable_if_t<Dune::IsCallable<PreBasisFactory(GridView), PreBasis>::value, int> = 0>
DefaultGlobalBasis(const GridView& gridView, PreBasisFactory&& factory) :
preBasis_(factory(gridView)),
prefixPath_()
{
static_assert(models<Concept::PreBasis<GridView>, PreBasis>(), "Type passed to DefaultGlobalBasis does not model the PreBasis concept.");
preBasis_.initializeIndices();
}
const GridView& gridView() const
{
return preBasis_.gridView();
}
const PreBasis& preBasis() const
{
return preBasis_;
}
PreBasis& preBasis()
{
return preBasis_;
}
void update(const GridView & gv)
{
preBasis_.update(gv);
preBasis_.initializeIndices();
}
size_type dimension() const
{
return preBasis_.dimension();
}
size_type size() const
{
return preBasis_.size();
}
size_type size(const SizePrefix& prefix) const
{
return preBasis_.size(prefix);
}
LocalView localView() const
{
return LocalView(*this);
}
const DefaultGlobalBasis& rootBasis() const
{
return *this;
}
const PrefixPath& prefixPath() const
{
return prefixPath_;
}
auto containerDescriptor() const
{
if constexpr (requires(PreBasis pb){ pb.containerDescriptor(); })
return preBasis_.containerDescriptor();
else
return ContainerDescriptors::Unknown{};
}
protected:
PreBasis preBasis_;
PrefixPath prefixPath_;
};
template<class PreBasis>
DefaultGlobalBasis(PreBasis&&) -> DefaultGlobalBasis<std::decay_t<PreBasis>>;
template<class GridView, class PreBasisFactory>
DefaultGlobalBasis(const GridView& gv, PreBasisFactory&& f) -> DefaultGlobalBasis<std::decay_t<decltype(f(gv))>>;
namespace BasisFactory {
template<class GridView, class PreBasisFactory>
auto makeBasis(const GridView& gridView, PreBasisFactory&& preBasisFactory)
{
return DefaultGlobalBasis(preBasisFactory(gridView));
}
} // end namespace BasisFactory
} // end namespace Functions
} // end namespace Dune
#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_DEFAULTGLOBALBASIS_HH
defaultlocalview.hh
containerdescriptors.hh
Lightweight representation of (hierarchical) size and block structure extracted from a basis to descr...
type_traits.hh
Dune::Functions::enableIfConstructible
std::enable_if_t< std::is_constructible_v< T, Args... >, int > enableIfConstructible
Helper to constrain forwarding constructors.
Definition type_traits.hh:30
Dune
Definition monomialset.hh:19
Dune::Functions
Definition monomialset.hh:19
Dune::Functions::DefaultGlobalBasis
DefaultGlobalBasis(PreBasis &&) -> DefaultGlobalBasis< std::decay_t< PreBasis > >
Dune::Functions::BasisFactory
Definition argyrisbasis.hh:926
Dune::Functions::BasisFactory::makeBasis
auto makeBasis(const GridView &gridView, PreBasisFactory &&preBasisFactory)
Definition defaultglobalbasis.hh:206
Dune::Functions::ArgyrisPreBasis::GridView
GV GridView
The grid view that the FE basis is defined on.
Definition argyrisbasis.hh:880
Dune::Functions::ContainerDescriptors::Unknown
Fallback container descriptor if nothing else fits.
Definition containerdescriptors.hh:52
Dune::Functions::DefaultGlobalBasis
Global basis for given pre-basis.
Definition defaultglobalbasis.hh:53
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::SizePrefix
Dune::ReservedVector< std::size_t, PreBasis::multiIndexBufferSize > SizePrefix
Definition defaultglobalbasis.hh:76
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::size_type
std::size_t size_type
Definition defaultglobalbasis.hh:67
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::GridView
typename PreBasis::GridView GridView
Definition defaultglobalbasis.hh:64
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::PrefixPath
TypeTree::TreePath<> PrefixPath
Definition defaultglobalbasis.hh:61
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::gridView
const GridView & gridView() const
Definition defaultglobalbasis.hh:114
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::PreBasis
ArgyrisPreBasis< GV, R > PreBasis
Definition defaultglobalbasis.hh:58
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::LocalView
DefaultLocalView< DefaultGlobalBasis< PreBasis > > LocalView
Definition defaultglobalbasis.hh:70
Dune::Functions::DefaultGlobalBasis::preBasis
PreBasis & preBasis()
Obtain the pre-basis providing the implementation details.
Definition defaultglobalbasis.hh:126
Dune::Functions::DefaultGlobalBasis::update
void update(const GridView &gv)
Update the stored grid view.
Definition defaultglobalbasis.hh:137
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::MultiIndex
typename LocalView::MultiIndex MultiIndex
Definition defaultglobalbasis.hh:73
Dune::Functions::DefaultGlobalBasis::size
size_type size(const SizePrefix &prefix) const
Return number of possible values for next position in multi index.
Definition defaultglobalbasis.hh:156
Dune::Functions::DefaultGlobalBasis::dimension
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition defaultglobalbasis.hh:144
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::preBasis_
PreBasis preBasis_
Definition defaultglobalbasis.hh:189
Dune::Functions::DefaultGlobalBasis::localView
LocalView localView() const
Return local view for basis.
Definition defaultglobalbasis.hh:162
Dune::Functions::DefaultGlobalBasis::DefaultGlobalBasis
DefaultGlobalBasis(T &&... t)
Constructor.
Definition defaultglobalbasis.hh:89
Dune::Functions::DefaultGlobalBasis::DefaultGlobalBasis
DefaultGlobalBasis(const GridView &gridView, PreBasisFactory &&factory)
Constructor from a PreBasis factory.
Definition defaultglobalbasis.hh:105
Dune::Functions::DefaultGlobalBasis::size
size_type size() const
Return number of possible values for next position in empty multi index.
Definition defaultglobalbasis.hh:150
Dune::Functions::DefaultGlobalBasis::preBasis
const PreBasis & preBasis() const
Obtain the pre-basis providing the implementation details.
Definition defaultglobalbasis.hh:120
Dune::Functions::DefaultGlobalBasis< ArgyrisPreBasis< GV, R > >::prefixPath_
PrefixPath prefixPath_
Definition defaultglobalbasis.hh:190
Dune::Functions::DefaultGlobalBasis::containerDescriptor
auto containerDescriptor() const
Return the associated container descriptor.
Definition defaultglobalbasis.hh:180
Dune::Functions::DefaultGlobalBasis::rootBasis
const DefaultGlobalBasis & rootBasis() const
Return *this because we are not embedded in a larger basis.
Definition defaultglobalbasis.hh:168
Dune::Functions::DefaultGlobalBasis::prefixPath
const PrefixPath & prefixPath() const
Return empty path, because this is the root in the local ansatz tree.
Definition defaultglobalbasis.hh:174
Dune::Functions::DefaultLocalView
The restriction of a finite element basis to a single element.
Definition defaultlocalview.hh:32
Dune::Functions::DefaultLocalView< DefaultGlobalBasis< PreBasis > >::MultiIndex
std::conditional_t<(PreBasis::minMultiIndexSize==PreBasis::maxMultiIndexSize), StaticMultiIndex< size_type, PreBasis::maxMultiIndexSize >, Dune::ReservedVector< size_type, PreBasis::multiIndexBufferSize > > MultiIndex
Definition defaultlocalview.hh:65
concepts.hh