From: Wolfgang Bangerth Date: Fri, 20 Oct 2017 19:51:15 +0000 (-0600) Subject: Rename Vector::val to Vector::values. X-Git-Tag: v9.0.0-rc1~916^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2faae204c26;p=dealii.git Rename Vector::val to Vector::values. --- diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 89ad440328..767e9dff8c 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -922,7 +922,7 @@ protected: /** * Pointer to the array of elements of this vector. */ - Number *val; + Number *values; /** * For parallel loops with TBB, this member variable stores the affinity @@ -948,13 +948,13 @@ protected: private: /** - * Allocate and align @p val along 64-byte boundaries. The size of the + * Allocate and align @p values along 64-byte boundaries. The size of the * allocated memory is determined by @p max_vec_size . */ void allocate(); /** - * Deallocate @p val. + * Deallocate @p values. */ void deallocate(); }; @@ -980,7 +980,7 @@ Vector::Vector () : vec_size(0), max_vec_size(0), - val(nullptr) + values(nullptr) { reinit(0); } @@ -993,7 +993,7 @@ Vector::Vector (const InputIterator first, const InputIterator last) : vec_size (0), max_vec_size (0), - val (nullptr) + values (nullptr) { // allocate memory. do not initialize it, as we will copy over to it in a // second @@ -1009,7 +1009,7 @@ Vector::Vector (const size_type n) : vec_size(0), max_vec_size(0), - val(nullptr) + values(nullptr) { reinit (n, false); } @@ -1020,10 +1020,10 @@ template inline Vector::~Vector () { - if (val) + if (values) { deallocate(); - val=nullptr; + values = nullptr; } } @@ -1052,7 +1052,7 @@ inline typename Vector::iterator Vector::begin () { - return val; + return values; } @@ -1062,7 +1062,7 @@ inline typename Vector::const_iterator Vector::begin () const { - return val; + return values; } @@ -1072,7 +1072,7 @@ inline typename Vector::iterator Vector::end () { - return val + vec_size; + return values + vec_size; } @@ -1082,7 +1082,7 @@ inline typename Vector::const_iterator Vector::end () const { - return val + vec_size; + return values + vec_size; } @@ -1092,7 +1092,7 @@ inline Number Vector::operator() (const size_type i) const { Assert (i::operator() (const size_type i) { Assert (i(i,0,vec_size)); - return val[i]; + return values[i]; } @@ -1191,7 +1191,7 @@ Vector::add (const std::vector &indices, { Assert (indices.size() == values.size(), ExcDimensionMismatch(indices.size(), values.size())); - add (indices.size(), indices.data(), values.val); + add (indices.size(), indices.data(), values.values); } @@ -1210,7 +1210,7 @@ Vector::add (const size_type n_indices, Assert (numbers::is_finite(values[i]), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); - val[indices[i]] += values[i]; + this->values[indices[i]] += values[i]; } } @@ -1253,7 +1253,7 @@ Vector::swap (Vector &v) { std::swap (vec_size, v.vec_size); std::swap (max_vec_size, v.max_vec_size); - std::swap (val, v.val); + std::swap (values, v.values); } @@ -1268,7 +1268,7 @@ Vector::save (Archive &ar, const unsigned int) const ar &static_cast(*this); ar &vec_size &max_vec_size ; - ar &boost::serialization::make_array(val, max_vec_size); + ar &boost::serialization::make_array(values, max_vec_size); } @@ -1287,7 +1287,7 @@ Vector::load (Archive &ar, const unsigned int) ar &vec_size &max_vec_size ; allocate(); - ar &boost::serialization::make_array(val, max_vec_size); + ar &boost::serialization::make_array(values, max_vec_size); } #endif diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index 385d8945bc..a1b19dc83c 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -48,7 +48,7 @@ Vector::Vector (const Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(nullptr) + values(nullptr) { if (vec_size != 0) { @@ -65,12 +65,12 @@ Vector::Vector (Vector &&v) Subscriptor(std::move(v)), vec_size(v.vec_size), max_vec_size(v.max_vec_size), - val(v.val), + values(v.values), thread_loop_partitioner(std::move(v.thread_loop_partitioner)) { v.vec_size = 0; v.max_vec_size = 0; - v.val = nullptr; + v.values = nullptr; } @@ -82,7 +82,7 @@ Vector::Vector (const Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(nullptr) + values(nullptr) { if (vec_size != 0) { @@ -145,7 +145,7 @@ Vector::Vector (const PETScWrappers::VectorBase &v) Subscriptor(), vec_size(0), max_vec_size(0), - val(nullptr) + values(nullptr) { if (v.size() != 0) { @@ -163,7 +163,7 @@ Vector::Vector (const TrilinosWrappers::MPI::Vector &v) Subscriptor(), vec_size(v.size()), max_vec_size(v.size()), - val(nullptr) + values(nullptr) { if (vec_size != 0) { @@ -207,7 +207,7 @@ Vector::operator= (const Vector &v) if (vec_size>0) { - dealii::internal::VectorOperations::Vector_copy copier(v.val, val); + dealii::internal::VectorOperations::Vector_copy copier(v.values, values); internal::VectorOperations::parallel_for(copier,0,vec_size,thread_loop_partitioner); } @@ -224,16 +224,16 @@ Vector::operator= (Vector &&v) { Subscriptor::operator=(std::move(v)); - if (val) deallocate(); + if (values) deallocate(); vec_size = v.vec_size; max_vec_size = v.max_vec_size; - val = v.val; + values = v.values; thread_loop_partitioner = std::move(v.thread_loop_partitioner); v.vec_size = 0; v.max_vec_size = 0; - v.val = nullptr; + v.values = nullptr; return *this; } @@ -251,7 +251,7 @@ Vector::operator= (const Vector &v) if (vec_size != v.vec_size) reinit (v, true); - dealii::internal::VectorOperations::Vector_copy copier(v.val, val); + dealii::internal::VectorOperations::Vector_copy copier(v.values, values); internal::VectorOperations::parallel_for(copier,0,vec_size,thread_loop_partitioner); return *this; @@ -266,8 +266,8 @@ void Vector::reinit (const size_type n, { if (n==0) { - if (val) deallocate(); - val = nullptr; + if (values) deallocate(); + values = nullptr; max_vec_size = vec_size = 0; thread_loop_partitioner.reset(new parallel::internal::TBBPartitioner()); return; @@ -275,7 +275,7 @@ void Vector::reinit (const size_type n, if (n>max_vec_size) { - if (val) deallocate(); + if (values) deallocate(); max_vec_size = n; allocate(); }; @@ -305,15 +305,15 @@ void Vector::reinit (const Vector &v, if (v.vec_size==0) { - if (val) deallocate(); - val = nullptr; + if (values) deallocate(); + values = nullptr; max_vec_size = vec_size = 0; return; }; if (v.vec_size>max_vec_size) { - if (val) deallocate(); + if (values) deallocate(); max_vec_size = v.vec_size; allocate(); }; @@ -331,7 +331,7 @@ Vector::all_zero () const Assert (vec_size!=0, ExcEmptyObject()); for (size_type i=0; i::is_non_negative () const Assert (vec_size!=0, ExcEmptyObject()); for (size_type i=0; i::operator= (const Number s) if (vec_size>0) { - internal::VectorOperations::Vector_set setter(s, val); + internal::VectorOperations::Vector_set setter(s, values); internal::VectorOperations::parallel_for(setter,0,vec_size,thread_loop_partitioner); } @@ -379,7 +379,7 @@ Vector &Vector::operator *= (const Number factor) Assert (vec_size!=0, ExcEmptyObject()); - internal::VectorOperations::Vectorization_multiply_factor vector_multiply(val, factor); + internal::VectorOperations::Vectorization_multiply_factor vector_multiply(values, factor); internal::VectorOperations::parallel_for(vector_multiply,0,vec_size,thread_loop_partitioner); @@ -398,7 +398,7 @@ Vector::add (const Number a, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::VectorOperations::Vectorization_add_av vector_add_av(val, v.val, a); + internal::VectorOperations::Vectorization_add_av vector_add_av(values, v.values, a); internal::VectorOperations::parallel_for(vector_add_av,0,vec_size,thread_loop_partitioner); } @@ -416,7 +416,7 @@ Vector::sadd (const Number x, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::VectorOperations::Vectorization_sadd_xav vector_sadd_xav(val, v.val, a, x); + internal::VectorOperations::Vectorization_sadd_xav vector_sadd_xav(values, v.values, a, x); internal::VectorOperations::parallel_for(vector_sadd_xav,0,vec_size,thread_loop_partitioner); } @@ -435,7 +435,7 @@ Number Vector::operator * (const Vector &v) const ExcDimensionMismatch(vec_size, v.size())); Number sum; - internal::VectorOperations::Dot dot(val, v.val); + internal::VectorOperations::Dot dot(values, v.values); internal::VectorOperations::parallel_reduce (dot, 0, vec_size, sum, thread_loop_partitioner); AssertIsFinite(sum); @@ -451,7 +451,7 @@ Vector::norm_sqr () const Assert (vec_size!=0, ExcEmptyObject()); real_type sum; - internal::VectorOperations::Norm2 norm2(val); + internal::VectorOperations::Norm2 norm2(values); internal::VectorOperations::parallel_reduce (norm2, 0, vec_size, sum, thread_loop_partitioner); AssertIsFinite(sum); @@ -467,7 +467,7 @@ Number Vector::mean_value () const Assert (vec_size!=0, ExcEmptyObject()); Number sum; - internal::VectorOperations::MeanValue mean(val); + internal::VectorOperations::MeanValue mean(values); internal::VectorOperations::parallel_reduce (mean, 0, vec_size, sum, thread_loop_partitioner); return sum / real_type(size()); @@ -482,7 +482,7 @@ Vector::l1_norm () const Assert (vec_size!=0, ExcEmptyObject()); real_type sum; - internal::VectorOperations::Norm1 norm1(val); + internal::VectorOperations::Norm1 norm1(values); internal::VectorOperations::parallel_reduce (norm1, 0, vec_size, sum, thread_loop_partitioner); return sum; @@ -502,7 +502,7 @@ Vector::l2_norm () const Assert (vec_size!=0, ExcEmptyObject()); real_type norm_square; - internal::VectorOperations::Norm2 norm2(val); + internal::VectorOperations::Norm2 norm2(values); internal::VectorOperations::parallel_reduce (norm2, 0, vec_size, norm_square, thread_loop_partitioner); if (numbers::is_finite(norm_square) && @@ -514,10 +514,10 @@ Vector::l2_norm () const real_type sum = 1.; for (size_type i=0; i::abs(val[i]); + numbers::NumberTraits::abs(values[i]); if (scale < abs_x) { sum = 1. + sum * (scale/abs_x) * (scale/abs_x); @@ -546,7 +546,7 @@ Vector::lp_norm (const real_type p) const return l2_norm(); real_type sum; - internal::VectorOperations::NormP normp(val, p); + internal::VectorOperations::NormP normp(values, p); internal::VectorOperations::parallel_reduce (normp, 0, vec_size, sum, thread_loop_partitioner); if (numbers::is_finite(sum) && sum >= std::numeric_limits::min()) @@ -557,10 +557,10 @@ Vector::lp_norm (const real_type p) const real_type sum = 1.; for (size_type i=0; i::abs(val[i]); + numbers::NumberTraits::abs(values[i]); if (scale < abs_x) { sum = 1. + sum * std::pow(scale/abs_x, p); @@ -585,7 +585,7 @@ Vector::linfty_norm () const real_type max = 0.; for (size_type i=0; i::abs(val[i]), max); + max = std::max (numbers::NumberTraits::abs(values[i]), max); return max; } @@ -603,7 +603,7 @@ Vector::add_and_dot (const Number a, AssertDimension (vec_size, W.size()); Number sum; - internal::VectorOperations::AddAndDot adder(this->val, V.val, W.val, a); + internal::VectorOperations::AddAndDot adder(this->values, V.values, W.values, a); internal::VectorOperations::parallel_reduce (adder, 0, vec_size, sum, thread_loop_partitioner); AssertIsFinite(sum); @@ -618,7 +618,7 @@ Vector &Vector::operator += (const Vector &v) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::VectorOperations::Vectorization_add_v vector_add(val, v.val); + internal::VectorOperations::Vectorization_add_v vector_add(values, v.values); internal::VectorOperations::parallel_for(vector_add,0,vec_size,thread_loop_partitioner); return *this; } @@ -631,7 +631,7 @@ Vector &Vector::operator -= (const Vector &v) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::VectorOperations::Vectorization_subtract_v vector_subtract(val, v.val); + internal::VectorOperations::Vectorization_subtract_v vector_subtract(values, v.values); internal::VectorOperations::parallel_for(vector_subtract,0,vec_size,thread_loop_partitioner); return *this; @@ -644,7 +644,7 @@ void Vector::add (const Number v) { Assert (vec_size!=0, ExcEmptyObject()); - internal::VectorOperations::Vectorization_add_factor vector_add(val, v); + internal::VectorOperations::Vectorization_add_factor vector_add(values, v); internal::VectorOperations::parallel_for(vector_add,0,vec_size,thread_loop_partitioner); } @@ -661,7 +661,7 @@ void Vector::add (const Number a, const Vector &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::VectorOperations::Vectorization_add_avpbw vector_add(val, v.val, w.val, a, b); + internal::VectorOperations::Vectorization_add_avpbw vector_add(values, v.values, w.values, a, b); internal::VectorOperations::parallel_for(vector_add,0,vec_size,thread_loop_partitioner); } @@ -676,7 +676,7 @@ void Vector::sadd (const Number x, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::VectorOperations::Vectorization_sadd_xv vector_sadd(val, v.val, x); + internal::VectorOperations::Vectorization_sadd_xv vector_sadd(values, v.values, x); internal::VectorOperations::parallel_for(vector_sadd,0,vec_size,thread_loop_partitioner); } @@ -688,7 +688,7 @@ void Vector::scale (const Vector &s) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size)); - internal::VectorOperations::Vectorization_scale vector_scale(val, s.val); + internal::VectorOperations::Vectorization_scale vector_scale(values, s.values); internal::VectorOperations::parallel_for(vector_scale,0,vec_size,thread_loop_partitioner); } @@ -702,7 +702,7 @@ void Vector::scale (const Vector &s) Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size)); for (size_type i=0; i::equ (const Number a, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size)); - internal::VectorOperations::Vectorization_equ_au vector_equ(val, u.val, a); + internal::VectorOperations::Vectorization_equ_au vector_equ(values, u.values, a); internal::VectorOperations::parallel_for(vector_equ,0,vec_size,thread_loop_partitioner); } @@ -739,7 +739,7 @@ void Vector::equ (const Number a, // operator*(complex,complex) // is not defined by default for (size_type i=0; i::ratio (const Vector &a, // we overwrite them anyway reinit (a.size(), true); - internal::VectorOperations::Vectorization_ratio vector_ratio(val, a.val, b.val); + internal::VectorOperations::Vectorization_ratio vector_ratio(values, a.values, b.values); internal::VectorOperations::parallel_for(vector_ratio,0,vec_size,thread_loop_partitioner); } @@ -772,7 +772,7 @@ Vector::operator= (const BlockVector &v) size_type this_index = 0; for (size_type b=0; b::operator== (const Vector &v) const // operator==(complex,complex) // is not defined by default for (size_type i=0; i::print (const char *format) const Assert (vec_size!=0, ExcEmptyObject()); for (size_type j=0; j::print (std::ostream &out, if (across) for (size_type i=0; i::print (LogStream &out, const unsigned int width, const bool acro if (across) for (size_type i=0; i::allocate() { // make sure that we don't create a memory leak - Assert (val == nullptr, ExcInternalError()); + Assert (values == nullptr, ExcInternalError()); // then allocate memory with the proper alignment requirements of 64 bytes - Utilities::System::posix_memalign ((void **)&val, 64, sizeof(Number)*max_vec_size); + Utilities::System::posix_memalign ((void **)&values, 64, sizeof(Number)*max_vec_size); } @@ -1010,8 +1010,8 @@ template void Vector::deallocate() { - free(val); - val = nullptr; + free(values); + values = nullptr; } DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/lac/vector_view.h b/include/deal.II/lac/vector_view.h index 730e4e2cb7..ed22d53ed3 100644 --- a/include/deal.II/lac/vector_view.h +++ b/include/deal.II/lac/vector_view.h @@ -238,7 +238,7 @@ VectorView::VectorView(const size_type new_size, Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; - this->val = ptr; + this->values = ptr; } @@ -249,7 +249,7 @@ VectorView::VectorView(const size_type new_size, const Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; - this->val = const_cast(ptr); + this->values = const_cast(ptr); } @@ -262,7 +262,7 @@ VectorView::~VectorView() // memory it doesn't own this->vec_size = 0; this->max_vec_size = 0; - this->val = nullptr; + this->values = nullptr; } @@ -284,7 +284,7 @@ void VectorView::reinit(const size_type new_size, Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; - this->val = ptr; + this->values = ptr; } @@ -294,7 +294,7 @@ void VectorView::reinit(const size_type new_size, const Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; - this->val = const_cast(ptr); + this->values = const_cast(ptr); } diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index 6be51ecfa3..570b1a343f 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -192,7 +192,7 @@ LAPACKFullMatrix::vmult ( AssertDimension(v.size(), this->n_cols()); AssertDimension(w.size(), this->n_rows()); - gemv("N", &mm, &nn, &alpha, &this->values[0], &mm, v.val, &one, &beta, w.val, &one); + gemv("N", &mm, &nn, &alpha, &this->values[0], &mm, v.values, &one, &beta, w.values, &one); break; } case svd: @@ -202,12 +202,12 @@ LAPACKFullMatrix::vmult ( AssertDimension(w.size(), this->n_rows()); // Compute V^T v work.resize(std::max(mm,nn)); - gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, work.data(), &one); + gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.values, &one, &null, work.data(), &one); // Multiply by singular values for (size_type i=0; ivalues[0], &mm, work.data(), &one, &beta, w.val, &one); + gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, work.data(), &one, &beta, w.values, &one); break; } case inverse_svd: @@ -217,12 +217,12 @@ LAPACKFullMatrix::vmult ( AssertDimension(v.size(), this->n_rows()); // Compute U^T v work.resize(std::max(mm,nn)); - gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, work.data(), &one); + gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.values, &one, &null, work.data(), &one); // Multiply by singular values for (size_type i=0; ivalues[0], &nn, work.data(), &one, &beta, w.val, &one); + gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, work.data(), &one, &beta, w.values, &one); break; } default: @@ -252,7 +252,7 @@ LAPACKFullMatrix::Tvmult ( AssertDimension(w.size(), this->n_cols()); AssertDimension(v.size(), this->n_rows()); - gemv("T", &mm, &nn, &alpha, &this->values[0], &mm, v.val, &one, &beta, w.val, &one); + gemv("T", &mm, &nn, &alpha, &this->values[0], &mm, v.values, &one, &beta, w.values, &one); break; } case svd: @@ -263,12 +263,12 @@ LAPACKFullMatrix::Tvmult ( // Compute U^T v work.resize(std::max(mm,nn)); - gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, work.data(), &one); + gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.values, &one, &null, work.data(), &one); // Multiply by singular values for (size_type i=0; ivalues[0], &nn, work.data(), &one, &beta, w.val, &one); + gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, work.data(), &one, &beta, w.values, &one); break; } case inverse_svd: @@ -279,12 +279,12 @@ LAPACKFullMatrix::Tvmult ( // Compute V^T v work.resize(std::max(mm,nn)); - gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, work.data(), &one); + gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.values, &one, &null, work.data(), &one); // Multiply by singular values for (size_type i=0; ivalues[0], &mm, work.data(), &one, &beta, w.val, &one); + gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, work.data(), &one, &beta, w.values, &one); break; } default: diff --git a/tests/lac/gmres_reorthogonalize_04.cc b/tests/lac/gmres_reorthogonalize_04.cc index fa8d5f3234..3637c9a8ef 100644 --- a/tests/lac/gmres_reorthogonalize_04.cc +++ b/tests/lac/gmres_reorthogonalize_04.cc @@ -35,7 +35,7 @@ namespace dealii { Number sum = 0; for (unsigned int i=0; i @@ -43,7 +43,7 @@ namespace dealii { real_type sum = 0; for (unsigned int i=0; i @@ -43,7 +43,7 @@ namespace dealii { real_type sum = 0; for (unsigned int i=0; i