diff --git a/src/amdis/assembler/ConvectionDiffusionOperator.hpp b/src/amdis/assembler/ConvectionDiffusionOperator.hpp index c53078c3062f183857b4fae97e29bcde91f58a23..77761d9db3a1333e57843a7e2c7632fe242ca764 100644 --- a/src/amdis/assembler/ConvectionDiffusionOperator.hpp +++ b/src/amdis/assembler/ConvectionDiffusionOperator.hpp @@ -104,7 +104,7 @@ namespace AMDiS jacobian.mv(shapeGradients[i][0], gradients[i]); const auto A = localFctA(local); - WorldVector b; b = localFctB(local); + WorldVector b = makeB(localFctB(local)); const auto c = localFctC(local); IF_CONSTEXPR(conserving) { @@ -194,6 +194,21 @@ namespace AMDiS [] (auto) { return 0; }); } + template <class T, int N> + static FieldVector<T,dow> makeB(FieldVector<T,N> const& b) { return b; } + + template <class T, int N> + static FieldVector<T,dow> makeB(FieldVector<T,N>&& b) { return std::move(b); } + + template <class T> + static FieldVector<T,dow> makeB(FieldVector<T,1> const& b) { return {T(b)}; } + + template <class T> + static FieldVector<T,dow> makeB(FieldVector<T,1>&& b) { return {T(b)}; } + + template <class T, std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> + static FieldVector<T,dow> makeB(T b) { return {b}; } + private: GridFctA gridFctA_; GridFctB gridFctB_;