]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename vector_internal.h to vector_operations_internal.h 2577/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Thu, 5 May 2016 13:01:48 +0000 (09:01 -0400)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 9 May 2016 12:26:41 +0000 (08:26 -0400)
include/deal.II/lac/la_vector.templates.h
include/deal.II/lac/read_write_vector.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/lac/vector.templates.h
include/deal.II/lac/vector_operations_internal.h [moved from include/deal.II/lac/vector_internal.h with 91% similarity]

index 4ec2db73e85bb3a4870f856da528a6992b6dcaab..1166458b0512e9d0ca48f98c466c9d319e55f0d9 100644 (file)
@@ -17,7 +17,7 @@
 #define dealii__la_vector_templates_h
 
 #include <deal.II/lac/la_vector.h>
-#include <deal.II/lac/vector_internal.h>
+#include <deal.II/lac/vector_operations_internal.h>
 #include <iostream>
 #include <iomanip>
 
@@ -35,9 +35,7 @@ namespace LinearAlgebra
     if (this->size() != in_vector.size())
       this->reinit(in_vector, true);
 
-    dealii::internal::Vector_copy<Number, Number> copier;
-    copier.dst = this->val;
-    copier.src = in_vector.val;
+    dealii::internal::Vector_copy<Number, Number> copier(in_vector.val, this->val);
     internal::parallel_for(copier, this->size(), this->thread_loop_partitioner);
 
     return *this;
@@ -53,9 +51,7 @@ namespace LinearAlgebra
     if (this->size() != in_vector.size())
       this->reinit(in_vector, true);
 
-    dealii::internal::Vector_copy<Number, Number2> copier;
-    copier.dst = this->val;
-    copier.src = in_vector.val;
+    dealii::internal::Vector_copy<Number, Number2> copier(in_vector.val, this->val);
     internal::parallel_for(copier, this->size(), this->thread_loop_partitioner);
 
     return *this;
@@ -69,10 +65,7 @@ namespace LinearAlgebra
     Assert(s==static_cast<Number>(0), ExcMessage("Only 0 can be assigned to a vector."));
     (void) s;
 
-    internal::Vector_set<Number> setter;
-    setter.dst = this->val;
-    setter.value = Number();
-
+    internal::Vector_set<Number> setter(Number(), this->val);
     internal::parallel_for(setter, this->size(), this->thread_loop_partitioner);
 
     return *this;
@@ -85,10 +78,7 @@ namespace LinearAlgebra
   {
     AssertIsFinite(factor);
 
-    internal::Vectorization_multiply_factor<Number> vector_multiply;
-    vector_multiply.val = this->val;
-    vector_multiply.factor = factor;
-
+    internal::Vectorization_multiply_factor<Number> vector_multiply(this->val, factor);
     internal::parallel_for(vector_multiply, this->size(), this->thread_loop_partitioner);
 
     return *this;
@@ -119,9 +109,7 @@ namespace LinearAlgebra
     Assert(down_V.size()==this->size(),
            ExcMessage("Cannot add two vectors with different numbers of elements"));
 
-    internal::Vectorization_add_v<Number> vector_add;
-    vector_add.val = this->val;
-    vector_add.v_val = down_V.val;
+    internal::Vectorization_add_v<Number> vector_add(this->val, down_V.val);
     internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner);
 
     return *this;
@@ -139,9 +127,7 @@ namespace LinearAlgebra
     const Vector<Number> &down_V = dynamic_cast<const Vector<Number>&>(V);
     Assert(down_V.size()==this->size(),
            ExcMessage("Cannot subtract two vectors with different numbers of elements"));
-    internal::Vectorization_subtract_v<Number> vector_subtract;
-    vector_subtract.val = this->val;
-    vector_subtract.v_val = down_V.val;
+    internal::Vectorization_subtract_v<Number> vector_subtract(this->val, down_V.val);
     internal::parallel_for(vector_subtract, this->size(), this->thread_loop_partitioner);
 
     return *this;
@@ -162,9 +148,7 @@ namespace LinearAlgebra
            ExcMessage("Cannot compute the scalar product "
                       "of two vectors with different numbers of elements"));
     Number sum;
-    internal::Dot<Number, Number> dot;
-    dot.X = this->val;
-    dot.Y = down_V.val;
+    internal::Dot<Number, Number> dot(this->val, down_V.val);
     internal::parallel_reduce(dot, this->size(), sum, this->thread_loop_partitioner);
 
     return sum;
@@ -188,9 +172,7 @@ namespace LinearAlgebra
   {
     AssertIsFinite(a);
 
-    internal::Vectorization_add_factor<Number> vector_add;
-    vector_add.val = this->val;
-    vector_add.factor = a;
+    internal::Vectorization_add_factor<Number> vector_add(this->val, a);
     internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner);
   }
 
@@ -209,10 +191,7 @@ namespace LinearAlgebra
     Assert(down_V.size()==this->size(),
            ExcMessage("Cannot add two vectors with different numbers of elements"));
 
-    internal::Vectorization_add_av<Number> vector_add_av;
-    vector_add_av.val = this->val;
-    vector_add_av.v_val = down_V.val;
-    vector_add_av.factor = a;
+    internal::Vectorization_add_av<Number> vector_add_av(this->val, down_V.val, a);
     internal::parallel_for(vector_add_av, this->size(), this->thread_loop_partitioner);
   }
 
@@ -240,12 +219,8 @@ namespace LinearAlgebra
     Assert(down_W.size()==this->size(),
            ExcMessage("Cannot add two vectors with different numbers of elements"));
 
-    internal::Vectorization_add_avpbw<Number> vector_add;
-    vector_add.val = this->val;
-    vector_add.v_val = down_V.val;
-    vector_add.w_val = down_W.val;
-    vector_add.a = a;
-    vector_add.b = b;
+    internal::Vectorization_add_avpbw<Number> vector_add(this->val, down_V.val,
+                                                         down_W.val, a, b);
     internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner);
   }
 
@@ -264,11 +239,8 @@ namespace LinearAlgebra
 
     // Downcast V. It fails, throws an exception.
     const Vector<Number> &down_V = dynamic_cast<const Vector<Number>&>(V);
-    internal::Vectorization_sadd_xav<Number> vector_sadd_xav;
-    vector_sadd_xav.val = this->val;
-    vector_sadd_xav.v_val = down_V.val;
-    vector_sadd_xav.a = a;
-    vector_sadd_xav.x = s;
+    internal::Vectorization_sadd_xav<Number> vector_sadd_xav(this->val, down_V.val,
+                                                             a, s);
     internal::parallel_for(vector_sadd_xav, this->size(), this->thread_loop_partitioner);
   }
 
@@ -287,9 +259,7 @@ namespace LinearAlgebra
     Assert(down_scaling_factors.size()==this->size(),
            ExcMessage("Cannot add two vectors with different numbers of elements"));
 
-    internal::Vectorization_scale<Number> vector_scale;
-    vector_scale.val = this->val;
-    vector_scale.v_val = down_scaling_factors.val;
+    internal::Vectorization_scale<Number> vector_scale(this->val, down_scaling_factors.val);
     internal::parallel_for(vector_scale, this->size(), this->thread_loop_partitioner);
   }
 
@@ -306,10 +276,7 @@ namespace LinearAlgebra
 
     // Downcast V. If fails, throws an exception.
     const Vector<Number> &down_V = dynamic_cast<const Vector<Number>&>(V);
-    internal::Vectorization_equ_au<Number> vector_equ;
-    vector_equ.val = this->val;
-    vector_equ.u_val = down_V.val;
-    vector_equ.a = a;
+    internal::Vectorization_equ_au<Number> vector_equ(this->val, down_V.val, a);
     internal::parallel_for(vector_equ, this->size(), this->thread_loop_partitioner);
   }
 
@@ -322,8 +289,7 @@ namespace LinearAlgebra
 
     typedef typename VectorSpaceVector<Number>::real_type real_type;
     real_type sum;
-    internal::Norm1<Number, real_type> norm1;
-    norm1.X = this->val;
+    internal::Norm1<Number, real_type> norm1(this->val);
     internal::parallel_reduce(norm1, this->size(), sum, this->thread_loop_partitioner);
 
     return sum;
@@ -344,8 +310,7 @@ namespace LinearAlgebra
     // precision) using the BLAS approach with a weight, see e.g. dnrm2.f.
     typedef typename VectorSpaceVector<Number>::real_type real_type;
     real_type norm_square;
-    internal::Norm2<Number, real_type> norm2;
-    norm2.X = this->val;
+    internal::Norm2<Number, real_type> norm2(this->val);
     internal::parallel_reduce(norm2, this->size(), norm_square,
                               this->thread_loop_partitioner);
     if (numbers::is_finite(norm_square) &&
@@ -414,11 +379,7 @@ namespace LinearAlgebra
            ExcMessage("Cannot add two vectors with different numbers of elements"));
 
     Number sum;
-    internal::AddAndDot<Number> adder;
-    adder.X = this->val;
-    adder.a = a;
-    adder.V = down_V.val;
-    adder.W = down_W.val;
+    internal::AddAndDot<Number> adder(this->val, down_V.val, down_W.val, a);
     internal::parallel_reduce(adder, this->size(), sum, this->thread_loop_partitioner);
     AssertIsFinite(sum);
 
index f772c2338bc1d05d5cf565684734096d03a73fea..1841f4a2d17605532e4ea11f0aaabcfa0c00c170 100644 (file)
@@ -531,7 +531,9 @@ namespace LinearAlgebra
   ReadWriteVector<Number>::ReadWriteVector ()
     :
     val(NULL)
-  {}
+  {
+    reinit(0, true);
+  }
 
 
 
index e16c6e49965b26d2f779404b6399866a87b52834..7d2f02e15a33dc7bf6db0623a764ed59e12d6357 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <deal.II/base/config.h>
 #include <deal.II/lac/read_write_vector.h>
-#include <deal.II/lac/vector_internal.h>
+#include <deal.II/lac/vector_operations_internal.h>
 
 #ifdef DEAL_II_PETSC
 #  include <deal.II/lac/petsc_parallel_vector.h>
@@ -135,9 +135,7 @@ namespace LinearAlgebra
     if (n_elements() != in_vector.n_elements())
       reinit(in_vector, true);
 
-    dealii::internal::Vector_copy<Number,Number> copier;
-    copier.dst = val;
-    copier.src = in_vector.val;
+    dealii::internal::Vector_copy<Number,Number> copier(in_vector.val, val);
     internal::parallel_for(copier, n_elements(), thread_loop_partitioner);
 
     return *this;
@@ -154,9 +152,7 @@ namespace LinearAlgebra
     if (n_elements() != in_vector.n_elements())
       reinit(in_vector, true);
 
-    dealii::internal::Vector_copy<Number,Number2> copier;
-    copier.dst = val;
-    copier.src = in_vector.val;
+    dealii::internal::Vector_copy<Number,Number2> copier(in_vector.val, val);
     internal::parallel_for(copier, n_elements(), thread_loop_partitioner);
 
     return *this;
@@ -171,10 +167,7 @@ namespace LinearAlgebra
     Assert(s==static_cast<Number>(0), ExcMessage("Only 0 can be assigned to a vector."));
     (void)s;
 
-    internal::Vector_set<Number> setter;
-    setter.dst = val;
-    setter.value = Number();
-
+    internal::Vector_set<Number> setter(Number(), val);
     internal::parallel_for(setter, n_elements(), thread_loop_partitioner);
 
     return *this;
index f35f4a1d35bf997eb114ff7ad3fdf906300c3b7d..66fec398032b79ef7666a8fa88d994ff136baf50 100644 (file)
@@ -21,7 +21,7 @@
 #include <deal.II/base/numbers.h>
 #include <deal.II/lac/vector.h>
 #include <deal.II/lac/block_vector.h>
-#include <deal.II/lac/vector_internal.h>
+#include <deal.II/lac/vector_operations_internal.h>
 
 #ifdef DEAL_II_WITH_PETSC
 #  include <deal.II/lac/petsc_vector.h>
@@ -220,9 +220,7 @@ Vector<Number>::operator= (const Vector<Number> &v)
   if (vec_size != v.vec_size)
     reinit (v, true);
 
-  dealii::internal::Vector_copy<Number,Number> copier;
-  copier.dst = val;
-  copier.src = v.val;
+  dealii::internal::Vector_copy<Number,Number> copier(v.val, val);
   internal::parallel_for(copier,vec_size,thread_loop_partitioner);
 
   return *this;
@@ -265,9 +263,7 @@ Vector<Number>::operator= (const Vector<Number2> &v)
   if (vec_size != v.vec_size)
     reinit (v, true);
 
-  dealii::internal::Vector_copy<Number,Number2> copier;
-  copier.dst = val;
-  copier.src = v.val;
+  dealii::internal::Vector_copy<Number,Number2> copier(v.val, val);
   internal::parallel_for(copier,vec_size,thread_loop_partitioner);
 
   return *this;
@@ -377,9 +373,7 @@ Vector<Number>::operator= (const Number s)
   if (s != Number())
     Assert (vec_size!=0, ExcEmptyObject());
 
-  internal::Vector_set<Number> setter;
-  setter.dst = val;
-  setter.value = s;
+  internal::Vector_set<Number> setter(s, val);
 
   internal::parallel_for(setter,vec_size,thread_loop_partitioner);
 
@@ -412,9 +406,7 @@ Vector<Number> &Vector<Number>::operator *= (const Number factor)
 
   Assert (vec_size!=0, ExcEmptyObject());
 
-  internal::Vectorization_multiply_factor<Number> vector_multiply;
-  vector_multiply.val = val;
-  vector_multiply.factor = factor;
+  internal::Vectorization_multiply_factor<Number> vector_multiply(val, factor);
 
   internal::parallel_for(vector_multiply,vec_size,thread_loop_partitioner);
 
@@ -433,10 +425,7 @@ Vector<Number>::add (const Number a,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  internal::Vectorization_add_av<Number> vector_add_av;
-  vector_add_av.val = val;
-  vector_add_av.v_val = v.val;
-  vector_add_av.factor = a;
+  internal::Vectorization_add_av<Number> vector_add_av(val, v.val, a);
   internal::parallel_for(vector_add_av,vec_size,thread_loop_partitioner);
 }
 
@@ -454,11 +443,7 @@ Vector<Number>::sadd (const Number x,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  internal::Vectorization_sadd_xav<Number> vector_sadd_xav;
-  vector_sadd_xav.val = val;
-  vector_sadd_xav.v_val = v.val;
-  vector_sadd_xav.a = a;
-  vector_sadd_xav.x = x;
+  internal::Vectorization_sadd_xav<Number> vector_sadd_xav(val, v.val, a, x);
   internal::parallel_for(vector_sadd_xav,vec_size,thread_loop_partitioner);
 }
 
@@ -477,9 +462,7 @@ Number Vector<Number>::operator * (const Vector<Number2> &v) const
           ExcDimensionMismatch(vec_size, v.size()));
 
   Number sum;
-  internal::Dot<Number,Number2> dot;
-  dot.X = val;
-  dot.Y = v.val;
+  internal::Dot<Number,Number2> dot(val, v.val);
   internal::parallel_reduce (dot, vec_size, sum, thread_loop_partitioner);
   AssertIsFinite(sum);
 
@@ -495,8 +478,7 @@ Vector<Number>::norm_sqr () const
   Assert (vec_size!=0, ExcEmptyObject());
 
   real_type sum;
-  internal::Norm2<Number,real_type> norm2;
-  norm2.X = val;
+  internal::Norm2<Number,real_type> norm2(val);
   internal::parallel_reduce (norm2, vec_size, sum, thread_loop_partitioner);
 
   AssertIsFinite(sum);
@@ -512,8 +494,7 @@ Number Vector<Number>::mean_value () const
   Assert (vec_size!=0, ExcEmptyObject());
 
   Number sum;
-  internal::MeanValue<Number> mean;
-  mean.X = val;
+  internal::MeanValue<Number> mean(val);
   internal::parallel_reduce (mean, vec_size, sum, thread_loop_partitioner);
 
   return sum / real_type(size());
@@ -528,8 +509,7 @@ Vector<Number>::l1_norm () const
   Assert (vec_size!=0, ExcEmptyObject());
 
   real_type sum;
-  internal::Norm1<Number, real_type> norm1;
-  norm1.X = val;
+  internal::Norm1<Number, real_type> norm1(val);
   internal::parallel_reduce (norm1, vec_size, sum, thread_loop_partitioner);
 
   return sum;
@@ -549,8 +529,7 @@ Vector<Number>::l2_norm () const
   Assert (vec_size!=0, ExcEmptyObject());
 
   real_type norm_square;
-  internal::Norm2<Number, real_type> norm2;
-  norm2.X = val;
+  internal::Norm2<Number, real_type> norm2(val);
   internal::parallel_reduce (norm2, vec_size, norm_square,
                              thread_loop_partitioner);
   if (numbers::is_finite(norm_square) &&
@@ -594,9 +573,7 @@ Vector<Number>::lp_norm (const real_type p) const
     return l2_norm();
 
   real_type sum;
-  internal::NormP<Number, real_type> normp;
-  normp.X = val;
-  normp.p = p;
+  internal::NormP<Number, real_type> normp(val, p);
   internal::parallel_reduce (normp, vec_size, sum, thread_loop_partitioner);
 
   if (numbers::is_finite(sum) && sum >= std::numeric_limits<real_type>::min())
@@ -663,11 +640,7 @@ Vector<Number>::add_and_dot (const Number          a,
   AssertDimension (vec_size, W.size());
 
   Number sum;
-  internal::AddAndDot<Number> adder;
-  adder.X = val;
-  adder.a = a;
-  adder.V = V.val;
-  adder.W = W.val;
+  internal::AddAndDot<Number> adder(this->val, V.val, W.val, a);
   internal::parallel_reduce (adder, vec_size, sum, thread_loop_partitioner);
   AssertIsFinite(sum);
 
@@ -693,9 +666,7 @@ Vector<Number> &Vector<Number>::operator -= (const Vector<Number> &v)
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  internal::Vectorization_subtract_v<Number> vector_subtract;
-  vector_subtract.val = val;
-  vector_subtract.v_val = v.val;
+  internal::Vectorization_subtract_v<Number> vector_subtract(val, v.val);
   internal::parallel_for(vector_subtract,vec_size,thread_loop_partitioner);
 
   return *this;
@@ -708,9 +679,7 @@ void Vector<Number>::add (const Number v)
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  internal::Vectorization_add_factor<Number> vector_add;
-  vector_add.val = val;
-  vector_add.factor = v;
+  internal::Vectorization_add_factor<Number> vector_add(val, v);
   internal::parallel_for(vector_add,vec_size,thread_loop_partitioner);
 }
 
@@ -722,9 +691,7 @@ void Vector<Number>::add (const Vector<Number> &v)
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  internal::Vectorization_add_v<Number> vector_add;
-  vector_add.val = val;
-  vector_add.v_val = v.val;
+  internal::Vectorization_add_v<Number> vector_add(val, v.val);
   internal::parallel_for(vector_add,vec_size,thread_loop_partitioner);
 }
 
@@ -741,12 +708,7 @@ void Vector<Number>::add (const Number a, const Vector<Number> &v,
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
 
-  internal::Vectorization_add_avpbw<Number> vector_add;
-  vector_add.val = val;
-  vector_add.v_val = v.val;
-  vector_add.w_val = w.val;
-  vector_add.a = a;
-  vector_add.b = b;
+  internal::Vectorization_add_avpbw<Number> vector_add(val, v.val, w.val, a, b);
   internal::parallel_for(vector_add,vec_size,thread_loop_partitioner);
 }
 
@@ -761,10 +723,7 @@ void Vector<Number>::sadd (const Number x,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  internal::Vectorization_sadd_xv<Number> vector_sadd;
-  vector_sadd.val = val;
-  vector_sadd.v_val = v.val;
-  vector_sadd.x = x;
+  internal::Vectorization_sadd_xv<Number> vector_sadd(val, v.val, x);
   internal::parallel_for(vector_sadd,vec_size,thread_loop_partitioner);
 }
 
@@ -783,13 +742,8 @@ void Vector<Number>::sadd (const Number x, const Number a,
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
 
-  internal::Vectorization_sadd_xavbw<Number> vector_sadd;
-  vector_sadd.val = val;
-  vector_sadd.v_val = v.val;
-  vector_sadd.w_val = w.val;
-  vector_sadd.x = x;
-  vector_sadd.a = a;
-  vector_sadd.b = b;
+  internal::Vectorization_sadd_xavbw<Number> vector_sadd(val, v.val, w.val, x,
+                                                         a, b);
   internal::parallel_for(vector_sadd,vec_size,thread_loop_partitioner);
 }
 
@@ -812,9 +766,7 @@ void Vector<Number>::scale (const Vector<Number> &s)
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size));
 
-  internal::Vectorization_scale<Number> vector_scale;
-  vector_scale.val = val;
-  vector_scale.v_val = s.val;
+  internal::Vectorization_scale<Number> vector_scale(val, s.val);
   internal::parallel_for(vector_scale,vec_size,thread_loop_partitioner);
 }
 
@@ -842,10 +794,7 @@ void Vector<Number>::equ (const Number a,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size));
 
-  internal::Vectorization_equ_au<Number> vector_equ;
-  vector_equ.val = val;
-  vector_equ.u_val = u.val;
-  vector_equ.a = a;
+  internal::Vectorization_equ_au<Number> vector_equ(val, u.val, a);
   internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner);
 }
 
@@ -884,12 +833,7 @@ void Vector<Number>::equ (const Number a, const Vector<Number> &u,
   Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size));
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  internal::Vectorization_equ_aubv<Number> vector_equ;
-  vector_equ.val = val;
-  vector_equ.u_val = u.val;
-  vector_equ.v_val = v.val;
-  vector_equ.a = a;
-  vector_equ.b = b;
+  internal::Vectorization_equ_aubv<Number> vector_equ(val, u.val, v.val, a, b);
   internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner);
 }
 
@@ -904,14 +848,8 @@ void Vector<Number>::equ (const Number a, const Vector<Number> &u,
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
 
-  internal::Vectorization_equ_aubvcw<Number> vector_equ;
-  vector_equ.val = val;
-  vector_equ.u_val = u.val;
-  vector_equ.v_val = v.val;
-  vector_equ.w_val = w.val;
-  vector_equ.a = a;
-  vector_equ.b = b;
-  vector_equ.c = c;
+  internal::Vectorization_equ_aubvcw<Number> vector_equ(val, u.val, v.val, w.val,
+                                                        a, b, c);
   internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner);
 }
 
@@ -928,10 +866,7 @@ void Vector<Number>::ratio (const Vector<Number> &a,
   // we overwrite them anyway
   reinit (a.size(), true);
 
-  internal::Vectorization_ratio<Number> vector_ratio;
-  vector_ratio.val = val;
-  vector_ratio.a_val = a.val;
-  vector_ratio.b_val = b.val;
+  internal::Vectorization_ratio<Number> vector_ratio(val, a.val, b.val);
   internal::parallel_for(vector_ratio,vec_size,thread_loop_partitioner);
 }
 
similarity index 91%
rename from include/deal.II/lac/vector_internal.h
rename to include/deal.II/lac/vector_operations_internal.h
index 804c84fe16fdae08ac5d07a826a9090cd52154c2..7fadf02cda4be1e332e2944160e8b831917fdaa9 100644 (file)
@@ -14,8 +14,8 @@
 // ---------------------------------------------------------------------
 
 
-#ifndef dealii__vector_internal_h
-#define dealii__vector_internal_h
+#ifndef dealii__vector_operations_internal_h
+#define dealii__vector_operations_internal_h
 
 #include <deal.II/base/multithread_info.h>
 #include <deal.II/base/parallel.h>
@@ -188,8 +188,11 @@ namespace internal
   template <typename Number>
   struct Vector_set
   {
-    Number *dst;
-    Number value;
+    Vector_set(Number value, Number *dst)
+      :
+      value(value),
+      dst(dst)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -198,13 +201,19 @@ namespace internal
       else
         std::fill (dst+begin, dst+end, value);
     }
+
+    Number value;
+    Number *dst;
   };
 
   template <typename Number, typename OtherNumber>
   struct Vector_copy
   {
-    const OtherNumber *src;
-    Number *dst;
+    Vector_copy(const OtherNumber *src, Number *dst)
+      :
+      src(src),
+      dst(dst)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -217,13 +226,19 @@ namespace internal
             dst[i] = src[i];
         }
     }
+
+    const OtherNumber *src;
+    Number *dst;
   };
 
   template <typename Number>
   struct Vectorization_multiply_factor
   {
-    Number *val;
-    Number factor;
+    Vectorization_multiply_factor(Number *val, Number factor)
+      :
+      val(val),
+      factor(factor)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -239,14 +254,20 @@ namespace internal
             val[i] *= factor;
         }
     }
+
+    Number *val;
+    Number factor;
   };
 
   template <typename Number>
   struct Vectorization_add_av
   {
-    Number *val;
-    Number *v_val;
-    Number factor;
+    Vectorization_add_av(Number *val, Number *v_val, Number factor)
+      :
+      val(val),
+      v_val(v_val),
+      factor(factor)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -262,15 +283,22 @@ namespace internal
             val[i] += factor*v_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
+    Number factor;
   };
 
   template <typename Number>
   struct Vectorization_sadd_xav
   {
-    Number *val;
-    Number *v_val;
-    Number a;
-    Number x;
+    Vectorization_sadd_xav(Number *val, Number *v_val, Number a, Number x)
+      :
+      val(val),
+      v_val(v_val),
+      a(a),
+      x(x)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -286,13 +314,21 @@ namespace internal
             val[i] = x*val[i] + a*v_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
+    Number a;
+    Number x;
   };
 
   template <typename Number>
   struct Vectorization_subtract_v
   {
-    Number *val;
-    Number *v_val;
+    Vectorization_subtract_v(Number *val, Number *v_val)
+      :
+      val(val),
+      v_val(v_val)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -308,13 +344,19 @@ namespace internal
             val[i] -= v_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
   };
 
   template <typename Number>
   struct Vectorization_add_factor
   {
-    Number *val;
-    Number factor;
+    Vectorization_add_factor(Number *val, Number factor)
+      :
+      val(val),
+      factor(factor)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -330,13 +372,19 @@ namespace internal
             val[i] += factor;
         }
     }
+
+    Number *val;
+    Number factor;
   };
 
   template <typename Number>
   struct Vectorization_add_v
   {
-    Number *val;
-    Number *v_val;
+    Vectorization_add_v(Number *val, Number *v_val)
+      :
+      val(val),
+      v_val(v_val)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -352,16 +400,22 @@ namespace internal
             val[i] += v_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
   };
 
   template <typename Number>
   struct Vectorization_add_avpbw
   {
-    Number *val;
-    Number *v_val;
-    Number *w_val;
-    Number a;
-    Number b;
+    Vectorization_add_avpbw(Number *val, Number *v_val, Number *w_val, Number a, Number b)
+      :
+      val(val),
+      v_val(v_val),
+      w_val(w_val),
+      a(a),
+      b(b)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -377,14 +431,23 @@ namespace internal
             val[i] = val[i] + a*v_val[i] + b*w_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
+    Number *w_val;
+    Number a;
+    Number b;
   };
 
   template <typename Number>
   struct Vectorization_sadd_xv
   {
-    Number *val;
-    Number *v_val;
-    Number x;
+    Vectorization_sadd_xv(Number *val, Number *v_val, Number x)
+      :
+      val(val),
+      v_val(v_val),
+      x(x)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -400,17 +463,25 @@ namespace internal
             val[i] = x*val[i] + v_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
+    Number x;
   };
 
   template <typename Number>
   struct Vectorization_sadd_xavbw
   {
-    Number *val;
-    Number *v_val;
-    Number *w_val;
-    Number x;
-    Number a;
-    Number b;
+    Vectorization_sadd_xavbw(Number *val, Number *v_val, Number *w_val,
+                             Number x, Number a, Number b)
+      :
+      val(val),
+      v_val(v_val),
+      w_val(w_val),
+      x(x),
+      a(a),
+      b(b)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -426,13 +497,23 @@ namespace internal
             val[i] = x*val[i] + a*v_val[i] + b*w_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
+    Number *w_val;
+    Number x;
+    Number a;
+    Number b;
   };
 
   template <typename Number>
   struct Vectorization_scale
   {
-    Number *val;
-    Number *v_val;
+    Vectorization_scale(Number *val, Number *v_val)
+      :
+      val(val),
+      v_val(v_val)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -448,14 +529,20 @@ namespace internal
             val[i] *= v_val[i];
         }
     }
+
+    Number *val;
+    Number *v_val;
   };
 
   template <typename Number>
   struct Vectorization_equ_au
   {
-    Number *val;
-    Number *u_val;
-    Number a;
+    Vectorization_equ_au(Number *val, Number *u_val, Number a)
+      :
+      val(val),
+      u_val(u_val),
+      a(a)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -471,16 +558,24 @@ namespace internal
             val[i] = a*u_val[i];
         }
     }
+
+    Number *val;
+    Number *u_val;
+    Number a;
   };
 
   template <typename Number>
   struct Vectorization_equ_aubv
   {
-    Number *val;
-    Number *u_val;
-    Number *v_val;
-    Number a;
-    Number b;
+    Vectorization_equ_aubv(Number *val, Number *u_val, Number *v_val,
+                           Number a, Number b)
+      :
+      val(val),
+      u_val(u_val),
+      v_val(v_val),
+      a(a),
+      b(b)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -496,18 +591,28 @@ namespace internal
             val[i] = a*u_val[i] + b*v_val[i];
         }
     }
-  };
 
-  template <typename Number>
-  struct Vectorization_equ_aubvcw
-  {
     Number *val;
     Number *u_val;
     Number *v_val;
-    Number *w_val;
     Number a;
     Number b;
-    Number c;
+  };
+
+  template <typename Number>
+  struct Vectorization_equ_aubvcw
+  {
+    Vectorization_equ_aubvcw(Number *val, Number *u_val, Number *v_val,
+                             Number *w_val, Number a, Number b, Number c)
+      :
+      val(val),
+      u_val(u_val),
+      v_val(v_val),
+      w_val(w_val),
+      a(a),
+      b(b),
+      c(c)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -523,14 +628,25 @@ namespace internal
             val[i] = a*u_val[i] + b*v_val[i] + c*w_val[i];
         }
     }
+
+    Number *val;
+    Number *u_val;
+    Number *v_val;
+    Number *w_val;
+    Number a;
+    Number b;
+    Number c;
   };
 
   template <typename Number>
   struct Vectorization_ratio
   {
-    Number *val;
-    Number *a_val;
-    Number *b_val;
+    Vectorization_ratio(Number *val, Number *a_val, Number *b_val)
+      :
+      val(val),
+      a_val(a_val),
+      b_val(b_val)
+    {}
 
     void operator() (const size_type begin, const size_type end) const
     {
@@ -546,6 +662,10 @@ namespace internal
             val[i] = a_val[i]/b_val[i];
         }
     }
+
+    Number *val;
+    Number *a_val;
+    Number *b_val;
   };
 
 
@@ -561,6 +681,12 @@ namespace internal
     static const bool vectorizes = types_are_equal<Number,Number2>::value &&
                                    (VectorizedArray<Number>::n_array_elements > 1);
 
+    Dot(const Number *X, const Number2 *Y)
+      :
+      X(X),
+      Y(Y)
+    {}
+
     Number
     operator() (const size_type i) const
     {
@@ -585,6 +711,11 @@ namespace internal
   {
     static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
 
+    Norm2(const Number *X)
+      :
+      X(X)
+    {}
+
     RealType
     operator() (const size_type i) const
     {
@@ -607,6 +738,11 @@ namespace internal
   {
     static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
 
+    Norm1(const Number *X)
+      :
+      X(X)
+    {}
+
     RealType
     operator() (const size_type i) const
     {
@@ -629,6 +765,12 @@ namespace internal
   {
     static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
 
+    NormP(const Number *X, RealType p)
+      :
+      X(X),
+      p(p)
+    {}
+
     RealType
     operator() (const size_type i) const
     {
@@ -652,6 +794,11 @@ namespace internal
   {
     static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
 
+    MeanValue(const Number *X)
+      :
+      X(X)
+    {}
+
     Number
     operator() (const size_type i) const
     {
@@ -674,6 +821,14 @@ namespace internal
   {
     static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
 
+    AddAndDot(Number *X, const Number *V, const Number *W, Number a)
+      :
+      X(X),
+      V(V),
+      W(W),
+      a(a)
+    {}
+
     Number
     operator() (const size_type i) const
     {

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.