]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add AffineConstraints::is_closed() 13505/head
authorPeter Munch <peterrmuench@gmail.com>
Mon, 7 Mar 2022 21:19:38 +0000 (22:19 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 8 Mar 2022 05:28:20 +0000 (06:28 +0100)
include/deal.II/lac/affine_constraints.h
include/deal.II/lac/affine_constraints.templates.h

index 553c307819c3a717c716acb78dfaf5eca14bb38f..6c736afe256daee7a4f7e8bf1939fb1316672493 100644 (file)
@@ -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
index 489624c50c340d7e5c7078a62723f8b66ea1e724..aa39f8fe46546e2cdf31d4d729ed0dde48745307 100644 (file)
@@ -938,6 +938,23 @@ AffineConstraints<number>::close()
 
 
 
+template <typename number>
+bool
+AffineConstraints<number>::is_closed() const
+{
+  return sorted || (n_constraints() == 0);
+}
+
+
+
+template <typename number>
+bool
+AffineConstraints<number>::is_closed(const MPI_Comm &comm) const
+{
+  return Utilities::MPI::min(static_cast<unsigned int>(is_closed()), comm) == 1;
+}
+
+
 template <typename number>
 void
 AffineConstraints<number>::merge(

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.