From 89410978baf8f7f0f2011cc404741743b051b1d1 Mon Sep 17 00:00:00 2001 From: Frank Löffler Date: Wed, 3 Apr 2013 15:45:22 -0500 Subject: Let set_ accessors return whether something was changed --- Carpet/Requirements/src/Requirements.cc | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'Carpet/Requirements') diff --git a/Carpet/Requirements/src/Requirements.cc b/Carpet/Requirements/src/Requirements.cc index f5e6546ca..f46498600 100644 --- a/Carpet/Requirements/src/Requirements.cc +++ b/Carpet/Requirements/src/Requirements.cc @@ -78,10 +78,10 @@ namespace Requirements { bool boundary() const; bool ghostzones() const; bool boundary_ghostzones() const; - void set_interior(bool b); - void set_boundary(bool b); - void set_ghostzones(bool b); - void set_boundary_ghostzones(bool b); + bool set_interior(bool b); + bool set_boundary(bool b); + bool set_ghostzones(bool b); + bool set_boundary_ghostzones(bool b); void check_state(clause_t const& clause, cFunctionData const* function_data, @@ -104,21 +104,33 @@ namespace Requirements { bool gridpoint_t::boundary() const { return i_boundary; } bool gridpoint_t::ghostzones() const { return i_ghostzones; } bool gridpoint_t::boundary_ghostzones() const { return i_boundary_ghostzones; } - void gridpoint_t::set_interior(bool b) + bool gridpoint_t::set_interior(bool b) { + if (i_interior == b) + return false; i_interior = b; + return true; } - void gridpoint_t::set_boundary(bool b) + bool gridpoint_t::set_boundary(bool b) { + if (i_boundary == b) + return false; i_boundary = b; + return true; } - void gridpoint_t::set_ghostzones(bool b) + bool gridpoint_t::set_ghostzones(bool b) { + if (i_ghostzones == b) + return false; i_ghostzones = b; + return true; } - void gridpoint_t::set_boundary_ghostzones(bool b) + bool gridpoint_t::set_boundary_ghostzones(bool b) { + if (i_boundary_ghostzones == b) + return false; i_boundary_ghostzones = b; + return true; } inline ostream& operator<< (ostream& os, const gridpoint_t& a) { -- cgit v1.2.3