9 #include <dune/common/concept.hh> 10 #include <dune/common/reservedvector.hh> 11 #include <dune/common/shared_ptr.hh> 12 #include <dune/common/typeutilities.hh> 13 #include <dune/common/version.hh> 14 #include <dune/functions/common/type_traits.hh> 15 #include <dune/functions/functionspacebases/concepts.hh> 16 #include <dune/functions/functionspacebases/defaultglobalbasis.hh> 17 #include <dune/functions/functionspacebases/defaultlocalindexset.hh> 18 #include <dune/functions/functionspacebases/flatmultiindex.hh> 19 #include <dune/grid/common/adaptcallback.hh> 20 #include <dune/typetree/treepath.hh> 22 #include <amdis/AdaptiveGrid.hpp> 23 #include <amdis/Observer.hpp> 24 #include <amdis/Output.hpp> 25 #include <amdis/common/Concepts.hpp> 26 #include <amdis/common/TypeTraits.hpp> 27 #include <amdis/functions/FlatPreBasis.hpp> 28 #include <amdis/functions/LocalView.hpp> 29 #include <amdis/linearalgebra/Traits.hpp> 30 #include <amdis/typetree/MultiIndex.hpp> 34 template <
class PreBasisFactory,
class PBF = remove_cvref_t<PreBasisFactory>>
35 using MultiIndex_t = std::conditional_t<(PBF::requiredMultiIndexSize == 1),
36 Dune::Functions::FlatMultiIndex<std::size_t>,
37 Dune::ReservedVector<std::size_t, PBF::requiredMultiIndexSize>>;
51 :
public Dune::Functions::DefaultGlobalBasis<PB>
56 using Super = Dune::Functions::DefaultGlobalBasis<PB>;
64 using Grid =
typename GridView::Grid;
70 using Comm = std::conditional_t<Traits::IsFlatIndex<typename Super::MultiIndex>::value,
75 using ADH = Dune::AdaptDataHandle<Grid, DummyImpl>;
86 template <
class... Args,
87 Dune::Functions::enableIfConstructible<
PreBasis, Args...> = 0>
88 GlobalBasis(std::string
const& name, Grid
const& grid, Args&&... args)
97 PBF
const& preBasisFactory)
99 flatPreBasis(preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))
103 template <
class Arg,
class... Args,
104 REQUIRES(!std::is_same_v<std::string, remove_cvref_t<Arg>>)>
123 Super::preBasis().update(gv);
124 Super::preBasis().initializeIndices();
137 return std::make_shared<LocalView>(*this);
154 ADH globalRefineCallback()
const 157 error_exit(
"Not implemented: GlobalBasis::globalRefineCallback()");
166 update(Super::gridView());
179 template <
class GV,
class PBF>
180 GlobalBasis(std::string
const& name, GV
const& gridView, PBF
const& preBasisFactory)
182 preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))>;
184 template <
class GV,
class PBF>
185 GlobalBasis(GV
const& gridView, PBF
const& preBasisFactory)
187 preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))>;
GlobalBasis const & rootBasis() const
Return *this because we are not embedded in a larger basis.
Definition: GlobalBasis.hpp:141
GlobalBasis(std::string const &name, Grid const &grid, Args &&... args)
Construct this global basis with given name and grid, and constructing a preBasis.
Definition: GlobalBasis.hpp:88
void update(GridView const &gv)
Update the stored grid view.
Definition: GlobalBasis.hpp:121
Global basis defined on a pre-basis.
Definition: GlobalBasis.hpp:50
Definition: FieldMatVec.hpp:12
AMDiS::LocalView< Self > LocalView
Type of the local view on the restriction of the basis to a single element.
Definition: GlobalBasis.hpp:67
void updateImpl(event::adapt e) override
Updates the underlying basis when event::adapt is triggered by the observed grid. ...
Definition: GlobalBasis.hpp:163
Definition: AdaptBase.hpp:6
Implementation of a creator pattern for Communication types.
Definition: Communication.hpp:47
Definition: GlobalBasis.hpp:74
The restriction of a finite element basis to a single element.
Definition: LocalView.hpp:20
Implementation of the ObserverInterface.
Definition: Observer.hpp:100
GlobalBasis(std::string const &name, GridView const &gridView, PBF const &preBasisFactory)
Construct this global basis with a preBasisFactory.
Definition: GlobalBasis.hpp:96
Dummy implementation for sequential communication.
Definition: Communication.hpp:14
Definition: Observer.hpp:25
std::shared_ptr< LocalView > localViewPtr() const
Return local view as shared_ptr to prevent from copy construction.
Definition: GlobalBasis.hpp:135
PB PreBasis
Pre-basis providing the implementation details.
Definition: GlobalBasis.hpp:60
typename PreBasis::GridView GridView
The grid view that the FE space is defined on.
Definition: GlobalBasis.hpp:63
std::conditional_t< Traits::IsFlatIndex< typename Super::MultiIndex >::value, typename BackendTraits< Self >::Comm, SequentialCommunication > Comm
Type of the communicator.
Definition: GlobalBasis.hpp:72
Mixin for signaling of certain events.
Definition: Observer.hpp:54
Comm const & communicator() const
Return the communicator.
Definition: GlobalBasis.hpp:151
GlobalBasis(Arg &&arg, Args &&... args)
Construct this global basis with empty name.
Definition: GlobalBasis.hpp:105
LocalView localView() const
Return local view for basis.
Definition: GlobalBasis.hpp:129