]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add ParalutionWrappers::Vector in the list of SERIAL_VECTOR and start the modificatio...
authorturcksin <turcksin@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 16 Dec 2013 17:04:36 +0000 (17:04 +0000)
committerturcksin <turcksin@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 16 Dec 2013 17:04:36 +0000 (17:04 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_paralution@32027 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/config/template-arguments.in
deal.II/cmake/configure/configure_2_paralution.cmake
deal.II/include/deal.II/lac/paralution_vector.h
deal.II/include/deal.II/lac/trilinos_vector_base.h
deal.II/source/algorithms/operator.cc
deal.II/source/dofs/dof_accessor_get.cc
deal.II/source/dofs/dof_accessor_set.cc
deal.II/source/lac/constraint_matrix.cc
deal.II/source/meshworker/mesh_worker_vector_selector.cc
deal.II/source/multigrid/mg_base.cc
deal.II/source/numerics/data_out_dof_data.cc

index 7e97a5eea3338507dd7a07f1a1bbe410d5df0ed1..75194b4f075b5ecc0bfaff932ace59b89dc96d08 100644 (file)
@@ -30,6 +30,8 @@ SERIAL_VECTORS := { Vector<double>;
                    @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@;
                    @DEAL_II_EXPAND_PETSC_VECTOR@;
                    @DEAL_II_EXPAND_PETSC_MPI_VECTOR@;
+        @DEAL_II_EXPAND_PARALUTION_VECTOR_FLOAT@;
+        @DEAL_II_EXPAND_PARALUTION_VECTOR_DOUBLE@;
 
                    @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@;
                    @DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@;
@@ -40,13 +42,15 @@ SERIAL_VECTORS := { Vector<double>;
 EXTERNAL_SEQUENTIAL_VECTORS := { @DEAL_II_EXPAND_TRILINOS_VECTOR@;
                                  @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@;
                                  @DEAL_II_EXPAND_PETSC_VECTOR@;
-                                 @DEAL_II_EXPAND_PETSC_BLOCKVECTOR@
+                                 @DEAL_II_EXPAND_PETSC_BLOCKVECTOR@;
+                                 @DEAL_II_EXPAND_PARALUTION_VECTOR_FLOAT@;
+                                 @DEAL_II_EXPAND_PARALUTION_VECTOR_DOUBLE@;
                                }
 
 EXTERNAL_PARALLEL_VECTORS := { @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@;
                                @DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@;
                                @DEAL_II_EXPAND_PETSC_MPI_VECTOR@;
-                               @DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR@
+                               @DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR@;
                              }
 
 VECTORS_WITH_MATRIX := { Vector<double>;
index 7d5b7c701904982aca7c2694062d18361c6d6c99..d49531363564fd12e521cbf5a42791d0010ab875 100644 (file)
 # Configuration for the paralution library:
 #
 
-#
-# The user has to know the location of the PARALUTION headers as well:
-#
-SET(PARALUTION_ADD_TO_USER_INCLUDE_DIRS TRUE)
 
+MACRO(FEATURE_PARALUTION_CONFIGURE_EXTERNAL)
+  
+  SET(PARALUTION_ADD_TO_USER_INCLUDE_DIRS TRUE)
+  REGISTER_FEATURE(PARALUTION)
+
+  SET(DEAL_II_EXPAND_PARALUTION_VECTOR_FLOAT "ParalutionWrappers::Vector<float>")
+  SET(DEAL_II_EXPAND_PARALUTION_VECTOR_DOUBLE "ParalutionWrappers::Vector<double>")
+
+ENDMACRO()
 
 CONFIGURE_FEATURE(PARALUTION)
index 00bee9a58ec1a8729ded5e315eb0350d926eaebe..e743d8929cbd41dfbeb8cc65038ec694a3d0bf85 100644 (file)
@@ -121,6 +121,12 @@ namespace ParalutionWrappers
     //TODO look to add fast
     void reinit(const size_type N);
 
+    /**
+     * Change the dimension of the vector to that of the vector v. The vector
+     * is filled with zeros.
+     */
+    void reinit(const Vector<Number> &v);
+
     /**
      * Return dimension of the vector.
      */
@@ -153,6 +159,12 @@ namespace ParalutionWrappers
      * cannot be moved.
      */
     const_iterator end() const;
+
+    /**
+     * $l_2$-norm of the vector. The ssquare root of the sum of the squares of
+     * the elements.
+     */
+    Number l2_norm() const;
     //@}
 
     /**
@@ -217,6 +229,12 @@ namespace ParalutionWrappers
      */
     void add(const Number s);
 
+    /**
+     * Simple addition of a multiple of a vector, i.e. <tt>*this += a*V</tt>.
+     */
+    void add(const Number          a,
+             const Vector<Number> &v);
+
     /**
      * Scale each element of the vector by a constant value.
      */
@@ -278,6 +296,15 @@ namespace ParalutionWrappers
 
 
 
+  template <typename Number>
+  void Vector<Number>::reinit(const Vector<Number> &v)
+  {
+    local_vector.Clear();
+    local_vector.Allocate("deal_ii_vector",v.size());
+  }
+
+
+
   template <typename Number>
   inline std::size_t Vector<Number>::size() const
   {
@@ -318,6 +345,14 @@ namespace ParalutionWrappers
 
 
 
+  template <typename Number>
+  inline Number Vector<Number>::l2_norm() const
+  {
+    return local_vector.Norm();
+  }
+
+
+
   template <typename Number>
   inline Number Vector<Number>::operator() (const size_type i) const
   {
@@ -409,6 +444,16 @@ namespace ParalutionWrappers
   }
 
 
+  template <typename Number>
+  inline void Vector<Number>::add(const Number a,const Vector<Number> &v)
+  {
+    Assert(numbers::is_finite(a),ExcNumberNotFinite());
+    Assert(size()==v.size(),ExcDimensionMismatch(size(),v.size()));
+
+    local_vector.ScaleAddScale(1.,v.paralution_vector(),a);
+  }
+
+
 
   template <typename Number>
   inline Vector<Number>& Vector<Number>::operator*= (const Number factor)
index b3035c0da18cb1f39714f937c1b087713e8711da..cc7ad7569abe9aa2ddc6e5a719be23353e2dd7e3 100644 (file)
@@ -861,7 +861,7 @@ namespace TrilinosWrappers
 
     /**
      * Simple addition of a multiple
-     * of a vector, i.e. <tt>*this =
+     * of a vector, i.e. <tt>*this +=
      * a*V</tt>.
      */
     void add (const TrilinosScalar  a,
@@ -869,7 +869,7 @@ namespace TrilinosWrappers
 
     /**
      * Multiple addition of scaled
-     * vectors, i.e. <tt>*this = a*V +
+     * vectors, i.e. <tt>*this += a*V +
      * b*W</tt>.
      */
     void add (const TrilinosScalar  a,
index 8f0bcc05169732f2e4200d1b69ac31375c96aada..a019d1a5c22d8cb94084380d3756017bd7d79229 100644 (file)
@@ -31,6 +31,7 @@
 #include <deal.II/lac/petsc_block_vector.h>
 #include <deal.II/lac/trilinos_vector.h>
 #include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/paralution_vector.h>
 
 
 DEAL_II_NAMESPACE_OPEN
index 9b9ca8b7b8e897fe01a012741b7688ce7f9665ef..0ae8220b479021f77a3fd2874846aa356aa2c0ae 100644 (file)
@@ -22,6 +22,7 @@
 #include <deal.II/lac/petsc_block_vector.h>
 #include <deal.II/lac/trilinos_vector.h>
 #include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/paralution_vector.h>
 #include <deal.II/lac/sparse_matrix.h>
 
 #include <deal.II/dofs/dof_accessor.h>
index f11fc845a01b821d47ebf0f83ab255a703a1f997..64572315fae17efb391912f86d913ef55a67724b 100644 (file)
@@ -22,6 +22,7 @@
 #include <deal.II/lac/petsc_block_vector.h>
 #include <deal.II/lac/trilinos_vector.h>
 #include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/paralution_vector.h>
 #include <deal.II/lac/sparse_matrix.h>
 
 #include <deal.II/dofs/dof_accessor.h>
index 493b3f7c1651c2cc68b10688189fe67339f7e5de..8b5d556634c0d719f3c397f40573dc9f45ce2850 100644 (file)
@@ -41,6 +41,7 @@
 #include <deal.II/lac/trilinos_sparse_matrix.h>
 #include <deal.II/lac/trilinos_block_sparse_matrix.h>
 #include <deal.II/lac/matrix_block.h>
+#include <deal.II/lac/paralution_vector.h>
 
 #include <algorithm>
 #include <numeric>
index 36d58a446a9fbd58ba609444433024b7a77fb797..77bdeaad1aeb2114a0ef08e13b2b5fb2acbf48dd 100644 (file)
@@ -23,6 +23,7 @@
 #include <deal.II/lac/petsc_block_vector.h>
 #include <deal.II/lac/trilinos_vector.h>
 #include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/paralution_vector.h>
 
 #include <deal.II/meshworker/vector_selector.templates.h>
 
index 424e043082f5790fb848a8095f4e1d5898871e3d..db3884e59d282c79cdd410e36008842dc6a8047b 100644 (file)
@@ -22,6 +22,7 @@
 #include <deal.II/lac/petsc_block_vector.h>
 #include <deal.II/lac/trilinos_vector.h>
 #include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/paralution_vector.h>
 #include <deal.II/multigrid/mg_base.h>
 
 
index db456bc6eb430fcaa275dffee5f27bfb1aaa78f8..52abb7de33b69050c7373dc58933fc1ddd8da8dd 100644 (file)
@@ -25,6 +25,7 @@
 #include <deal.II/lac/petsc_block_vector.h>
 #include <deal.II/lac/trilinos_vector.h>
 #include <deal.II/lac/trilinos_block_vector.h>
+#include <deal.II/lac/paralution_vector.h>
 #include <deal.II/numerics/data_out.h>
 #include <deal.II/numerics/data_out_dof_data.h>
 #include <deal.II/dofs/dof_handler.h>

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.