]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide ConstraintMatrix::are_identity_constrained()
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 17 Aug 2013 01:14:52 +0000 (01:14 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 17 Aug 2013 01:14:52 +0000 (01:14 +0000)
git-svn-id: https://svn.dealii.org/trunk@30326 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/constraint_matrix.h
deal.II/source/lac/constraint_matrix.cc

index d247f75c4bcc445e69e13f26c9d97e28e66f3274..93d16b5ed883ce946a1b95168c766419a9a66a09 100644 (file)
@@ -56,6 +56,20 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li>
+  Fixed: Under some circumstances (see http://code.google.com/p/dealii/issues/detail?id=82)
+  the DoFTools::make_periodicity_constraints() function could create cycles in
+  the ConstraintMatrix object. This is now fixed.
+  <br>
+  (David Emerson, Wolfgang Bangerth, 2013/08/16)
+  </li>
+
+  <li>
+  New: There is now a function ConstraintMatrix::are_identity_constrained().
+  <br>
+  (Wolfgang Bangerth, 2013/08/16)
+  </li>
+
   <li>
   New: TableHandler::write_text() now also supports output in
   org-mode (http://orgmode.org/) format via a new entry in the
index 8237b943d99b9719bc86d7667d1fdf9c74dd1b76..6c623eef0ed0c17af3261de671b0a037c138f765 100644 (file)
@@ -548,6 +548,15 @@ public:
    */
   bool is_identity_constrained (const size_type index) const;
 
+  /**
+   * Return whether the two given degrees of freedom are linked by an
+   * equality constraint that either constrains index1 to be so that
+   * <code>index1=index2</code> or constrains index2 so that
+   * <code>index2=index1</code>.
+   */
+  bool are_identity_constrained (const size_type index1,
+                                     const size_type index2) const;
+
   /**
    * Return the maximum number of other
    * dofs that one dof is constrained
index 099e3703d6925fad293116dbedd2d02ac07c507a..79f46bad9c46c5b1b6a7f6e6b74797a448443197 100644 (file)
@@ -1542,6 +1542,36 @@ bool ConstraintMatrix::is_identity_constrained (const size_type index) const
 }
 
 
+bool ConstraintMatrix::are_identity_constrained (const size_type index1,
+                                                       const size_type index2) const
+{
+  if (is_constrained(index1) == true)
+    {
+      const ConstraintLine &p = lines[lines_cache[calculate_line_index(index1)]];
+      Assert (p.line == index1, ExcInternalError());
+
+      // return if an entry for this line was found and if it has only one
+      // entry equal to 1.0 and that one is index2
+      return ((p.entries.size() == 1) &&
+          (p.entries[0].first == index2) &&
+          (p.entries[0].second == 1.0));
+    }
+  else if (is_constrained(index2) == true)
+    {
+      const ConstraintLine &p = lines[lines_cache[calculate_line_index(index2)]];
+      Assert (p.line == index2, ExcInternalError());
+
+      // return if an entry for this line was found and if it has only one
+      // entry equal to 1.0 and that one is index1
+      return ((p.entries.size() == 1) &&
+          (p.entries[0].first == index1) &&
+          (p.entries[0].second == 1.0));
+    }
+  else
+    return false;
+}
+
+
 
 ConstraintMatrix::size_type
 ConstraintMatrix::max_constraint_indirections () const

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.