From: kanschat Date: Fri, 20 Jun 2014 15:39:05 +0000 (+0000) Subject: introduce function to set single components in mask X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30969719da58792ee50e8c7a9a9011a32d0b3442;p=dealii-svn.git introduce function to set single components in mask git-svn-id: https://svn.dealii.org/trunk@33066 0785d39b-7218-0410-832d-ea1e28bc413d --- 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]; } }