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>
27 template <
class,
class>
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>
89 REQUIRES(Concepts::Similar<GB_,GB>)>
91 :
DOFVector(Dune::wrap_or_move(FWD(basis)), tag)
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_;
153 dataTransfer_ = std::move(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_;
258 template <
class GB,
class DataTransferTag,
259 REQUIRES(std::is_base_of_v<tag::datatransfer, DataTransferTag>)>
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,
288 makeDOFVector(GB&& basis, DataTransferTag tag = {})
290 return {FWD(basis), tag};
295 #include <amdis/DOFVector.inc.hpp> auto const & dataTransfer() const
Return the associated DataTransfer object.
Definition: DOFVector.hpp:139
GB GlobalBasis
A global basis associated to the coefficients.
Definition: DOFVector.hpp:51
friend auto gradientOf(DOFVector const &dofVec)
Return a derivative grid-function representing the gradient (jacobian) of the DOFVector.
Definition: DOFVector.hpp:202
T value_type
The type of the elements of the DOFVector.
Definition: DOFVector.hpp:60
VectorFacade< T, Traits::template Vector< GB >::template Impl > Coefficients
The internal coefficient vector storage.
Definition: DOFVector.hpp:54
DOFVector(std::shared_ptr< GB > const &basis, DataTransferTag={})
Definition: DOFVector.hpp:75
The basic container that stores a base vector and a corresponding basis.
Definition: VectorFacade.hpp:38
DOFVector(GB_ &&basis, DataTransferTag tag={})
Definition: DOFVector.hpp:90
Definition: DerivativeTraits.hpp:22
void updateImpl(event::postAdapt) override
Definition: DOFVector.hpp:239
void updateImpl(event::adapt e) override
Definition: DOFVector.hpp:230
The basic container that stores a base vector and a corresponding basis.
Definition: DOFVector.hpp:38
Definition: AdaptBase.hpp:6
friend auto derivativeOf(DOFVector const &dofVec, Type type)
Definition: DOFVector.hpp:196
A mutable view on the subspace of a DOFVector,.
Definition: DOFVector.hpp:24
Definition: DerivativeTraits.hpp:21
friend auto valueOf(DOFVector const &dofVec, Indices... ii)
A Generator to transform a const DOFVector into a DiscreteFunction.
Definition: DOFVector.hpp:177
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
Implementation of the ObserverInterface.
Definition: Observer.hpp:102
friend auto divergenceOf(DOFVector const &dofVec)
Return a derivative grid-function representing the divergence of the DOFVector.
Definition: DOFVector.hpp:208
Definition: InterpolationDataTransfer.hpp:19
Definition: Observer.hpp:25
A Gridfunction that returns the derivative when calling localFunction.
Definition: DOFVector.hpp:28
void setDataTransfer(DataTransfer< GB, Coefficients > dataTransfer)
Assign the DataTransfer object.
Definition: DOFVector.hpp:151
Definition: Observer.hpp:30
void resize(Basis const &basis)
Resize the vector to the size of the basis.
Definition: VectorFacade.hpp:103
The base class for data transfer classes.
Definition: DataTransfer.hpp:66
Definition: DataTransfer.hpp:132
GlobalBasis const & basis() const
Return the global basis.
Definition: DOFVector.hpp:103
friend auto valueOf(DOFVector &dofVec, Indices... ii)
A Generator to transform a DOFVector into a DiscreteFunction.
Definition: DOFVector.hpp:168
void resizeZero(Basis const &basis)
Resize the vector to the size of the basis and set to zero.
Definition: VectorFacade.hpp:110
DOFVector(GV const &gridView, PBF const &preBasisFactory, DataTransferTag tag={})
Definition: DOFVector.hpp:98
void setDataTransfer(DataTransferTag tag)
Create a new DataTransfer object based on the operation type.
Definition: DOFVector.hpp:158
Definition: Observer.hpp:19
auto & dataTransfer()
Return the associated DataTransfer object.
Definition: DOFVector.hpp:145
Definition: DerivativeTraits.hpp:19
void backup(std::string const &filename)
Write DOFVector to file.
Definition: DOFVector.inc.hpp:15
typename GlobalBasis::size_type size_type
The index/size - type.
Definition: DOFVector.hpp:57
void updateImpl(event::preAdapt e) override
Definition: DOFVector.hpp:223
void restore(std::string const &filename)
Read backup data from file.
Definition: DOFVector.inc.hpp:40