From: Martin Kronbichler Date: Mon, 26 Sep 2022 09:53:35 +0000 (+0200) Subject: Add shortcut to detection of whether a DoF is constrained X-Git-Tag: v9.5.0-rc1~925^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14310%2Fhead;p=dealii.git Add shortcut to detection of whether a DoF is constrained --- diff --git a/include/deal.II/lac/affine_constraints.h b/include/deal.II/lac/affine_constraints.h index 2912e4457b..0fa3fafc51 100644 --- a/include/deal.II/lac/affine_constraints.h +++ b/include/deal.II/lac/affine_constraints.h @@ -2196,6 +2196,9 @@ template inline bool AffineConstraints::is_constrained(const size_type index) const { + if (lines.empty()) + return false; + const size_type line_index = calculate_line_index(index); return ((line_index < lines_cache.size()) && (lines_cache[line_index] != numbers::invalid_size_type)); @@ -2223,6 +2226,9 @@ template inline const std::vector> * AffineConstraints::get_constraint_entries(const size_type line_n) const { + if (lines.empty()) + return nullptr; + // check whether the entry is constrained. could use is_constrained, but // that means computing the line index twice const size_type line_index = calculate_line_index(line_n);