Skip to content
Snippets Groups Projects

Feature/replace make functions

Merged Müller, Felix requested to merge feature/replace_make_functions into master
All threads resolved!
23 files
+ 51
193
Compare changes
  • Side-by-side
  • Inline
Files
23
@@ -37,6 +37,13 @@
namespace AMDiS
{
template <class PreBasisFactory>
using MultiIndex = std::conditional_t<
(remove_cvref_t<PreBasisFactory>::requiredMultiIndexSize == 1),
Dune::Functions::FlatMultiIndex<std::size_t>,
Dune::ReservedVector<std::size_t, remove_cvref_t<PreBasisFactory>::requiredMultiIndexSize>>;
/**
* \brief Parallel global basis defined on a (sequential) pre-basis
*
@@ -92,11 +99,11 @@ namespace AMDiS
, comm_(CommunicationCreator<Comm>::create(static_cast<Super const&>(*this), name + "->solver"))
{}
/// Construct this global basis with empty name
template <class... Args,
Dune::Functions::enableIfConstructible<PreBasis, Args...> = 0>
ParallelGlobalBasis(Grid const& grid, Args&&... args)
: ParallelGlobalBasis(std::string(""), grid, FWD(args)...)
/// Construct this global basis with a preBasisFactory
template <class PBF>
ParallelGlobalBasis(std::string const& name, GridView const& gridView, PBF&& preBasisFactory)
: ParallelGlobalBasis(name, gridView.grid(),
preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))
{}
/// Converting constructor from dune-functions style basis.
@@ -105,10 +112,16 @@ namespace AMDiS
* argument and a new communication object is built.
*/
template <class GB_,
Dune::disableCopyMove<Self, GB_> = 0,
REQUIRES(Concepts::GlobalBasis<GB_,GridView>)>
ParallelGlobalBasis(GB_&& from)
: ParallelGlobalBasis(std::string(""), from.gridView().grid(), from.preBasis())
ParallelGlobalBasis(std::string const& name, GB_&& from)
: ParallelGlobalBasis(name, from.gridView().grid(), from.preBasis())
{}
/// Construct this global basis with empty name
template <class Arg, class... Args,
REQUIRES(!std::is_same_v<std::string, remove_cvref_t<Arg>>)>
ParallelGlobalBasis(Arg&& arg, Args&&... args)
: ParallelGlobalBasis(std::string(""), FWD(arg), FWD(args)...)
{}
/// Copy constructor
@@ -175,29 +188,15 @@ namespace AMDiS
};
template <class MultiIndex, class GV, class PBF>
auto makeGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
{
auto preBasis = preBasisFactory.template makePreBasis<MultiIndex>(gridView);
return ParallelGlobalBasis<TYPEOF(preBasis)>(name, gridView.grid(), std::move(preBasis));
}
// Deduction guides
template <class GV, class PBF>
auto makeGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
{
using RawPreBasisFactory = remove_cvref_t<PBF>;
using MultiIndex = std::conditional_t<
(RawPreBasisFactory::requiredMultiIndexSize == 1),
Dune::Functions::FlatMultiIndex<std::size_t>,
Dune::ReservedVector<std::size_t, RawPreBasisFactory::requiredMultiIndexSize>>;
return makeGlobalBasis<MultiIndex, GV, PBF>(name, gridView, FWD(preBasisFactory));
}
ParallelGlobalBasis(std::string const& name, GV const& gridView, PBF&& preBasisFactory)
-> ParallelGlobalBasis<decltype(
preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))>;
template <class GV, class PBF>
auto makeGlobalBasis(GV const& gridView, PBF&& preBasisFactory)
{
return makeGlobalBasis(std::string(""), gridView, FWD(preBasisFactory));
}
ParallelGlobalBasis(GV const& gridView, PBF&& preBasisFactory)
-> ParallelGlobalBasis<decltype(
preBasisFactory.template makePreBasis<MultiIndex<PBF>>(gridView))>;
} // end namespace AMDiS
Loading