From 23a8fd751917201dcff0edfe16a4689aa5e701c6 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 7 Mar 2022 22:19:38 +0100 Subject: [PATCH] Add AffineConstraints::is_closed() --- include/deal.II/lac/affine_constraints.h | 16 ++++++++++++++++ .../deal.II/lac/affine_constraints.templates.h | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/deal.II/lac/affine_constraints.h b/include/deal.II/lac/affine_constraints.h index 553c307819..6c736afe25 100644 --- a/include/deal.II/lac/affine_constraints.h +++ b/include/deal.II/lac/affine_constraints.h @@ -770,6 +770,22 @@ public: void close(); + /** + * Check if the function close() was called or there are no + * constraints locally, which is normally the case if a dummy + * AffineConstraints was created for the DG case. + */ + bool + is_closed() const; + + /** + * Check if the function close() was called or there are no + * constraints globally, which is normally the case if a dummy + * AffineConstraints was created for the DG case. + */ + bool + is_closed(const MPI_Comm &comm) const; + /** * Merge the constraints represented by the object given as argument into * the constraints represented by this object. Both objects may or may not diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 489624c50c..aa39f8fe46 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -938,6 +938,23 @@ AffineConstraints::close() +template +bool +AffineConstraints::is_closed() const +{ + return sorted || (n_constraints() == 0); +} + + + +template +bool +AffineConstraints::is_closed(const MPI_Comm &comm) const +{ + return Utilities::MPI::min(static_cast(is_closed()), comm) == 1; +} + + template void AffineConstraints::merge( -- 2.39.5