From a8bfe8182e5d3916419f72ee643ca54facbb5375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Wed, 1 Jun 2016 14:38:15 +0200 Subject: [PATCH] Implement resizeInitialize() for BitSetVector --- dune/solvers/common/resize.hh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dune/solvers/common/resize.hh b/dune/solvers/common/resize.hh index 4a369e48..88a7e6ac 100644 --- a/dune/solvers/common/resize.hh +++ b/dune/solvers/common/resize.hh @@ -30,6 +30,27 @@ void resizeInitialize(Vector& x, const Vector& y, Value&& value) x = value; } +/** + * \brief Resize and initialization vector to match size of given vector + * + * \param x Vector to resize + * \param y Model for resizing + * \param value Value to use for initialization + * + * This will resize the given vector x to match + * the size of the given vector and assign the given + * value to it. + */ +template<int size, class Alloc, class Vector, class Value> +void resizeInitialize(Dune::BitSetVector<size, Alloc>& x, const Vector& y, Value&& value) +{ + x.resize(y.size()); + if (value) + x.setAll(); + else + x.unsetAll(); +} + /** * \brief Resize and initialization vector to match size of given vector * -- GitLab