Commit f2cd4eb4 authored by Müller, Felix's avatar Müller, Felix
Browse files

Replace explicit type Dune::DefaultGlobalBasis in ctor argument with concept check

parent 69256912
......@@ -3,8 +3,11 @@
#include <memory>
#include <utility>
#include <dune/common/concept.hh>
#include <dune/common/shared_ptr.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <amdis/DataTransfer.hpp>
#include <amdis/LinearAlgebra.hpp>
#include <amdis/Observer.hpp>
......@@ -13,15 +16,6 @@
#include <amdis/gridfunctions/DiscreteFunction.hpp>
#include <amdis/typetree/TreePath.hpp>
namespace Dune
{
namespace Functions
{
template <class PB>
class DefaultGlobalBasis;
}
}
namespace AMDiS
{
// Forward declarations
......@@ -61,7 +55,7 @@ namespace AMDiS
using Traits = TraitsType;
public:
/// Constructor. Stores the shared_ptr of the basis and creates a new DataTransfer.
/// (1) Constructor. Stores the shared_ptr of the basis and creates a new DataTransfer.
DOFVector(std::shared_ptr<GB> const& basis,
DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: Coefficients(*basis)
......@@ -72,19 +66,22 @@ namespace AMDiS
, basis_(basis)
{}
/// Constructor creating a new basis from a Dune::Functions::DefaultGlobalBasis.
// TODO(FM): Replace explicit type with concept check
DOFVector(Dune::Functions::DefaultGlobalBasis<typename GB::PreBasis>&& basis,
DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: DOFVector(std::make_shared<GB>(std::move(basis)), op)
{}
/// (2) Constructor. Forwards to (1) by wrapping reference into non-destroying
/// shared_ptr, see \ref Dune::wrap_or_move.
template <class GB_,
REQUIRES(Concepts::Similar<GB_,GB>)>
DOFVector(GB_&& basis, DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: DOFVector(Dune::wrap_or_move(FWD(basis)), op)
{}
/// (3) Constructor. Forwards to (1) by creating a new basis from a dune-functions basis.
template <class GB_,
REQUIRES(not Concepts::Similar<GB_,GB>),
REQUIRES(Dune::models<Dune::Functions::Concept::GlobalBasis<typename GB_::GridView>, GB_>())>
DOFVector(GB_&& basis, DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: DOFVector(std::make_shared<GB>(std::move(basis)), op)
{}
std::shared_ptr<GlobalBasis const> const& basis() const { return basis_; }
template <class TreePath = RootTreePath>
......
......@@ -99,12 +99,15 @@ namespace AMDiS
: ParallelGlobalBasis(std::string(""), grid, FWD(args)...)
{}
/// Converting constructor from Dune::DefaultGlobalBasis<PB>.
/// Converting constructor from dune-functions style basis.
/**
* This will create a new ParallellGlobalBasis. The pre-basis is copied from the constructor
* This will create a new ParallelGlobalBasis. The pre-basis is copied from the constructor
* argument and a new communication object is built.
*/
ParallelGlobalBasis(Dune::Functions::DefaultGlobalBasis<PB>&& from)
template <class GB_,
Dune::disableCopyMove<Self, GB_> = 0,
REQUIRES(Dune::models<Dune::Functions::Concept::GlobalBasis<GridView>, GB_>())>
ParallelGlobalBasis(GB_&& from)
: ParallelGlobalBasis(std::string(""), from.gridView().grid(), from.preBasis())
{}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment