From: wolf Date: Mon, 24 Feb 2003 22:47:21 +0000 (+0000) Subject: ConstraintMatrix::shift X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8933429119d5f0d3cf84e84d4ff9882ede5dacd;p=dealii-svn.git ConstraintMatrix::shift git-svn-id: https://svn.dealii.org/trunk@7235 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 52c4193109..7d6462a0ec 100644 --- a/deal.II/deal.II/include/dofs/dof_constraints.h +++ b/deal.II/deal.II/include/dofs/dof_constraints.h @@ -272,6 +272,28 @@ class ConstraintMatrix : public Subscriptor * boundary. */ void merge (const ConstraintMatrix &other_constraints); + + /** + * Shift all entries of this + * matrix down @p{offset} rows + * and over @p{offset} columns. + * + * This function is useful if you + * are building block matrices, + * where all blocks are built by + * the same @p{DoFHandler} + * object, i.e. the matrix size + * is larger than the number of + * degrees of freedom. Since + * several matrix rows and + * columns correspond to the same + * degrees of freedom, you'd + * generate several constraint + * objects, then shift them, and + * finally @p{merge} them + * together again. + */ + void shift (const unsigned int offset); /** * Clear all entries of this matrix. Reset diff --git a/deal.II/deal.II/source/dofs/dof_constraints.cc b/deal.II/deal.II/source/dofs/dof_constraints.cc index 38a38a0ff3..98e2118002 100644 --- a/deal.II/deal.II/source/dofs/dof_constraints.cc +++ b/deal.II/deal.II/source/dofs/dof_constraints.cc @@ -450,6 +450,21 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) +void ConstraintMatrix::shift (const unsigned int offset) +{ + for (std::vector::iterator i = lines.begin(); + i != lines.end(); i++) + { + i->line += offset; + for (std::vector >::iterator + j = i->entries.begin(); + j != i->entries.end(); j++) + j->first += offset; + } +} + + + void ConstraintMatrix::clear () { std::vector tmp; diff --git a/deal.II/doc/news/2002/c-3-4.html b/deal.II/doc/news/2002/c-3-4.html index 3eab5044c1..66e8c2531a 100644 --- a/deal.II/doc/news/2002/c-3-4.html +++ b/deal.II/doc/news/2002/c-3-4.html @@ -739,6 +739,14 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

deal.II

    +
  1. + New: The ConstraintMatrix::shift + function shifts and translates the elements of the constraint + matrix by a certain number of indices. +
    + (Roy Stogner 2003/02/24) +

    +
  2. New: The GridReordering class now uses a vastly better algorithm in 2d than previously. The new algorithm is