From 1bd8a277c4b6c06f19a87e029eb982cd2a3511c2 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 20 Jun 2014 15:39:05 +0000 Subject: [PATCH] introduce function to set single components in mask git-svn-id: https://svn.dealii.org/trunk@33066 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/fe/component_mask.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/deal.II/include/deal.II/fe/component_mask.h b/deal.II/include/deal.II/fe/component_mask.h index bb60046fc4..04099c9a14 100644 --- a/deal.II/include/deal.II/fe/component_mask.h +++ b/deal.II/include/deal.II/fe/component_mask.h @@ -98,6 +98,11 @@ public: ComponentMask (const unsigned int n_components, const bool initializer); + /** + * Set a particular entry in the mask to a value. + */ + void set (const unsigned int index, const bool value); + /** * If this component mask has been initialized with a mask of * size greater than zero, then return the size of the mask @@ -274,6 +279,15 @@ ComponentMask::size () const } +inline +void +ComponentMask::set(const unsigned int index, const bool value) +{ + AssertIndexRange(index, component_mask.size()); + component_mask[index] = value; +} + + inline bool ComponentMask::operator [](const unsigned int component_index) const @@ -286,8 +300,7 @@ ComponentMask::operator [](const unsigned int component_index) const { // otherwise check the validity of the index and // return whatever is appropriate - Assert (component_index < component_mask.size(), - ExcIndexRange (component_index, 0, component_mask.size())); + AssertIndexRange (component_index, component_mask.size()); return component_mask[component_index]; } } -- 2.39.5