]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
ConstraintMatrix::is_identity_constrained
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Aug 2001 15:54:48 +0000 (15:54 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Aug 2001 15:54:48 +0000 (15:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@4922 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_constraints.h
deal.II/deal.II/source/dofs/dof_constraints.cc
deal.II/doc/news/2001/c-3-1.html

index cc1c2ab6834b990afc1f6475009ca1929d8741d8..ead4f6daf052f9e20955c928951d8461192f5820 100644 (file)
@@ -301,6 +301,29 @@ class ConstraintMatrix : public Subscriptor
                                      */
     bool is_constrained (const unsigned int index) const;
 
+                                    /**
+                                     * Return whether the dof is
+                                     * constrained, and whether it is
+                                     * constrained to only one other
+                                     * degree of freedom with weight
+                                     * one. The function therefore
+                                     * returns whether the degree of
+                                     * freedom would simply be
+                                     * eliminated in favor of exactly
+                                     * one other degree of freedom.
+                                     *
+                                     * The function returns @p{false}
+                                     * if either the degree of
+                                     * freedom is not constrained at
+                                     * all, or if it is constrained
+                                     * to more than one other degree
+                                     * of freedom, or if it is
+                                     * constrained to only one degree
+                                     * of freedom but with a weight
+                                     * different from one.
+                                     */
+    bool is_identity_constrained (const unsigned int index) const;
+    
                                     /**
                                      * Return the maximum number of
                                      * other dofs that one dof is
@@ -322,37 +345,45 @@ class ConstraintMatrix : public Subscriptor
                                      * constrained to.
                                      */
     unsigned int max_constraint_indirections () const;
-    
+
                                     /**
-                                     * Condense a given sparsity pattern. This
-                                     * function assumes the uncondensed
-                                     * matrix struct to be compressed and the
-                                     * one to be filled to be empty. The
-                                     * condensed structure is compressed
-                                     * afterwards.
+                                     * Condense a given sparsity
+                                     * pattern. This function assumes
+                                     * the uncondensed matrix struct
+                                     * to be compressed and the one
+                                     * to be filled to be empty. The
+                                     * condensed structure is
+                                     * compressed afterwards.
                                      *
-                                     * The constraint matrix object must be
-                                     * closed to call this function.
+                                     * The constraint matrix object
+                                     * must be closed to call this
+                                     * function.
                                      */
     void condense (const SparsityPattern &uncondensed,
                   SparsityPattern       &condensed) const;
 
 
                                     /**
-                                     * This function does much the same as
-                                     * the above one, except that it condenses
-                                     * the matrix struct 'in-place'. It does
-                                     * not remove nonzero entries from the
-                                     * matrix but adds those needed for the
-                                     * process of distribution of the
-                                     * constrained degrees of freedom.
+                                     * This function does much the
+                                     * same as the above one, except
+                                     * that it condenses the matrix
+                                     * struct 'in-place'. It does not
+                                     * remove nonzero entries from
+                                     * the matrix but adds those
+                                     * needed for the process of
+                                     * distribution of the
+                                     * constrained degrees of
+                                     * freedom.
                                      *
-                                     * Since this function adds new nonzero
-                                     * entries to the sparsity pattern, the
-                                     * argument must not be compressed. However
-                                     * the constraint matrix must be closed.
-                                     * The matrix struct is compressed at the
-                                     * end of the function.
+                                     * Since this function adds new
+                                     * nonzero entries to the
+                                     * sparsity pattern, the argument
+                                     * must not be
+                                     * compressed. However the
+                                     * constraint matrix must be
+                                     * closed.  The matrix struct is
+                                     * compressed at the end of the
+                                     * function.
                                      */
     void condense (SparsityPattern &sparsity) const;
 
index 3f22cc31208a500ea29a62bf0a73b946d0b933f8..3c281f6c1afbf0738b84a0edb7538b9f6c05fee6 100644 (file)
@@ -1114,6 +1114,35 @@ bool ConstraintMatrix::is_constrained (const unsigned int index) const
 
 
 
+bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const 
+{
+  if (sorted == true)
+    {
+      ConstraintLine index_comparison;
+      index_comparison.line = index;
+
+      const std::vector<ConstraintLine>::const_iterator
+       p = std::lower_bound (lines.begin (),
+                             lines.end (),
+                             index_comparison);
+      return ((p->line == index) &&
+             (p->entries.size() == 1) &&
+             (p->entries[0].second == 1.0));
+    }
+  else
+    {
+      for (std::vector<ConstraintLine>::const_iterator i=lines.begin();
+          i!=lines.end(); ++i)
+       if (i->line == index)
+         return ((i->entries.size() == 1) &&
+                 (i->entries[0].second == 1.0));
+
+      return false;
+    };
+};
+
+
+
 unsigned int ConstraintMatrix::max_constraint_indirections () const 
 {
   unsigned int return_value = 0;
index f4963f8afdb3e12903b997323048638945c9b0fc..47587d8f4abf1ffe16807b827c099fa486197c58 100644 (file)
@@ -573,6 +573,13 @@ documentation, etc</a>.
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       New: Member function
+       <code class="member">ConstraintMatrix::is_identity_constrained</code>.
+       <br>
+       (WB 2001/08/29)
+       </p>
+
   <li> <p>
        Fixed: in a rather rare case, some work was done twice in the
        <code class="class">KellyErrorEstimator</code> class when in

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.