diff --git a/dune/solvers/common/resize.hh b/dune/solvers/common/resize.hh index 4a369e4895ec6a2ca367db36aaa53651e56d7e11..88a7e6ac33479e367bfdc6568502421118caa4a2 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 *