Skip to content
Snippets Groups Projects
Commit 9f2d694e authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[forms] Generalize local products to a few more cases

parent 44633d85
No related branches found
No related tags found
No related merge requests found
Pipeline #76056 passed
......@@ -96,6 +96,20 @@ namespace Dune::Fufem::Forms::LocalOperators {
return result;
}
template<class... V, class... W>
auto operator()(const Dune::MultiTypeBlockVector<V...>& x, const Dune::MultiTypeBlockVector<W...>& y) const
{
using namespace Dune::Hybrid;
using K1 = typename Dune::FieldTraits<Dune::MultiTypeBlockVector<V...>>::field_type;
using K2 = typename Dune::FieldTraits<Dune::MultiTypeBlockVector<W...>>::field_type;
using K = typename PromotionTraits<K1,K2>::PromotedType;
auto result = K(0);
forEach(integralRange(Hybrid::size(x)), [&](auto&& i) {
result += DotOp()(x[i], y[i]);
});
return result;
}
};
struct MultOp {
......@@ -128,6 +142,19 @@ namespace Dune::Fufem::Forms::LocalOperators {
return x[0]*y;
}
template<class... Rows, class... V>
auto operator()(const Dune::MultiTypeBlockMatrix<Rows...>& A, const Dune::MultiTypeBlockVector<V...>& x) const
{
using namespace Dune::Hybrid;
using K1 = typename Dune::FieldTraits<Dune::MultiTypeBlockMatrix<Rows...>>::field_type;
using K2 = typename Dune::FieldTraits<Dune::MultiTypeBlockVector<V...>>::field_type;
using K = typename PromotionTraits<K1,K2>::PromotedType;
using Result = typename Dune::MultiTypeBlockVector<Dune::FieldVector<K, std::tuple_element_t<0, Rows>::rows>...>;
auto y = Result();
A.mv(x, y);
return y;
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment