From fb8a079f16e9b07f03599c62d14a460e659bcbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Thu, 10 Mar 2016 22:42:41 +0100 Subject: [PATCH] Cleanup CanIgnore interface * Add constructor from bit vector * Add methods to set/get the bit vector * Improve doc This is a first step in getting rid of the public member. CanIgnore::ignoreNodes_ should be (add will hopefully become) protected or private. With the new methods we can avoid accessing the member directly. --- dune/solvers/common/canignore.hh | 42 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/dune/solvers/common/canignore.hh b/dune/solvers/common/canignore.hh index 53f73f9..4464ac0 100644 --- a/dune/solvers/common/canignore.hh +++ b/dune/solvers/common/canignore.hh @@ -13,17 +13,51 @@ public: using BitVector = BitVectorType; - /** \brief Default constructor */ + /** + * \brief Default constructor + */ CanIgnore() : ignoreNodes_(nullptr) {} - /** \brief Virtual destructor. Does NOT delete the bitfield! */ + /** + * \brief Constructor from bit vector + * + * This class stores a non-owning pointer to the bit vector. + */ + CanIgnore(const BitVector& i) + : ignoreNodes_(&i) + {} + + /** + * \brief Destructor + * + * Does NOT delete the bitfield! + */ ~CanIgnore() {} - /** \brief A flag for each degree of freedom stating whether the - dof should be ignored by the solver */ + /** + * \brief Set bit vector + * + * This class stores a non-owning pointer to the bit vector. + */ + void setIgnore(const BitVector& i) + { + ignoreNodes_ = &i; + } + + /** + * \brief Const access to bit vector + */ + const BitVector& ignore() const + { + return *ignoreNodes_; + } + + /** + * \brief A flag for each degree of freedom stating whether the dof should be ignored by the solver + */ const BitVectorType* ignoreNodes_; }; -- GitLab