]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
ConstraintMatrix::shift
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Feb 2003 22:47:21 +0000 (22:47 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Feb 2003 22:47:21 +0000 (22:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@7235 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/2002/c-3-4.html

index 52c4193109507c6795a3165221a26e90f8a97074..7d6462a0ecfb900430eb4ca82b614452eba461b5 100644 (file)
@@ -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
index 38a38a0ff395dcbc270344b634032e0d1cb32f0c..98e211800200e065aee8309963129d850b3dc1a7 100644 (file)
@@ -450,6 +450,21 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints)
 
 
 
+void ConstraintMatrix::shift (const unsigned int offset)
+{
+  for (std::vector<ConstraintLine>::iterator i = lines.begin();
+       i != lines.end(); i++)
+    {
+      i->line += offset;
+      for (std::vector<std::pair<unsigned int,double> >::iterator 
+            j = i->entries.begin();
+          j != i->entries.end(); j++)
+       j->first += offset;
+    }
+}
+
+
+
 void ConstraintMatrix::clear ()
 {
   std::vector<ConstraintLine> tmp;
index 3eab5044c1e268ad2963bfb2a3568714dc242d6f..66e8c2531ada7ae5a4c787fb1b7ba5ea973fadac 100644 (file)
@@ -739,6 +739,14 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       New: The <code class="member">ConstraintMatrix::shift</code>
+       function shifts and translates the elements of the constraint
+       matrix by a certain number of indices.
+       <br>
+       (Roy Stogner 2003/02/24)
+       </p>
+
   <li> <p>
        New: The <code class="class">GridReordering</code> class now uses a
        vastly better algorithm in 2d than previously. The new algorithm is

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.