From 774fffe698cb09c2389f37e721edbc674b7cb824 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 26 Sep 2022 11:53:35 +0200 Subject: [PATCH] Add shortcut to detection of whether a DoF is constrained --- include/deal.II/lac/affine_constraints.h | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.39.5