Commit 6420faa7 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'feature/functionspace_concepts' into 'master'

introduce aliases for dune-function concepts

See merge request !169
parents c3f84350 64809fdd
......@@ -77,7 +77,7 @@ namespace AMDiS
/// (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_>())>
REQUIRES(Concepts::GlobalBasis<GB_>)>
DOFVector(GB_&& basis, DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: DOFVector(std::make_shared<GB>(std::move(basis)), op)
{}
......
......@@ -144,13 +144,44 @@ namespace AMDiS
using MultiIndex_t = models_t<Definition::MultiIndex(MI)>;
/// A Dune::Functions::HasIndexAccess type
template <class Range, class Index>
constexpr bool HasIndexAccess = models<Dune::Functions::Concept::HasIndexAccess(Range, Index)>;
template <class Range, class Index>
using HasIndexAccess_t = models_t<Dune::Functions::Concept::HasIndexAccess(Range, Index)>;
/// A Dune::Functions::BasisNode type
template <class N>
constexpr bool BasisNode = models<Dune::Functions::Concept::BasisNode(N)>;
template <class N>
using BasisNode_t = models_t<Dune::Functions::Concept::BasisNode(N)>;
/// A Dune::Functions::BasisTree type
template <class Tree, class GV>
constexpr bool BasisTree = models<Dune::Functions::Concept::BasisTree<GV>(Tree)>;
template <class Tree, class GV>
using BasisTree_t = models_t<Dune::Functions::Concept::BasisTree<GV>(Tree)>;
/// A Dune::Functions::LocalView type
template <class LV>
constexpr bool LocalView =
models<Dune::Functions::Concept::LocalView<typename LV::GlobalBasis>(LV)>;
template <class LV, class GB = typename LV::GlobalBasis>
constexpr bool LocalView = models<Dune::Functions::Concept::LocalView<GB>(LV)>;
template <class LV, class GB = typename LV::GlobalBasis>
using LocalView_t = models_t<Dune::Functions::Concept::LocalView<GB>(LV)>;
/// A Dune::Functions::GlobalBasis type
template <class GB, class GV = typename GB::GridView>
constexpr bool GlobalBasis = models<Dune::Functions::Concept::GlobalBasis<GV>(GB)>;
template <class LV>
using LocalView_t = models_t<Dune::Functions::Concept::LocalView<typename LV::GlobalBasis>(LV)>;
template <class GB, class GV = typename GB::GridView>
using GlobalBasis_t = models_t<Dune::Functions::Concept::GlobalBasis<GV>(GB)>;
/** @} **/
......
......@@ -5,10 +5,9 @@
#include <dune/common/concept.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <dune/functions/common/indexaccess.hh>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/Concepts.hpp>
namespace AMDiS
{
......@@ -25,7 +24,7 @@ namespace AMDiS
{
// Specialization for ranges with operator[] access
template <class Node, class TreePath, class Range,
REQUIRES(Dune::models<Dune::Functions::Concept::HasIndexAccess, Range, Dune::index_constant<0>>())>
REQUIRES(Concepts::HasIndexAccess<Range, Dune::index_constant<0>>)>
decltype(auto) operator()(const Node& node, const TreePath& treePath, Range&& y) const
{
return Dune::Functions::resolveStaticMultiIndex(y, transformTreePath(treePath));
......@@ -33,7 +32,7 @@ namespace AMDiS
// Specialization for non-container ranges
template <class Node, class TreePath, class Range,
REQUIRES(not Dune::models<Dune::Functions::Concept::HasIndexAccess, Range, Dune::index_constant<0>>())>
REQUIRES(not Concepts::HasIndexAccess<Range, Dune::index_constant<0>>)>
decltype(auto) operator()(const Node& node, const TreePath& treePath, Range&& y) const
{
return std::forward<Range>(y);
......
#pragma once
#include <dune/common/rangeutilities.hh>
#include <dune/functions/functionspacebases/concepts.hh>
#include <amdis/common/Concepts.hpp>
#include <amdis/typetree/MultiIndex.hpp>
#include <amdis/utility/MappedRangeView.hpp>
......@@ -12,9 +12,8 @@ namespace AMDiS
template <class LocalView, class Node>
auto nodeIndices(LocalView const& localView, Node const& node)
{
using namespace Dune::Functions;
static_assert(Dune::models<Concept::LocalView<typename LocalView::GlobalBasis>, LocalView>(), "");
static_assert(Dune::models<Concept::BasisTree<typename LocalView::GridView>, Node>(), "");
static_assert(Concepts::LocalView<LocalView>, "");
static_assert(Concepts::BasisTree<Node, typename LocalView::GridView>, "");
return mappedRangeView(Dune::range(node.size()), [&](std::size_t j) -> typename LocalView::MultiIndex {
return localView.index(node.localIndex(j));
......@@ -25,8 +24,7 @@ namespace AMDiS
template <class LocalView>
auto nodeIndices(LocalView const& localView)
{
using namespace Dune::Functions;
static_assert(Dune::models<Concept::LocalView<typename LocalView::GlobalBasis>, LocalView>(), "");
static_assert(Concepts::LocalView<LocalView>, "");
return mappedRangeView(Dune::range(localView.size()), [&](std::size_t i) -> typename LocalView::MultiIndex {
return localView.index(i);
......
......@@ -106,7 +106,7 @@ namespace AMDiS
*/
template <class GB_,
Dune::disableCopyMove<Self, GB_> = 0,
REQUIRES(Dune::models<Dune::Functions::Concept::GlobalBasis<GridView>, GB_>())>
REQUIRES(Concepts::GlobalBasis<GB_,GridView>)>
ParallelGlobalBasis(GB_&& from)
: ParallelGlobalBasis(std::string(""), from.gridView().grid(), from.preBasis())
{}
......
......@@ -26,7 +26,7 @@ namespace AMDiS
* \tparam TreePath A realization of \ref Dune::TypeTree::HybridTreePath
*
* **Requirements:**
* - GB models \ref Dune::Functions::Concept::GlobalBasis
* - GB models \ref Concepts::GlobalBasis
**/
template <class Coeff, class GB, class TreePath = Dune::TypeTree::HybridTreePath<>>
class DiscreteFunction;
......
......@@ -192,7 +192,7 @@ namespace AMDiS
*/
template <class LocalView, class Node, class Buffer,
REQUIRES(Concepts::LocalView<LocalView>),
REQUIRES(Dune::models<Dune::Functions::Concept::BasisNode, Node>())>
REQUIRES(Concepts::BasisNode<Node>)>
void gather(LocalView const& localView, Node const& node, Buffer& buffer) const
{
test_exit(state_ == VectorState::unknown ||
......@@ -235,7 +235,7 @@ namespace AMDiS
*/
template <class LocalView, class Node, class NodeVector, class MaskRange, class Assign,
REQUIRES(Concepts::LocalView<LocalView>),
REQUIRES(Dune::models<Dune::Functions::Concept::BasisNode, Node>())>
REQUIRES(Concepts::BasisNode<Node>)>
void scatter(LocalView const& localView, Node const& node, NodeVector const& localVector,
MaskRange const& mask, Assign assign)
{
......@@ -258,7 +258,7 @@ namespace AMDiS
// [[expects: node is in localView.tree()]]
template <class LocalView, class Node, class NodeVector, class Assign,
REQUIRES(Concepts::LocalView<LocalView>),
REQUIRES(Dune::models<Dune::Functions::Concept::BasisNode, Node>())>
REQUIRES(Concepts::BasisNode<Node>)>
void scatter(LocalView const& localView, Node const& node, NodeVector const& localVector, Assign assign)
{
scatter(localView, node, localVector, FakeContainer<bool,true>{}, assign);
......
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