From: Peter Munch Date: Mon, 7 Mar 2022 21:19:38 +0000 (+0100) Subject: Add AffineConstraints::is_closed() X-Git-Tag: v9.4.0-rc1~400^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23a8fd751917201dcff0edfe16a4689aa5e701c6;p=dealii.git Add AffineConstraints::is_closed() --- 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(