]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add functions that can add multiple lines all at once.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 5 Jan 2010 09:00:45 +0000 (09:00 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 5 Jan 2010 09:00:45 +0000 (09:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@20282 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 7c73f506c200011533a3051733896463ff2068b7..b3ac73415cf6e15e09e05753c69d951b510ae389 100644 (file)
@@ -377,6 +377,15 @@ inconvenience this causes.
 
 <ol>
 
+  <li>
+    <p>
+    New: There are now two ConstraintMatrix::add_lines functions that can
+    add several constraints at once.
+    </p>
+  <br>
+  (WB 2010/01/05)
+  </li>
+
   <li>
     <p>
     Improved: The Vector class has been equipped with an improved way to
index 424debc7487685a4c1f9f19d3de4cf76e8b48891..a0c6bc392a286558c9ae5b735334761095300bfc 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -367,6 +367,50 @@ class ConstraintMatrix : public Subscriptor
                                      */
     void add_line (const unsigned int line);
 
+                                    /**
+                                     * Call the first add_line() function for
+                                     * every index <code>i</code> for which
+                                     * <code>lines[i]</code> is true.
+                                     *
+                                     * This function essentially exists to
+                                     * allow adding several constraints of
+                                     * the form $x_i=0$ all at once, where
+                                     * the set of indices $i$ for which these
+                                     * constraints should be added are given
+                                     * by the argument of this function. On
+                                     * the other hand, just as if the
+                                     * single-argument add_line() function
+                                     * were called repeatedly, the
+                                     * constraints can later be modified to
+                                     * include linear dependencies using the
+                                     * add_entry() function as well as
+                                     * inhomogeneities using
+                                     * set_inhomogeneity().
+                                     */
+    void add_lines (const std::vector<bool> &lines);
+    
+                                    /**
+                                     * Call the first add_line() function for
+                                     * every index <code>i</code> that
+                                     * appears in the argument.
+                                     *
+                                     * This function essentially exists to
+                                     * allow adding several constraints of
+                                     * the form $x_i=0$ all at once, where
+                                     * the set of indices $i$ for which these
+                                     * constraints should be added are given
+                                     * by the argument of this function. On
+                                     * the other hand, just as if the
+                                     * single-argument add_line() function
+                                     * were called repeatedly, the
+                                     * constraints can later be modified to
+                                     * include linear dependencies using the
+                                     * add_entry() function as well as
+                                     * inhomogeneities using
+                                     * set_inhomogeneity().
+                                     */
+    void add_lines (const std::set<unsigned int> &lines);
+    
                                     /**
                                      * Add an entry to a given
                                      * line. The list of lines is
index 362527e2bc51f2fded9fc66cf85bbf5a316d5c1b..5c1330e67189ddfcfbadba2709e0a6fc933fa54b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -90,6 +90,26 @@ ConstraintMatrix::ConstraintLine::memory_consumption () const
 
 
 
+void
+ConstraintMatrix::add_lines (const std::set<unsigned int> &lines)
+{
+  for (std::set<unsigned int>::const_iterator
+        i = lines.begin(); i != lines.end(); ++i)
+    add_line (*i);
+}
+
+
+
+void
+ConstraintMatrix::add_lines (const std::vector<bool> &lines)
+{
+  for (unsigned int i=0; i<lines.size(); ++i)
+    if (lines[i] == true)
+      add_line (i);
+}
+
+
+
 void
 ConstraintMatrix::add_entries (const unsigned int                        line,
                                const std::vector<std::pair<unsigned int,double> > &col_val_pairs)

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.