Commit 3e29302d by Praetorius, Simon

### Add deduction guides to DiscreteFunction to allow construction from DOFVector

parent 99e2a494
 ... @@ -38,11 +38,14 @@ namespace AMDiS ... @@ -38,11 +38,14 @@ namespace AMDiS , private Observer , private Observer { { using Self = DOFVector; using Self = DOFVector; using Coefficients = VectorFacade; public: public: /// A global basis associated to the coefficients using GlobalBasis = GB; using GlobalBasis = GB; /// The internal coefficient vector storage using Coefficients = VectorFacade; /// The index/size - type /// The index/size - type using size_type = typename GlobalBasis::size_type; using size_type = typename GlobalBasis::size_type; ... ...
 ... @@ -52,12 +52,20 @@ namespace AMDiS ... @@ -52,12 +52,20 @@ namespace AMDiS public: public: /// Constructor. Stores a pointer to the mutable `dofvector`. /// Constructor. Stores a pointer to the mutable `dofvector`. template template DiscreteFunction(Coefficients& dofVector, GlobalBasis const& basis, Path const& path) DiscreteFunction(Coefficients& dofVector, GlobalBasis const& basis, Path... path) : Super(dofVector, basis, path) : Super(dofVector, basis, path...) , mutableCoeff_(&dofVector) , mutableCoeff_(&dofVector) {} {} /// Construct a DiscreteFunction directly from a DOFVector template ().coefficients()), class GB_ = TYPEOF(*std::declval().basis())> DiscreteFunction(DV&& dofVector, Path... path) : DiscreteFunction(dofVector.coefficients(), *dofVector.basis(), path...) {} public: public: /// \brief Interpolation of GridFunction to DOFVector, assuming that there is no /// \brief Interpolation of GridFunction to DOFVector, assuming that there is no /// reference to this DOFVector in the expression. /// reference to this DOFVector in the expression. ... @@ -172,15 +180,24 @@ namespace AMDiS ... @@ -172,15 +180,24 @@ namespace AMDiS public: public: /// Constructor. Stores a pointer to the dofVector and a copy of the treePath. /// Constructor. Stores a pointer to the dofVector and a copy of the treePath. template template DiscreteFunction(Coefficients const& coefficients, GlobalBasis const& basis, Path const& path) DiscreteFunction(Coefficients const& coefficients, GlobalBasis const& basis, Path... path) : coefficients_(&coefficients) : coefficients_(&coefficients) , basis_(&basis) , basis_(&basis) , treePath_(makeTreePath(path)) , treePath_(makeTreePath(path...)) , entitySet_(basis_->gridView()) , entitySet_(basis_->gridView()) , nodeToRangeEntry_(Dune::Functions::makeDefaultNodeToRangeMap(*basis_, treePath_)) , nodeToRangeEntry_(Dune::Functions::makeDefaultNodeToRangeMap(*basis_, treePath_)) {} {} /// Construct a DiscreteFunction directly from a DOFVector template ().coefficients()), class GB_ = TYPEOF(*std::declval().basis())> DiscreteFunction(DV const& dofVector, Path... path) : DiscreteFunction(dofVector.coefficients(), *dofVector.basis(), path...) {} /// \brief Evaluate DiscreteFunction in global coordinates. NOTE: expensive /// \brief Evaluate DiscreteFunction in global coordinates. NOTE: expensive Range operator()(Domain const& x) const; Range operator()(Domain const& x) const; ... @@ -229,6 +246,21 @@ namespace AMDiS ... @@ -229,6 +246,21 @@ namespace AMDiS NodeToRangeEntry nodeToRangeEntry_; NodeToRangeEntry nodeToRangeEntry_; }; }; // deduction guides template ()...)), REQUIRES(Concepts::GlobalBasis)> DiscreteFunction(Coeff&, GB const&, Path...) -> DiscreteFunction; template ().coefficients()), class GB = decltype(*std::declval().basis()), class TP = TYPEOF(makeTreePath(std::declval()...))> DiscreteFunction(DV&, Path...) -> DiscreteFunction,std::decay_t,TP>; } // end namespace AMDiS } // end namespace AMDiS #include "DiscreteLocalFunction.inc.hpp" #include "DiscreteLocalFunction.inc.hpp" ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!