]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add shortcut to detection of whether a DoF is constrained 14310/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 26 Sep 2022 09:53:35 +0000 (11:53 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 26 Sep 2022 09:56:35 +0000 (11:56 +0200)
include/deal.II/lac/affine_constraints.h

index 2912e4457bdd9c71066a1749d0fc3beb08117d4d..0fa3fafc51724c2eeee64fb7b808b6e1ba7e4946 100644 (file)
@@ -2196,6 +2196,9 @@ template <typename number>
 inline bool
 AffineConstraints<number>::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 <typename number>
 inline const std::vector<std::pair<types::global_dof_index, number>> *
 AffineConstraints<number>::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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.