6#include <dune/common/concept.hh>
7#include <dune/common/shared_ptr.hh>
8#include <dune/functions/functionspacebases/concepts.hh>
10#include <amdis/DataTransfer.hpp>
11#include <amdis/LinearAlgebra.hpp>
12#include <amdis/Observer.hpp>
13#include <amdis/common/Concepts.hpp>
14#include <amdis/common/DerivativeTraits.hpp>
15#include <amdis/common/TypeTraits.hpp>
16#include <amdis/datatransfers/InterpolationDataTransfer.hpp>
17#include <amdis/functions/GlobalBasis.hpp>
18#include <amdis/typetree/TreePath.hpp>
23 template <
class,
class,
class,
class>
24 class DiscreteFunction;
27 template <
class,
class>
28 class DerivativeGridFunction;
37 template <
class GB,
class T =
double,
class Traits = BackendTraits>
39 :
public VectorFacade<T, Traits::template Vector<GB>::template Impl>
46 template <
class,
class,
class,
class>
63 static auto& coefficients(
Self& self)
65 if constexpr(std::is_const_v<Self>)
74 template <
class DataTransferTag = tag::
interpolation_datatransfer>
88 template <
class GB_,
class DataTransferTag = tag::interpolation_datatransfer,
89 REQUIRES(Concepts::Similar<GB_,GB>)>
96 template <
class GV,
class PBF,
class DataTransferTag = tag::interpolation_datatransfer,
97 REQUIRES(Concepts::PreBasisFactory<PBF, GV>)>
98 DOFVector(GV
const& gridView, PBF
const& preBasisFactory, DataTransferTag tag = {})
99 :
DOFVector(std::make_shared<GB>(gridView, preBasisFactory), tag)
110 return coefficients(*
this);
115 return coefficients(*
this);
119 void backup(std::string
const& filename);
122 void restore(std::string
const& filename);
141 return dataTransfer_;
147 return dataTransfer_;
157 template <
class DataTransferTag>
167 template <
class Range = void,
class... Indices>
170 using TP = TYPEOF(makeTreePath(ii...));
172 return DF{dofVec.coefficients(), dofVec.basis_, makeTreePath(ii...)};
176 template <
class Range = void,
class... Indices>
179 using TP = TYPEOF(makeTreePath(ii...));
181 return DF{dofVec.coefficients(), dofVec.basis_, makeTreePath(ii...)};
184 template <
class Type>
185 auto makeDerivative(Type type)
const
187 using TP = TYPEOF(makeTreePath());
190 DF{coefficients(), basis_, makeTreePath()}, type};
195 template <
class Type>
198 return dofVec.makeDerivative(type);
225 dataTransfer_.preAdapt(*basis_, coefficients(), e.value);
234 dataTransfer_.adapt(*basis_, coefficients());
241 dataTransfer_.postAdapt(coefficients());
249 std::shared_ptr<GlobalBasis const> basis_;
255 DOFVector(GB&& basis)
256 -> DOFVector<Underlying_t<GB>>;
258 template <
class GB,
class DataTransferTag,
259 REQUIRES(std::is_base_of_v<tag::datatransfer, DataTransferTag>)>
260 DOFVector(GB&& basis, DataTransferTag)
261 -> DOFVector<Underlying_t<GB>>;
263 template <
class GV,
class PBF,
264 REQUIRES(Concepts::PreBasisFactory<PBF, GV>)>
265 DOFVector(GV
const& gridView, PBF
const& pbf)
268 template <
class GV,
class PBF,
class DataTransferTag,
269 REQUIRES(Concepts::PreBasisFactory<PBF, GV>),
270 REQUIRES(std::is_base_of_v<tag::datatransfer, DataTransferTag>)>
271 DOFVector(GV
const& gridView, PBF
const& pbf, DataTransferTag)
285 template <
class ValueType = double,
class GB,
286 class DataTransferTag = tag::interpolation_datatransfer>
287 DOFVector<Underlying_t<GB>, ValueType>
288 makeDOFVector(GB&& basis, DataTransferTag tag = {})
290 return {FWD(basis), tag};
295#include <amdis/DOFVector.inc.hpp>
The basic container that stores a base vector and a corresponding basis.
Definition: DOFVector.hpp:43
void updateImpl(event::preAdapt e) override
Definition: DOFVector.hpp:223
friend auto derivativeOf(DOFVector const &dofVec, Type type)
Definition: DOFVector.hpp:196
friend auto gradientOf(DOFVector const &dofVec)
Return a derivative grid-function representing the gradient (jacobian) of the DOFVector.
Definition: DOFVector.hpp:202
void updateImpl(event::postAdapt) override
Definition: DOFVector.hpp:239
VectorFacade< T, Traits::template Vector< GB >::template Impl > Coefficients
The internal coefficient vector storage.
Definition: DOFVector.hpp:54
friend auto partialDerivativeOf(DOFVector const &dofVec, std::size_t comp)
Return a derivative grid-function representing the partial derivative wrt. the components comp of the...
Definition: DOFVector.hpp:214
void setDataTransfer(DataTransfer< GB, Coefficients > dataTransfer)
Assign the DataTransfer object.
Definition: DOFVector.hpp:151
friend auto valueOf(DOFVector const &dofVec, Indices... ii)
A Generator to transform a const DOFVector into a DiscreteFunction.
Definition: DOFVector.hpp:177
void restore(std::string const &filename)
Read backup data from file.
Definition: DOFVector.inc.hpp:40
void setDataTransfer(DataTransferTag tag)
Create a new DataTransfer object based on the operation type.
Definition: DOFVector.hpp:158
DOFVector(std::shared_ptr< GB > const &basis, DataTransferTag={})
Definition: DOFVector.hpp:75
GB GlobalBasis
A global basis associated to the coefficients.
Definition: DOFVector.hpp:51
typename GlobalBasis::size_type size_type
The index/size - type.
Definition: DOFVector.hpp:57
friend auto divergenceOf(DOFVector const &dofVec)
Return a derivative grid-function representing the divergence of the DOFVector.
Definition: DOFVector.hpp:208
void backup(std::string const &filename)
Write DOFVector to file.
Definition: DOFVector.inc.hpp:15
friend auto valueOf(DOFVector &dofVec, Indices... ii)
A Generator to transform a DOFVector into a DiscreteFunction.
Definition: DOFVector.hpp:168
auto & dataTransfer()
Return the associated DataTransfer object.
Definition: DOFVector.hpp:145
void updateImpl(event::adapt e) override
Definition: DOFVector.hpp:230
DOFVector(GV const &gridView, PBF const &preBasisFactory, DataTransferTag tag={})
Definition: DOFVector.hpp:98
auto const & dataTransfer() const
Return the associated DataTransfer object.
Definition: DOFVector.hpp:139
GlobalBasis const & basis() const
Return the global basis.
Definition: DOFVector.hpp:103
T value_type
The type of the elements of the DOFVector.
Definition: DOFVector.hpp:60
DOFVector(GB_ &&basis, DataTransferTag tag={})
Definition: DOFVector.hpp:90
The base class for data transfer classes.
Definition: DataTransfer.hpp:68
A Gridfunction that returns the derivative when calling localFunction.
Definition: DerivativeGridFunction.hpp:45
A mutable view on the subspace of a DOFVector,.
Definition: DiscreteFunction.hpp:45
Implementation of the ObserverInterface.
Definition: Observer.hpp:104
The basic container that stores a base vector and a corresponding basis.
Definition: VectorFacade.hpp:39
void resize(Basis const &basis)
Resize the vector to the size of the basis.
Definition: VectorFacade.hpp:103
void resizeZero(Basis const &basis)
Resize the vector to the size of the basis and set to zero.
Definition: VectorFacade.hpp:110
constexpr bool GlobalBasis
A Dune::Functions::GlobalBasis type.
Definition: Concepts.hpp:189
Definition: DataTransfer.hpp:133
Definition: Observer.hpp:25
Definition: Observer.hpp:30
Definition: Observer.hpp:19
Definition: DerivativeTraits.hpp:21
Definition: DerivativeTraits.hpp:19
Definition: DerivativeTraits.hpp:22