diff --git a/src/amdis/functions/ParallelGlobalBasis.hpp b/src/amdis/functions/ParallelGlobalBasis.hpp index 8e219428c698d4d95b7a9a69868886ca0244286c..82677c7141c86fd6c12c497a41e7eb4e0f2c6928 100644 --- a/src/amdis/functions/ParallelGlobalBasis.hpp +++ b/src/amdis/functions/ParallelGlobalBasis.hpp @@ -23,12 +23,13 @@ #include <dune/typetree/treepath.hh> -#include <amdis/common/Concepts.hpp> -#include <amdis/common/TypeTraits.hpp> -#include <amdis/linearalgebra/Traits.hpp> #include <amdis/AdaptiveGrid.hpp> #include <amdis/Observer.hpp> #include <amdis/Output.hpp> +#include <amdis/common/Concepts.hpp> +#include <amdis/common/TypeTraits.hpp> +#include <amdis/linearalgebra/Traits.hpp> +#include <amdis/typetree/MultiIndex.hpp> #if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) #include <dune/functions/functionspacebases/defaultlocalindexset.hh> @@ -65,7 +66,9 @@ namespace AMDiS using LocalView = Dune::Functions::DefaultLocalView<Self>; /// Type of the communicator - using Comm = typename BackendTraits<Self>::Comm; + using Comm = std::conditional_t<Traits::IsFlatIndex<typename Super::MultiIndex>::value, + typename BackendTraits<Self>::Comm, + SequentialCommunication>; struct DummyImpl {}; using ADH = Dune::AdaptDataHandle<Grid, DummyImpl>; diff --git a/src/amdis/typetree/MultiIndex.hpp b/src/amdis/typetree/MultiIndex.hpp index fb997f1302cc80ca580a354664a5574a23e8aacb..3ef8048fa9a411c572c6d862eddf562211a7ebfc 100644 --- a/src/amdis/typetree/MultiIndex.hpp +++ b/src/amdis/typetree/MultiIndex.hpp @@ -5,6 +5,21 @@ namespace AMDiS { + namespace Traits + { + template <class T> + struct IsFlatIndex + : std::is_integral<T> {}; + + template <class I> + struct IsFlatIndex<Dune::Functions::FlatMultiIndex<I> > + : std::true_type {}; + + template <class I> + struct IsFlatIndex<Dune::ReservedVector<I, 1> > + : std::true_type {}; + } + inline std::size_t flatMultiIndex(std::size_t idx) { return idx;