6#include <dune/common/concept.hh>
7#include <dune/functions/common/typeerasure.hh>
8#include <amdis/Output.hpp>
13template <
class B,
class C>
14struct DataTransferDefinition
19 virtual ~Interface() =
default;
20 virtual void preAdapt(B
const& basis, C
const& container,
bool mightCoarsen) = 0;
21 virtual void adapt(B
const& basis, C& container) = 0;
22 virtual void postAdapt(C& container) = 0;
27 struct Model :
public Impl
30 void preAdapt(B
const& b, C
const& c,
bool mc)
final { this->get().preAdapt(b,c,mc); }
31 void adapt(B
const& b, C& c)
final { this->get().adapt(b,c); }
32 void postAdapt(C& c)
final { this->get().postAdapt(c); }
39 auto require(DT&& dt) ->
decltype
41 dt.preAdapt(std::declval<B const&>(), std::declval<C const&>(),
true),
42 dt.adapt(std::declval<B const&>(), std::declval<C&>()),
43 dt.postAdapt(std::declval<C&>())
47 using Base = Dune::Functions::TypeErasureBase<Interface,Model>;
65template <
class Basis,
class Container>
67 :
public Impl::DataTransferDefinition<Basis,Container>::Base
69 using Definition = Impl::DataTransferDefinition<Basis,Container>;
70 using Super =
typename Definition::Base;
74 template <
class Impl, Dune::disableCopyMove<DataTransfer,Impl> = 0>
78 static_assert(Concepts::models<
typename Definition::Concept(
Impl)>,
79 "Implementation does not model the DataTransfer concept.");
92 void preAdapt(Basis
const& basis, Container
const& container,
bool mightCoarsen)
94 this->asInterface().preAdapt(basis, container, mightCoarsen);
102 void adapt(Basis
const& basis, Container& container)
104 this->asInterface().adapt(basis, container);
113 this->asInterface().postAdapt(container);
134 template <
class Basis,
class Container>
137 error_exit(
"Unknown <tag> passed to the DataTransferFactory.");
The base class for data transfer classes.
Definition: DataTransfer.hpp:68
DataTransfer()=default
Default Constructor.
DataTransfer(Impl &&impl)
Constructor from a type supporting the DataTransferInterface.
Definition: DataTransfer.hpp:75
void postAdapt(Container &container)
Perform cleanup after grid adaption.
Definition: DataTransfer.hpp:111
void adapt(Basis const &basis, Container &container)
Interpolate data to new grid after grid adaption.
Definition: DataTransfer.hpp:102
void preAdapt(Basis const &basis, Container const &container, bool mightCoarsen)
Collect data that is needed before grid adaption.
Definition: DataTransfer.hpp:92
Definition: DataTransfer.hpp:133
Base tag type for all data transfer tags.
Definition: DataTransfer.hpp:121