From: wolf Date: Wed, 29 Aug 2001 15:54:48 +0000 (+0000) Subject: ConstraintMatrix::is_identity_constrained X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79144c49da0d175b859e5ccb287e5892a62ec028;p=dealii-svn.git ConstraintMatrix::is_identity_constrained git-svn-id: https://svn.dealii.org/trunk@4922 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_constraints.h b/deal.II/deal.II/include/dofs/dof_constraints.h index cc1c2ab683..ead4f6daf0 100644 --- a/deal.II/deal.II/include/dofs/dof_constraints.h +++ b/deal.II/deal.II/include/dofs/dof_constraints.h @@ -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; diff --git a/deal.II/deal.II/source/dofs/dof_constraints.cc b/deal.II/deal.II/source/dofs/dof_constraints.cc index 3f22cc3120..3c281f6c1a 100644 --- a/deal.II/deal.II/source/dofs/dof_constraints.cc +++ b/deal.II/deal.II/source/dofs/dof_constraints.cc @@ -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::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::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; diff --git a/deal.II/doc/news/2001/c-3-1.html b/deal.II/doc/news/2001/c-3-1.html index f4963f8afd..47587d8f4a 100644 --- a/deal.II/doc/news/2001/c-3-1.html +++ b/deal.II/doc/news/2001/c-3-1.html @@ -573,6 +573,13 @@ documentation, etc.

deal.II

    +
  1. + New: Member function + ConstraintMatrix::is_identity_constrained. +
    + (WB 2001/08/29) +

    +
  2. Fixed: in a rather rare case, some work was done twice in the KellyErrorEstimator class when in