]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace &vec[0] with vec.data() or vec.get(). 7618/head
authorDavid Wells <drwells@email.unc.edu>
Sun, 20 Jan 2019 18:33:10 +0000 (13:33 -0500)
committerDavid Wells <drwells@email.unc.edu>
Mon, 21 Jan 2019 03:57:32 +0000 (22:57 -0500)
This is more explicit and also works correctly when the array is
nullptr.

39 files changed:
include/deal.II/base/mpi.h
include/deal.II/base/mpi.templates.h
include/deal.II/differentiation/ad/ad_drivers.h
include/deal.II/fe/fe_tools_extrapolate.templates.h
include/deal.II/grid/grid_tools.h
include/deal.II/lac/affine_constraints.templates.h
include/deal.II/lac/block_matrix_base.h
include/deal.II/lac/chunk_sparse_matrix.templates.h
include/deal.II/lac/full_matrix.templates.h
include/deal.II/lac/petsc_vector_base.h
include/deal.II/lac/sparse_matrix.templates.h
include/deal.II/lac/tensor_product_matrix.h
include/deal.II/matrix_free/cuda_matrix_free.templates.h
include/deal.II/matrix_free/matrix_free.templates.h
include/deal.II/matrix_free/operators.h
source/base/data_out_base.cc
source/base/mpi.cc
source/base/tensor_product_polynomials.cc
source/distributed/tria.cc
source/dofs/dof_handler_policy.cc
source/fe/mapping_q_generic.cc
source/grid/cell_id.cc
source/grid/grid_in.cc
source/grid/grid_tools.cc
source/grid/tria_accessor.cc
source/lac/cuda_sparse_matrix.cu
source/lac/lapack_full_matrix.cc
source/lac/petsc_parallel_sparse_matrix.cc
source/lac/petsc_parallel_vector.cc
source/lac/scalapack.cc
source/lac/sparsity_tools.cc
source/lac/trilinos_sparse_matrix.cc
source/lac/trilinos_sparsity_pattern.cc
source/multigrid/mg_transfer_matrix_free.cc
source/numerics/data_out.cc
source/numerics/data_out_faces.cc
source/numerics/data_out_rotation.cc
source/numerics/kdtree.cc
source/particles/particle_handler.cc

index 386118ff55da41de410f110ec0addf32568f28a5..4688b3c17fd4f803bc18d89e15ea13b1e4043a98 100644 (file)
@@ -822,7 +822,7 @@ namespace Utilities
 
       // Exchanging the size of each buffer
       MPI_Allgather(
-        &n_local_data, 1, MPI_INT, &(size_all_data[0]), 1, MPI_INT, comm);
+        &n_local_data, 1, MPI_INT, size_all_data.data(), 1, MPI_INT, comm);
 
       // Now computing the displacement, relative to recvbuf,
       // at which to store the incoming buffer
index d6628482d1626163baf1c9bd6d5adf5b8e061ced..0887fa8515ebf0903e0c8fa7b4ebbdc805ea338a 100644 (file)
@@ -319,9 +319,9 @@ namespace Utilities
 #ifdef DEAL_II_WITH_MPI
       // makes use of the fact that the matrix stores its data in a
       // contiguous array.
-      sum(ArrayView<const Number>(&local.val[0], local.n_nonzero_elements()),
+      sum(ArrayView<const Number>(local.val.get(), local.n_nonzero_elements()),
           mpi_communicator,
-          ArrayView<Number>(&global.val[0], global.n_nonzero_elements()));
+          ArrayView<Number>(global.val.get(), global.n_nonzero_elements()));
 #else
       (void)mpi_communicator;
       if (!PointerComparison::equal(&local, &global))
index 2e0a8a9dc8e8e7870f0c16a5e97434ebd6297664..05ec5584067338cfb67fa2f60027b1f87dd9ce7d 100644 (file)
@@ -1064,7 +1064,7 @@ namespace Differentiation
         ::gradient(active_tape_index,
                    independent_variables.size(),
                    const_cast<scalar_type *>(independent_variables.data()),
-                   &gradient[0]);
+                   gradient.data());
       }
 
       static void
@@ -1086,7 +1086,7 @@ namespace Differentiation
           independent_variables.size();
         std::vector<scalar_type *> H(n_independent_variables);
         for (unsigned int i = 0; i < n_independent_variables; ++i)
-          H[i] = &(hessian[i][0]);
+          H[i] = &hessian[i][0];
 
         ::hessian(active_tape_index,
                   n_independent_variables,
@@ -1119,7 +1119,7 @@ namespace Differentiation
                    n_dependent_variables,
                    independent_variables.size(),
                    const_cast<scalar_type *>(independent_variables.data()),
-                   &values[0]);
+                   values.data());
       }
 
       static void
@@ -1141,7 +1141,7 @@ namespace Differentiation
 
         std::vector<scalar_type *> J(n_dependent_variables);
         for (unsigned int i = 0; i < n_dependent_variables; ++i)
-          J[i] = &(jacobian[i][0]);
+          J[i] = &jacobian[i][0];
 
         ::jacobian(active_tape_index,
                    n_dependent_variables,
index 6c1f3bd857f60d137d2faf4deece223d3f4a8df5..f2acc692d7aec3c6ba6a44ad80d984d5cc1f7fcc 100644 (file)
@@ -1158,7 +1158,7 @@ namespace FETools
           destinations.push_back(it->receiver);
 
           it->pack_data(*buffer);
-          const int ierr = MPI_Isend(&(*buffer)[0],
+          const int ierr = MPI_Isend(buffer->data(),
                                      buffer->size(),
                                      MPI_BYTE,
                                      it->receiver,
index c6642584b54622e56664c02c6509322083823fcb..3a89f434b7519809a36afc5ce484b87d855b192d 100644 (file)
@@ -3367,8 +3367,7 @@ namespace GridTools
               -> Point<spacedim> {
               return object->get_manifold().get_new_point(
                 make_array_view(vertices.begin(), vertices.end()),
-                make_array_view(&weights[0],
-                                &weights[n_vertices_per_cell - 1] + 1));
+                make_array_view(weights.begin_raw(), weights.end_raw()));
             };
 
             // pick the initial weights as (normalized) inverse distances from
index 631ab78720ac616bae5103e2359484d94b736bc8..19599515f96dc673648c4f9cf819ad024ae927b7 100644 (file)
@@ -3662,10 +3662,10 @@ AffineConstraints<number>::distribute_local_to_global(
       // calculate all the data that will be written into the matrix row.
       if (use_dealii_matrix == false)
         {
-          size_type *col_ptr = &cols[0];
+          size_type *col_ptr = cols.data();
           // cast is uncritical here and only used to avoid compiler
           // warnings. We never access a non-double array
-          number *val_ptr = &vals[0];
+          number *val_ptr = vals.data();
           internals::resolve_matrix_row(global_rows,
                                         global_rows,
                                         i,
@@ -3674,9 +3674,10 @@ AffineConstraints<number>::distribute_local_to_global(
                                         local_matrix,
                                         col_ptr,
                                         val_ptr);
-          const size_type n_values = col_ptr - &cols[0];
+          const size_type n_values = col_ptr - cols.data();
           if (n_values > 0)
-            global_matrix.add(row, n_values, &cols[0], &vals[0], false, true);
+            global_matrix.add(
+              row, n_values, cols.data(), vals.data(), false, true);
         }
       else
         internals::resolve_matrix_row(
@@ -3816,8 +3817,8 @@ AffineConstraints<number>::distribute_local_to_global(
                               end_block   = block_starts[block_col + 1];
               if (use_dealii_matrix == false)
                 {
-                  size_type *col_ptr = &cols[0];
-                  number *   val_ptr = &vals[0];
+                  size_type *col_ptr = cols.data();
+                  number *   val_ptr = vals.data();
                   internals::resolve_matrix_row(global_rows,
                                                 global_rows,
                                                 i,
@@ -3826,10 +3827,11 @@ AffineConstraints<number>::distribute_local_to_global(
                                                 local_matrix,
                                                 col_ptr,
                                                 val_ptr);
-                  const size_type n_values = col_ptr - &cols[0];
+                  const size_type n_values = col_ptr - cols.data();
                   if (n_values > 0)
                     global_matrix.block(block, block_col)
-                      .add(row, n_values, &cols[0], &vals[0], false, true);
+                      .add(
+                        row, n_values, cols.data(), vals.data(), false, true);
                 }
               else
                 {
@@ -3928,8 +3930,8 @@ AffineConstraints<number>::distribute_local_to_global(
       const size_type row = global_rows.global_row(i);
 
       // calculate all the data that will be written into the matrix row.
-      size_type *col_ptr = &cols[0];
-      number *   val_ptr = &vals[0];
+      size_type *col_ptr = cols.data();
+      number *   val_ptr = vals.data();
       internals::resolve_matrix_row(global_rows,
                                     global_cols,
                                     i,
@@ -3938,9 +3940,9 @@ AffineConstraints<number>::distribute_local_to_global(
                                     local_matrix,
                                     col_ptr,
                                     val_ptr);
-      const size_type n_values = col_ptr - &cols[0];
+      const size_type n_values = col_ptr - cols.data();
       if (n_values > 0)
-        global_matrix.add(row, n_values, &cols[0], &vals[0], false, true);
+        global_matrix.add(row, n_values, cols.data(), vals.data(), false, true);
     }
 }
 
index 13c9b4a335cf688e6f7f33e5ea80d69c8da85bd2..1449657e6b70fd70a5a1a5a514e538f46a04e5ad 100644 (file)
@@ -1809,8 +1809,8 @@ BlockMatrixBase<MatrixType>::set(const size_type  row,
       block(row_index.first, block_col)
         .set(row_index.second,
              temporary_data.counter_within_block[block_col],
-             &temporary_data.column_indices[block_col][0],
-             &temporary_data.column_values[block_col][0],
+             temporary_data.column_indices[block_col].data(),
+             temporary_data.column_values[block_col].data(),
              false);
     }
 }
@@ -2065,8 +2065,8 @@ BlockMatrixBase<MatrixType>::add(const size_type  row,
       block(row_index.first, block_col)
         .add(row_index.second,
              temporary_data.counter_within_block[block_col],
-             &temporary_data.column_indices[block_col][0],
-             &temporary_data.column_values[block_col][0],
+             temporary_data.column_indices[block_col].data(),
+             temporary_data.column_values[block_col].data(),
              false,
              col_indices_are_sorted);
     }
index 7ba9fb78152d3f5bf42d5b67ed8c70d4a317398a..82acba049cee456429662caede0d23718355d90a 100644 (file)
@@ -578,7 +578,7 @@ ChunkSparseMatrix<number>::add(const number                         factor,
   // add everything, including padding elements
   const size_type     chunk_size = cols->get_chunk_size();
   number *            val_ptr    = val.get();
-  const somenumber *  matrix_ptr = &matrix.val[0];
+  const somenumber *  matrix_ptr = matrix.val.get();
   const number *const end_ptr =
     val.get() +
     cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size;
index 210213f69d73baaa4fac5ea5af50f435ee7d1c4a..d05222e9b8cb0a78e5304701ab904f778abf9bcd 100644 (file)
@@ -121,8 +121,8 @@ FullMatrix<number>::all_zero() const
 {
   Assert(!this->empty(), ExcEmptyMatrix());
 
-  const number *      p = &this->values[0];
-  const number *const e = &this->values[0] + this->n_elements();
+  const number *      p = this->values.data();
+  const number *const e = this->values.data() + this->n_elements();
   while (p != e)
     if (*p++ != number(0.0))
       return false;
@@ -183,7 +183,7 @@ FullMatrix<number>::vmult(Vector<number2> &      dst,
 
   Assert(&src != &dst, ExcSourceEqualsDestination());
 
-  const number *e = &this->values[0];
+  const number *e = this->values.data();
   // get access to the data in order to
   // avoid copying it when using the ()
   // operator
@@ -214,7 +214,7 @@ FullMatrix<number>::Tvmult(Vector<number2> &      dst,
 
   Assert(&src != &dst, ExcSourceEqualsDestination());
 
-  const number *  e       = &this->values[0];
+  const number *  e       = this->values.data();
   number2 *       dst_ptr = &dst(0);
   const size_type size_m = m(), size_n = n();
 
@@ -567,7 +567,7 @@ FullMatrix<number>::mmult(FullMatrix<number2> &      dst,
              &alpha,
              &src(0, 0),
              &m,
-             &this->values[0],
+             this->values.data(),
              &k,
              &beta,
              &dst(0, 0),
@@ -652,7 +652,7 @@ FullMatrix<number>::Tmmult(FullMatrix<number2> &      dst,
              &alpha,
              &src(0, 0),
              &m,
-             &this->values[0],
+             this->values.data(),
              &n,
              &beta,
              &dst(0, 0),
@@ -757,7 +757,7 @@ FullMatrix<number>::mTmult(FullMatrix<number2> &      dst,
              &alpha,
              &src(0, 0),
              &k,
-             &this->values[0],
+             this->values.data(),
              &k,
              &beta,
              &dst(0, 0),
@@ -859,7 +859,7 @@ FullMatrix<number>::TmTmult(FullMatrix<number2> &      dst,
              &alpha,
              &src(0, 0),
              &k,
-             &this->values[0],
+             this->values.data(),
              &n,
              &beta,
              &dst(0, 0),
@@ -957,7 +957,7 @@ FullMatrix<number>::matrix_norm_square(const Vector<number2> &v) const
 
   number2         sum     = 0.;
   const size_type n_rows  = m();
-  const number *  val_ptr = &this->values[0];
+  const number *  val_ptr = this->values.data();
 
   for (size_type row = 0; row < n_rows; ++row)
     {
@@ -988,7 +988,7 @@ FullMatrix<number>::matrix_scalar_product(const Vector<number2> &u,
   number2         sum     = 0.;
   const size_type n_rows  = m();
   const size_type n_cols  = n();
-  const number *  val_ptr = &this->values[0];
+  const number *  val_ptr = this->values.data();
 
   for (size_type row = 0; row < n_rows; ++row)
     {
@@ -1859,7 +1859,7 @@ FullMatrix<number>::gauss_jordan()
 
         // Use the LAPACK function getrf for
         // calculating the LU factorization.
-        getrf(&nn, &nn, &this->values[0], &nn, ipiv.data(), &info);
+        getrf(&nn, &nn, this->values.data(), &nn, ipiv.data(), &info);
 
         Assert(info >= 0, ExcInternalError());
         Assert(info == 0, LACExceptions::ExcSingular());
@@ -1870,8 +1870,13 @@ FullMatrix<number>::gauss_jordan()
         // Use the LAPACK function getri for
         // calculating the actual inverse using
         // the LU factorization.
-        getri(
-          &nn, &this->values[0], &nn, ipiv.data(), inv_work.data(), &nn, &info);
+        getri(&nn,
+              this->values.data(),
+              &nn,
+              ipiv.data(),
+              inv_work.data(),
+              &nn,
+              &info);
 
         Assert(info >= 0, ExcInternalError());
         Assert(info == 0, LACExceptions::ExcSingular());
index 09ad999ca94c1761e4dce5fa0463389a2282dd3e..39bf4777323f8081f9f109661d2ac06d15619fb1 100644 (file)
@@ -1132,9 +1132,9 @@ namespace PETScWrappers
   VectorBase::extract_subvector_to(const std::vector<size_type> &indices,
                                    std::vector<PetscScalar> &    values) const
   {
-    extract_subvector_to(&(indices[0]),
-                         &(indices[0]) + indices.size(),
-                         &(values[0]));
+    Assert(indices.size() <= values.size(),
+           ExcDimensionMismatch(indices.size(), values.size()));
+    extract_subvector_to(indices.begin(), indices.end(), values.begin());
   }
 
   template <typename ForwardIterator, typename OutputIterator>
index b7414ff15025b86ba2b455ffcb4035dd70c24171..d4ae0455fb511fcd55363065742163cd0b673df8 100644 (file)
@@ -438,9 +438,9 @@ SparseMatrix<number>::copy_from(const TrilinosWrappers::SparseMatrix &matrix)
         row,
         matrix.row_length(row),
         ncols,
-        &(value_cache[0]),
+        value_cache.data(),
         reinterpret_cast<TrilinosWrappers::types::int_type *>(
-          &(colnum_cache[0])));
+          colnum_cache.data()));
       (void)ierr;
       Assert(ierr == 0, ExcTrilinosError(ierr));
 
@@ -1407,7 +1407,7 @@ SparseMatrix<number>::precondition_Jacobi(Vector<somenumber> &      dst,
   const size_type    n            = src.size();
   somenumber *       dst_ptr      = dst.begin();
   const somenumber * src_ptr      = src.begin();
-  const std::size_t *rowstart_ptr = &cols->rowstart[0];
+  const std::size_t *rowstart_ptr = cols->rowstart.get();
 
   // optimize the following loop for
   // the case that the relaxation
@@ -1452,7 +1452,7 @@ SparseMatrix<number>::precondition_SSOR(
   internal::SparseMatrixImplementation::AssertNoZerosOnDiagonal(*this);
 
   const size_type    n            = src.size();
-  const std::size_t *rowstart_ptr = &cols->rowstart[0];
+  const std::size_t *rowstart_ptr = cols->rowstart.get();
   somenumber *       dst_ptr      = &dst(0);
 
   // case when we have stored the position
@@ -1482,7 +1482,7 @@ SparseMatrix<number>::precondition_SSOR(
           *dst_ptr /= val[*rowstart_ptr];
         }
 
-      rowstart_ptr = &cols->rowstart[0];
+      rowstart_ptr = cols->rowstart.get();
       dst_ptr      = &dst(0);
       for (; rowstart_ptr != &cols->rowstart[n]; ++rowstart_ptr, ++dst_ptr)
         *dst_ptr *=
@@ -1521,10 +1521,10 @@ SparseMatrix<number>::precondition_SSOR(
       // line denotes the diagonal element,
       // which we need not check.
       const size_type first_right_of_diagonal_index =
-        (Utilities::lower_bound(&cols->colnums[*rowstart_ptr + 1],
-                                &cols->colnums[*(rowstart_ptr + 1)],
+        (Utilities::lower_bound(cols->colnums.get() + *rowstart_ptr + 1,
+                                cols->colnums.get() + *(rowstart_ptr + 1),
                                 row) -
-         &cols->colnums[0]);
+         cols->colnums.get());
 
       number s = 0;
       for (size_type j = (*rowstart_ptr) + 1; j < first_right_of_diagonal_index;
@@ -1537,7 +1537,7 @@ SparseMatrix<number>::precondition_SSOR(
       *dst_ptr /= val[*rowstart_ptr];
     };
 
-  rowstart_ptr = &cols->rowstart[0];
+  rowstart_ptr = cols->rowstart.get();
   dst_ptr      = &dst(0);
   for (size_type row = 0; row < n; ++row, ++rowstart_ptr, ++dst_ptr)
     *dst_ptr *= somenumber((number(2.) - om)) * somenumber(val[*rowstart_ptr]);
@@ -1552,7 +1552,7 @@ SparseMatrix<number>::precondition_SSOR(
         (Utilities::lower_bound(&cols->colnums[*rowstart_ptr + 1],
                                 &cols->colnums[end_row],
                                 static_cast<size_type>(row)) -
-         &cols->colnums[0]);
+         cols->colnums.get());
       number s = 0;
       for (size_type j = first_right_of_diagonal_index; j < end_row; ++j)
         s += val[j] * number(dst(cols->colnums[j]));
index 53fcb039f15e3212af85f599da3fc2142e6d1d2a..6b5d94274c5ef1520eaa7808f833e8b2e729b64b 100644 (file)
@@ -494,7 +494,7 @@ TensorProductMatrixSymmetricSumBase<dim, Number, size>::vmult(
          mass_matrix[0].n_rows());
   Number *      t   = tmp_array.begin();
   const Number *src = src_view.begin();
-  Number *      dst = &(dst_view[0]);
+  Number *      dst = dst_view.data();
 
   if (dim == 1)
     {
@@ -561,7 +561,7 @@ TensorProductMatrixSymmetricSumBase<dim, Number, size>::apply_inverse(
          mass_matrix[0].n_rows());
   Number *      t   = tmp_array.begin();
   const Number *src = src_view.data();
-  Number *      dst = &(dst_view[0]);
+  Number *      dst = dst_view.data();
 
   // NOTE: dof_to_quad has to be interpreted as 'dof to eigenvalue index'
   //       --> apply<.,true,.> (S,src,dst) calculates dst = S^T * src,
index ae7f7666a758445ae8631407bfad7c2666adb975..86da1001383d18edf86b3df0675c6dce7e9b84bd 100644 (file)
@@ -839,7 +839,7 @@ namespace CUDAWrappers
     unsigned int size_shape_values = n_dofs_1d * n_q_points_1d * sizeof(Number);
 
     cudaError_t cuda_error = cudaMemcpyToSymbol(internal::global_shape_values,
-                                                &shape_info.shape_values[0],
+                                                shape_info.shape_values.data(),
                                                 size_shape_values,
                                                 0,
                                                 cudaMemcpyHostToDevice);
@@ -848,7 +848,7 @@ namespace CUDAWrappers
     if (update_flags & update_gradients)
       {
         cuda_error = cudaMemcpyToSymbol(internal::global_shape_gradients,
-                                        &shape_info.shape_gradients[0],
+                                        shape_info.shape_gradients.data(),
                                         size_shape_values,
                                         0,
                                         cudaMemcpyHostToDevice);
index d790a74b8c0d78dee7d9e18561ec4c04dd86ff32..0aedc2af2d4febd3db79d3b806c2abe2b448f632 100644 (file)
@@ -95,15 +95,15 @@ MatrixFree<dim, Number>::create_cell_subrange_hp_by_index(
       AssertIndexRange(range.second, fe_indices.size() + 1);
 #endif
       std::pair<unsigned int, unsigned int> return_range;
-      return_range.first = std::lower_bound(&fe_indices[0] + range.first,
-                                            &fe_indices[0] + range.second,
+      return_range.first = std::lower_bound(fe_indices.begin() + range.first,
+                                            fe_indices.begin() + range.second,
                                             fe_index) -
-                           &fe_indices[0];
+                           fe_indices.begin();
       return_range.second =
-        std::lower_bound(&fe_indices[0] + return_range.first,
-                         &fe_indices[0] + range.second,
+        std::lower_bound(fe_indices.begin() + return_range.first,
+                         fe_indices.begin() + range.second,
                          fe_index + 1) -
-        &fe_indices[0];
+        fe_indices.begin();
       Assert(return_range.first >= range.first &&
                return_range.second <= range.second,
              ExcInternalError());
index eb35e1ebe9ecf7a1b90bc1f5160f5338e640d58e..3d5e13ef9fcb93c49de11e8f0a0e8fdf827abe63 100644 (file)
@@ -998,8 +998,9 @@ namespace MatrixFreeOperators
 
     const unsigned int shift_coefficient =
       inverse_coefficients.size() > dofs_per_component ? dofs_per_component : 0;
-    const VectorizedArray<Number> *inv_coefficient = &inverse_coefficients[0];
-    VectorizedArray<Number>        temp_data_field[dofs_per_component];
+    const VectorizedArray<Number> *inv_coefficient =
+      inverse_coefficients.data();
+    VectorizedArray<Number> temp_data_field[dofs_per_component];
     for (unsigned int d = 0; d < n_actual_components; ++d)
       {
         const VectorizedArray<Number> *in  = in_array + d * dofs_per_component;
index 0f102ac265ad5afe7a376c7ee24efcbed3d91899..9983825260044b4672faf8d9643ca1fd39312d56 100644 (file)
@@ -556,7 +556,7 @@ namespace DataOutBase
   const double *
   DataOutFilter::get_data_set(const unsigned int set_num) const
   {
-    return &data_sets[set_num][0];
+    return data_sets[set_num].data();
   }
 
 
@@ -5110,11 +5110,11 @@ namespace DataOutBase
 
       int total = (vars_per_node * num_nodes);
 
-      ierr = TECDAT(&total, &tm.nodalData[0], &is_double);
+      ierr = TECDAT(&total, tm.nodalData.data(), &is_double);
 
       Assert(ierr == 0, ExcTecplotAPIError());
 
-      ierr = TECNOD(&tm.connData[0]);
+      ierr = TECNOD(tm.connData.data());
 
       Assert(ierr == 0, ExcTecplotAPIError());
 
index d3b17463527a107539cfe763f54c8001d2bbc527..c9833733b1f634b6a18d254a3999fe2bf6a621ec 100644 (file)
@@ -209,7 +209,7 @@ namespace Utilities
       // results over all processes
       unsigned int n_recv_from;
       const int    ierr = MPI_Reduce_scatter_block(
-        &dest_vector[0], &n_recv_from, 1, MPI_UNSIGNED, MPI_SUM, mpi_comm);
+        dest_vector.data(), &n_recv_from, 1, MPI_UNSIGNED, MPI_SUM, mpi_comm);
 
       AssertThrowMPI(ierr);
 
@@ -222,7 +222,7 @@ namespace Utilities
                   el,
                   32766,
                   mpi_comm,
-                  &send_requests[&el - &destinations[0]]);
+                  send_requests.data() + (&el - destinations.data()));
 
       // if no one to receive from, return an empty vector
       if (n_recv_from == 0)
@@ -322,7 +322,7 @@ namespace Utilities
       unsigned int n_recv_from = 0;
 
       const int ierr = MPI_Reduce_scatter_block(
-        &dest_vector[0], &n_recv_from, 1, MPI_UNSIGNED, MPI_SUM, mpi_comm);
+        dest_vector.data(), &n_recv_from, 1, MPI_UNSIGNED, MPI_SUM, mpi_comm);
 
       AssertThrowMPI(ierr);
 
@@ -334,14 +334,14 @@ namespace Utilities
       std::vector<unsigned int> buffer(dest_vector.size());
       unsigned int              n_recv_from = 0;
 
-      MPI_Reduce(&dest_vector[0],
-                 &buffer[0],
+      MPI_Reduce(dest_vector.data(),
+                 buffer.data(),
                  dest_vector.size(),
                  MPI_UNSIGNED,
                  MPI_SUM,
                  0,
                  mpi_comm);
-      MPI_Scatter(&buffer[0],
+      MPI_Scatter(buffer.data(),
                   1,
                   MPI_UNSIGNED,
                   &n_recv_from,
index edeccc307868b3472bb7d6aba36e4041ca0c3ba4..26fdd11ab32536b247b4b96b87627770425f9c65 100644 (file)
@@ -301,7 +301,7 @@ TensorProductPolynomials<dim, PolynomialType>::compute(
       for (unsigned d = 0; d < dim; ++d)
         polynomials[i].value(p(d),
                              n_values_and_derivatives,
-                             &values_1d[i][d][0]);
+                             values_1d[i][d].data());
 
   unsigned int indices[3];
   unsigned int ind = 0;
index 2a15c791ddb13d83b13951f5516d2670a737b1f8..99068c23dac9dbc32c0b8dc41c5277af195d3d6f 100644 (file)
@@ -4242,7 +4242,7 @@ namespace parallel
           // that the packet has been
           // received
           it->second.pack_data(*buffer);
-          const int ierr = MPI_Isend(&(*buffer)[0],
+          const int ierr = MPI_Isend(buffer->data(),
                                      buffer->size(),
                                      MPI_BYTE,
                                      it->first,
index ab9a3f23362384c81dbc0950fb526c09a67b70d8..bdb9b68d537b1634d5d379378ac192cdab6d3e53 100644 (file)
@@ -4655,7 +4655,7 @@ namespace internal
 
               // send reply
               reply_buffers[idx] = cell_data_transfer_buffer.pack_data();
-              ierr               = MPI_Isend(&(reply_buffers[idx])[0],
+              ierr               = MPI_Isend(reply_buffers[idx].data(),
                                reply_buffers[idx].size(),
                                MPI_BYTE,
                                status.MPI_SOURCE,
@@ -5381,7 +5381,7 @@ namespace internal
               &level_number_cache.n_locally_owned_dofs,
               1,
               DEAL_II_DOF_INDEX_MPI_TYPE,
-              &level_number_cache.n_locally_owned_dofs_per_processor[0],
+              level_number_cache.n_locally_owned_dofs_per_processor.data(),
               1,
               DEAL_II_DOF_INDEX_MPI_TYPE,
               triangulation->get_communicator());
index 2e54c1374687afebb4f08147a5f87b336eab2a96..44400569ddce0627bbb2bb2de97d5c127a81732b 100644 (file)
@@ -1737,7 +1737,7 @@ namespace internal
               Assert(data.n_shape_functions > 0, ExcInternalError());
 
               const Tensor<1, spacedim> *supp_pts =
-                &data.mapping_support_points[0];
+                data.mapping_support_points.data();
 
               for (unsigned int point = 0; point < n_q_points; ++point)
                 {
index 7941bccaf944e6bb86d5844655b79e442ec76a72..7505dcd94aac9206f1a7bbee20c6c1a017db0cbd 100644 (file)
@@ -53,7 +53,7 @@ CellId::CellId(const unsigned int  coarse_cell_id,
   , n_child_indices(n_child_indices)
 {
   Assert(n_child_indices < child_indices.size(), ExcInternalError());
-  memcpy(&(child_indices[0]), id, n_child_indices);
+  memcpy(child_indices.data(), id, n_child_indices);
 }
 
 
index d5d2aefa24697b45bb084adb3479efb988d9e361..c00da148814ea62f04d6e47a1742cff9f58cca49 100644 (file)
@@ -2103,9 +2103,9 @@ GridIn<2>::read_netcdf(const std::string &filename)
               ExcIO());
   std::vector<std::vector<double>> point_values(
     3, std::vector<double>(n_vertices));
-  points_xc->get(&*point_values[0].begin(), n_vertices);
-  points_yc->get(&*point_values[1].begin(), n_vertices);
-  points_zc->get(&*point_values[2].begin(), n_vertices);
+  points_xc->get(point_values[0].data(), n_vertices);
+  points_yc->get(point_values[1].data(), n_vertices);
+  points_zc->get(point_values[2].data(), n_vertices);
 
   // and fill the vertices
   std::vector<Point<spacedim>> vertices(n_vertices);
@@ -2265,9 +2265,9 @@ GridIn<3>::read_netcdf(const std::string &filename)
               ExcIO());
   std::vector<std::vector<double>> point_values(
     3, std::vector<double>(n_vertices));
-  points_xc->get(&*point_values[0].begin(), n_vertices);
-  points_yc->get(&*point_values[1].begin(), n_vertices);
-  points_zc->get(&*point_values[2].begin(), n_vertices);
+  points_xc->get(point_values[0].data(), n_vertices);
+  points_yc->get(point_values[1].data(), n_vertices);
+  points_zc->get(point_values[2].data(), n_vertices);
 
   // and fill the vertices
   std::vector<Point<spacedim>> vertices(n_vertices);
index e5e354ee889c23020a7b564c632e54c86d1075f6..2b50ee5f4056290f18b1edd23b6e41b851372679 100644 (file)
@@ -2364,7 +2364,7 @@ namespace GridTools
           }
 
         // Send the message
-        ierr = MPI_Isend(&vertices_send_buffers[i][0],
+        ierr = MPI_Isend(vertices_send_buffers[i].data(),
                          buffer_size,
                          DEAL_II_VERTEX_INDEX_MPI_TYPE,
                          destination,
@@ -2389,7 +2389,7 @@ namespace GridTools
         vertices_recv_buffers[i].resize(buffer_size);
 
         // Receive the message
-        ierr = MPI_Recv(&vertices_recv_buffers[i][0],
+        ierr = MPI_Recv(vertices_recv_buffers[i].data(),
                         buffer_size,
                         DEAL_II_VERTEX_INDEX_MPI_TYPE,
                         source,
@@ -2430,7 +2430,7 @@ namespace GridTools
           }
 
         // Send the message
-        ierr = MPI_Isend(&cellids_send_buffers[i][0],
+        ierr = MPI_Isend(cellids_send_buffers[i].data(),
                          buffer_size,
                          MPI_CHAR,
                          destination,
@@ -2453,7 +2453,7 @@ namespace GridTools
         cellids_recv_buffers[i].resize(buffer_size);
 
         // Receive the message
-        ierr = MPI_Recv(&cellids_recv_buffers[i][0],
+        ierr = MPI_Recv(cellids_recv_buffers[i].data(),
                         buffer_size,
                         MPI_CHAR,
                         source,
@@ -5029,7 +5029,7 @@ namespace GridTools
     int ierr = MPI_Allgather(&n_local_data,
                              1,
                              MPI_INT,
-                             &(size_all_data[0]),
+                             size_all_data.data(),
                              1,
                              MPI_INT,
                              mpi_communicator);
@@ -5046,12 +5046,12 @@ namespace GridTools
     // Allocating a vector to contain all the received data
     std::vector<double> data_array(rdispls.back() + size_all_data.back());
 
-    ierr = MPI_Allgatherv(&(loc_data_array[0]),
+    ierr = MPI_Allgatherv(loc_data_array.data(),
                           n_local_data,
                           MPI_DOUBLE,
-                          &(data_array[0]),
-                          &(size_all_data[0]),
-                          &(rdispls[0]),
+                          data_array.data(),
+                          size_all_data.data(),
+                          rdispls.data(),
                           MPI_DOUBLE,
                           mpi_communicator);
     AssertThrowMPI(ierr);
index a30c106eb113ff36f54afa7ad1eff7786134dcfb..4e62fde8deb470b1e96afa80aa669863c381a97a 100644 (file)
@@ -2218,7 +2218,7 @@ CellAccessor<dim, spacedim>::id() const
   Assert(ptr.level() == 0, ExcInternalError());
   const unsigned int coarse_index = ptr.index();
 
-  return CellId(coarse_index, n_child_indices, &(id[0]));
+  return CellId(coarse_index, n_child_indices, id.data());
 }
 
 
index 07b5cae62543a8169c42fd16d89aaff94fce2db9..6756e9d97dedc25a42a0cfb2ba8e5efae5412185 100644 (file)
@@ -298,7 +298,7 @@ namespace CUDAWrappers
     // Copy the elements to the gpu
     val_dev.reset(Utilities::CUDA::allocate_device_data<Number>(nnz));
     cudaError_t error_code = cudaMemcpy(val_dev.get(),
-                                        &val[0],
+                                        val.data(),
                                         nnz * sizeof(Number),
                                         cudaMemcpyHostToDevice);
     AssertCuda(error_code);
@@ -307,7 +307,7 @@ namespace CUDAWrappers
     column_index_dev.reset(Utilities::CUDA::allocate_device_data<int>(nnz));
     AssertCuda(error_code);
     error_code = cudaMemcpy(column_index_dev.get(),
-                            &column_index[0],
+                            column_index.data(),
                             nnz * sizeof(int),
                             cudaMemcpyHostToDevice);
     AssertCuda(error_code);
@@ -316,7 +316,7 @@ namespace CUDAWrappers
     row_ptr_dev.reset(Utilities::CUDA::allocate_device_data<int>(row_ptr_size));
     AssertCuda(error_code);
     error_code = cudaMemcpy(row_ptr_dev.get(),
-                            &row_ptr[0],
+                            row_ptr.data(),
                             row_ptr_size * sizeof(int),
                             cudaMemcpyHostToDevice);
     AssertCuda(error_code);
index 9058de9a879b3594912a3c3f42547dfedf49e488..80d53bcc7fb73650511e7154ccf0a68a07b13093 100644 (file)
@@ -82,7 +82,7 @@ namespace internal
       geev(&vl,
            &vr,
            &n_rows,
-           &matrix[0],
+           matrix.data(),
            &n_rows,
            real_part_eigenvalues.data(),
            imag_part_eigenvalues.data(),
@@ -134,7 +134,7 @@ namespace internal
       geev(&vl,
            &vr,
            &n_rows,
-           &matrix[0],
+           matrix.data(),
            &n_rows,
            eigenvalues.data(),
            left_eigenvectors.data(),
@@ -178,12 +178,12 @@ namespace internal
       gesdd(&job,
             &n_rows,
             &n_cols,
-            &matrix[0],
+            matrix.data(),
             &n_rows,
             singular_values.data(),
-            &left_vectors[0],
+            left_vectors.data(),
             &n_rows,
-            &right_vectors[0],
+            right_vectors.data(),
             &n_cols,
             real_work.data(),
             &work_flag,
@@ -224,12 +224,12 @@ namespace internal
       gesdd(&job,
             &n_rows,
             &n_cols,
-            &matrix[0],
+            matrix.data(),
             &n_rows,
             singular_values.data(),
-            &left_vectors[0],
+            left_vectors.data(),
             &n_rows,
-            &right_vectors[0],
+            right_vectors.data(),
             &n_cols,
             work.data(),
             &work_flag,
@@ -436,7 +436,7 @@ LAPACKFullMatrix<number>::operator*=(const number factor)
   types::blas_int       info  = 0;
   // kl and ku will not be referenced for type = G (dense matrices).
   const types::blas_int kl     = 0;
-  number *              values = &this->values[0];
+  number *              values = this->values.data();
 
   lascl(&type, &kl, &kl, &cfrom, &factor, &m, &n, values, &lda, &info);
 
@@ -466,7 +466,7 @@ LAPACKFullMatrix<number>::operator/=(const number factor)
   types::blas_int       info = 0;
   // kl and ku will not be referenced for type = G (dense matrices).
   const types::blas_int kl     = 0;
-  number *              values = &this->values[0];
+  number *              values = this->values.data();
 
   lascl(&type, &kl, &kl, &factor, &cto, &m, &n, values, &lda, &info);
 
@@ -496,8 +496,8 @@ LAPACKFullMatrix<number>::add(const number a, const LAPACKFullMatrix<number> &A)
   // ==> use BLAS 1 for adding vectors
   const types::blas_int n        = this->m() * this->n();
   const types::blas_int inc      = 1;
-  number *              values   = &this->values[0];
-  const number *        values_A = &A.values[0];
+  number *              values   = this->values.data();
+  const number *        values_A = A.values.data();
 
   axpy(&n, &a, values_A, &inc, values, &inc);
 }
@@ -677,7 +677,8 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
       const types::blas_int lda  = N;
       const types::blas_int incx = 1;
 
-      trmv(&uplo, &trans, &diag, &N, &this->values[0], &lda, &w[0], &incx);
+      trmv(
+        &uplo, &trans, &diag, &N, this->values.data(), &lda, w.data(), &incx);
 
       return;
     }
@@ -694,12 +695,12 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
                &mm,
                &nn,
                &alpha,
-               &this->values[0],
+               this->values.data(),
                &mm,
-               v.values.get(),
+               v.data(),
                &one,
                &beta,
-               w.values.get(),
+               w.data(),
                &one);
           break;
         }
@@ -714,9 +715,9 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
                &nn,
                &nn,
                &alpha,
-               &svd_vt->values[0],
+               svd_vt->values.data(),
                &nn,
-               v.values.get(),
+               v.data(),
                &one,
                &null,
                work.data(),
@@ -729,12 +730,12 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
                &mm,
                &mm,
                &alpha,
-               &svd_u->values[0],
+               svd_u->values.data(),
                &mm,
                work.data(),
                &one,
                &beta,
-               w.values.get(),
+               w.data(),
                &one);
           break;
         }
@@ -749,9 +750,9 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
                &mm,
                &mm,
                &alpha,
-               &svd_u->values[0],
+               svd_u->values.data(),
                &mm,
-               v.values.get(),
+               v.data(),
                &one,
                &null,
                work.data(),
@@ -764,12 +765,12 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
                &nn,
                &nn,
                &alpha,
-               &svd_vt->values[0],
+               svd_vt->values.data(),
                &nn,
                work.data(),
                &one,
                &beta,
-               w.values.get(),
+               w.data(),
                &one);
           break;
         }
@@ -811,7 +812,8 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
       const types::blas_int lda  = N;
       const types::blas_int incx = 1;
 
-      trmv(&uplo, &trans, &diag, &N, &this->values[0], &lda, &w[0], &incx);
+      trmv(
+        &uplo, &trans, &diag, &N, this->values.data(), &lda, w.data(), &incx);
 
       return;
     }
@@ -829,12 +831,12 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
                &mm,
                &nn,
                &alpha,
-               &this->values[0],
+               this->values.data(),
                &mm,
-               v.values.get(),
+               v.data(),
                &one,
                &beta,
-               w.values.get(),
+               w.data(),
                &one);
           break;
         }
@@ -850,9 +852,9 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
                &mm,
                &mm,
                &alpha,
-               &svd_u->values[0],
+               svd_u->values.data(),
                &mm,
-               v.values.get(),
+               v.data(),
                &one,
                &null,
                work.data(),
@@ -865,12 +867,12 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
                &nn,
                &nn,
                &alpha,
-               &svd_vt->values[0],
+               svd_vt->values.data(),
                &nn,
                work.data(),
                &one,
                &beta,
-               w.values.get(),
+               w.data(),
                &one);
           break;
         }
@@ -886,9 +888,9 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
                &nn,
                &nn,
                &alpha,
-               &svd_vt->values[0],
+               svd_vt->values.data(),
                &nn,
-               v.values.get(),
+               v.data(),
                &one,
                &null,
                work.data(),
@@ -901,12 +903,12 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
                &mm,
                &mm,
                &alpha,
-               &svd_u->values[0],
+               svd_u->values.data(),
                &mm,
                work.data(),
                &one,
                &beta,
-               w.values.get(),
+               w.data(),
                &one);
           break;
         }
@@ -958,12 +960,12 @@ LAPACKFullMatrix<number>::mmult(LAPACKFullMatrix<number> &      C,
        &nn,
        &kk,
        &alpha,
-       &this->values[0],
+       this->values.data(),
        &mm,
-       &B.values[0],
+       B.values.data(),
        &kk,
        &beta,
-       &C.values[0],
+       C.values.data(),
        &mm);
 }
 
@@ -993,9 +995,9 @@ LAPACKFullMatrix<number>::mmult(FullMatrix<number> &            C,
        &mm,
        &kk,
        &alpha,
-       &B.values[0],
+       B.values.data(),
        &kk,
-       &this->values[0],
+       this->values.data(),
        &mm,
        &beta,
        &C(0, 0),
@@ -1055,12 +1057,12 @@ LAPACKFullMatrix<number>::Tmmult(LAPACKFullMatrix<number> &      C,
        &nn,
        &kk,
        &alpha,
-       &this->values[0],
+       this->values.data(),
        &kk,
-       &work[0],
+       work.data(),
        &kk,
        &beta,
-       &C.values[0],
+       C.values.data(),
        &mm);
 }
 
@@ -1077,7 +1079,7 @@ LAPACKFullMatrix<number>::transpose(LAPACKFullMatrix<number> &B) const
   const types::blas_int n = B.n();
 #ifdef DEAL_II_LAPACK_WITH_MKL
   const number one = 1.;
-  omatcopy('C', 'C', n, m, one, &A.values[0], n, &B.values[0], m);
+  omatcopy('C', 'C', n, m, one, A.values.data(), n, B.values.data(), m);
 #else
   for (types::blas_int i = 0; i < m; ++i)
     for (types::blas_int j = 0; j < n; ++j)
@@ -1128,10 +1130,10 @@ LAPACKFullMatrix<number>::Tmmult(LAPACKFullMatrix<number> &      C,
            &nn,
            &kk,
            &alpha,
-           &this->values[0],
+           this->values.data(),
            &kk,
            &beta,
-           &C.values[0],
+           C.values.data(),
            &nn);
 
       // fill-in lower triangular part
@@ -1149,12 +1151,12 @@ LAPACKFullMatrix<number>::Tmmult(LAPACKFullMatrix<number> &      C,
            &nn,
            &kk,
            &alpha,
-           &this->values[0],
+           this->values.data(),
            &kk,
-           &B.values[0],
+           B.values.data(),
            &kk,
            &beta,
-           &C.values[0],
+           C.values.data(),
            &mm);
     }
 }
@@ -1185,9 +1187,9 @@ LAPACKFullMatrix<number>::Tmmult(FullMatrix<number> &            C,
        &mm,
        &kk,
        &alpha,
-       &B.values[0],
+       B.values.data(),
        &kk,
-       &this->values[0],
+       this->values.data(),
        &kk,
        &beta,
        &C(0, 0),
@@ -1220,10 +1222,10 @@ LAPACKFullMatrix<number>::mTmult(LAPACKFullMatrix<number> &      C,
            &nn,
            &kk,
            &alpha,
-           &this->values[0],
+           this->values.data(),
            &nn,
            &beta,
-           &C.values[0],
+           C.values.data(),
            &nn);
 
       // fill-in lower triangular part
@@ -1241,12 +1243,12 @@ LAPACKFullMatrix<number>::mTmult(LAPACKFullMatrix<number> &      C,
            &nn,
            &kk,
            &alpha,
-           &this->values[0],
+           this->values.data(),
            &mm,
-           &B.values[0],
+           B.values.data(),
            &nn,
            &beta,
-           &C.values[0],
+           C.values.data(),
            &mm);
     }
 }
@@ -1278,9 +1280,9 @@ LAPACKFullMatrix<number>::mTmult(FullMatrix<number> &            C,
        &mm,
        &kk,
        &alpha,
-       &B.values[0],
+       B.values.data(),
        &nn,
-       &this->values[0],
+       this->values.data(),
        &mm,
        &beta,
        &C(0, 0),
@@ -1312,12 +1314,12 @@ LAPACKFullMatrix<number>::TmTmult(LAPACKFullMatrix<number> &      C,
        &nn,
        &kk,
        &alpha,
-       &this->values[0],
+       this->values.data(),
        &kk,
-       &B.values[0],
+       B.values.data(),
        &nn,
        &beta,
-       &C.values[0],
+       C.values.data(),
        &mm);
 }
 
@@ -1347,9 +1349,9 @@ LAPACKFullMatrix<number>::TmTmult(FullMatrix<number> &            C,
        &mm,
        &kk,
        &alpha,
-       &B.values[0],
+       B.values.data(),
        &nn,
-       &this->values[0],
+       this->values.data(),
        &kk,
        &beta,
        &C(0, 0),
@@ -1366,7 +1368,7 @@ LAPACKFullMatrix<number>::compute_lu_factorization()
 
   const types::blas_int mm     = this->m();
   const types::blas_int nn     = this->n();
-  number *const         values = &this->values[0];
+  number *const         values = this->values.data();
   ipiv.resize(mm);
   types::blas_int info = 0;
   getrf(&mm, &nn, values, &mm, ipiv.data(), &info);
@@ -1432,7 +1434,7 @@ LAPACKFullMatrix<number>::norm(const char type) const
 
   const types::blas_int N      = this->n();
   const types::blas_int M      = this->m();
-  const number *const   values = &this->values[0];
+  const number *const   values = this->values.data();
   if (property == symmetric)
     {
       const types::blas_int lda = std::max<types::blas_int>(1, N);
@@ -1484,7 +1486,7 @@ LAPACKFullMatrix<number>::compute_cholesky_factorization()
   (void)mm;
   Assert(mm == nn, ExcDimensionMismatch(mm, nn));
 
-  number *const         values = &this->values[0];
+  number *const         values = this->values.data();
   types::blas_int       info   = 0;
   const types::blas_int lda    = std::max<types::blas_int>(1, nn);
   potrf(&LAPACKSupport::L, &nn, values, &lda, &info);
@@ -1507,7 +1509,7 @@ LAPACKFullMatrix<number>::reciprocal_condition_number(const number a_norm) const
   number rcond = 0.;
 
   const types::blas_int N      = this->m();
-  const number *        values = &this->values[0];
+  const number *        values = this->values.data();
   types::blas_int       info   = 0;
   const types::blas_int lda    = std::max<types::blas_int>(1, N);
   work.resize(3 * N);
@@ -1541,7 +1543,7 @@ LAPACKFullMatrix<number>::reciprocal_condition_number() const
   number rcond = 0.;
 
   const types::blas_int N      = this->m();
-  const number *const   values = &this->values[0];
+  const number *const   values = this->values.data();
   types::blas_int       info   = 0;
   const types::blas_int lda    = std::max<types::blas_int>(1, N);
   work.resize(3 * N);
@@ -1698,7 +1700,7 @@ LAPACKFullMatrix<number>::invert()
   const types::blas_int nn = this->n();
   Assert(nn == mm, ExcNotQuadratic());
 
-  number *const   values = &this->values[0];
+  number *const   values = this->values.data();
   types::blas_int info   = 0;
 
   if (property != symmetric)
@@ -1740,7 +1742,7 @@ LAPACKFullMatrix<number>::solve(Vector<number> &v, const bool transposed) const
   AssertDimension(this->m(), v.size());
   const char *          trans  = transposed ? &T : &N;
   const types::blas_int nn     = this->n();
-  const number *const   values = &this->values[0];
+  const number *const   values = this->values.data();
   const types::blas_int n_rhs  = 1;
   types::blas_int       info   = 0;
 
@@ -1786,19 +1788,32 @@ LAPACKFullMatrix<number>::solve(LAPACKFullMatrix<number> &B,
   AssertDimension(this->m(), B.m());
   const char *          trans  = transposed ? &T : &N;
   const types::blas_int nn     = this->n();
-  const number *const   values = &this->values[0];
+  const number *const   values = this->values.data();
   const types::blas_int n_rhs  = B.n();
   types::blas_int       info   = 0;
 
   if (state == lu)
     {
-      getrs(
-        trans, &nn, &n_rhs, values, &nn, ipiv.data(), &B.values[0], &nn, &info);
+      getrs(trans,
+            &nn,
+            &n_rhs,
+            values,
+            &nn,
+            ipiv.data(),
+            B.values.data(),
+            &nn,
+            &info);
     }
   else if (state == cholesky)
     {
-      potrs(
-        &LAPACKSupport::L, &nn, &n_rhs, values, &nn, &B.values[0], &nn, &info);
+      potrs(&LAPACKSupport::L,
+            &nn,
+            &n_rhs,
+            values,
+            &nn,
+            B.values.data(),
+            &nn,
+            &info);
     }
   else if (property == upper_triangular || property == lower_triangular)
     {
@@ -1814,7 +1829,7 @@ LAPACKFullMatrix<number>::solve(LAPACKFullMatrix<number> &B,
             &n_rhs,
             values,
             &lda,
-            &B.values[0],
+            B.values.data(),
             &ldb,
             &info);
     }
@@ -1977,8 +1992,8 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric(
   wr.resize(nn);
   LAPACKFullMatrix<number> matrix_eigenvectors(nn, nn);
 
-  number *const values_A            = &this->values[0];
-  number *const values_eigenvectors = &matrix_eigenvectors.values[0];
+  number *const values_A            = this->values.data();
+  number *const values_eigenvectors = matrix_eigenvectors.values.data();
 
   types::blas_int              info(0), lwork(-1), n_eigenpairs(0);
   const char *const            jobz(&V);
@@ -2092,9 +2107,9 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric(
   wr.resize(nn);
   LAPACKFullMatrix<number> matrix_eigenvectors(nn, nn);
 
-  number *const values_A            = &this->values[0];
-  number *const values_B            = &B.values[0];
-  number *const values_eigenvectors = &matrix_eigenvectors.values[0];
+  number *const values_A            = this->values.data();
+  number *const values_B            = B.values.data();
+  number *const values_eigenvectors = matrix_eigenvectors.values.data();
 
   types::blas_int              info(0), lwork(-1), n_eigenpairs(0);
   const char *const            jobz(&V);
@@ -2216,8 +2231,8 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric(
   wi.resize(nn); // This is set purely for consistency reasons with the
   // eigenvalues() function.
 
-  number *const values_A = &this->values[0];
-  number *const values_B = &B.values[0];
+  number *const values_A = this->values.data();
+  number *const values_B = B.values.data();
 
   types::blas_int   info  = 0;
   types::blas_int   lwork = -1;
index 4b528a1cd00e6ca5ac0ec7f2ded90ddff9969bb4..08db8963acd39525f1c99b43dc112850b315a9ac 100644 (file)
@@ -456,7 +456,7 @@ namespace PETScWrappers
           // now copy over the information
           // from the sparsity pattern.
           {
-            PetscInt *ptr = &colnums_in_window[0];
+            PetscInt *ptr = colnums_in_window.data();
             for (PetscInt i = local_row_start; i < local_row_end; ++i)
               for (typename SparsityPatternType::iterator p =
                      sparsity_pattern.begin(i);
@@ -583,7 +583,7 @@ namespace PETScWrappers
           // now copy over the information
           // from the sparsity pattern.
           {
-            PetscInt *ptr = &colnums_in_window[0];
+            PetscInt *ptr = colnums_in_window.data();
             for (size_type i = local_row_start; i < local_row_end; ++i)
               for (typename SparsityPatternType::iterator p =
                      sparsity_pattern.begin(i);
index 2f33532dba173f12ac055f5e8ef0ddabd03bfb71..f0a12353b2808c394f1756cbce90d8fb7a8d9c2b 100644 (file)
@@ -267,7 +267,7 @@ namespace PETScWrappers
 
       const PetscInt *ptr =
         (ghostindices.size() > 0 ?
-           reinterpret_cast<const PetscInt *>(&(ghostindices[0])) :
+           reinterpret_cast<const PetscInt *>(ghostindices.data()) :
            nullptr);
 
       PetscErrorCode ierr = VecCreateGhost(communicator,
index b6bbfbb7d8e24c41e8252d1286003c12ea3e4cc0..9a5f1bb157351f2df8cf963b0c4179db62941857 100644 (file)
@@ -457,7 +457,7 @@ ScaLAPACKMatrix<NumberType>::copy_from(const LAPACKFullMatrix<NumberType> &B,
     {
       const int   ii = 1;
       NumberType *loc_vals_A =
-        this->values.size() > 0 ? &(this->values[0]) : nullptr;
+        this->values.size() > 0 ? this->values.data() : nullptr;
       const NumberType *loc_vals_B =
         mpi_process_is_active_B ? &(B(0, 0)) : nullptr;
 
@@ -628,7 +628,7 @@ ScaLAPACKMatrix<NumberType>::copy_to(LAPACKFullMatrix<NumberType> &B,
     {
       const int         ii = 1;
       const NumberType *loc_vals_A =
-        this->values.size() > 0 ? &(this->values[0]) : nullptr;
+        this->values.size() > 0 ? this->values.data() : nullptr;
       NumberType *loc_vals_B = mpi_process_is_active_B ? &(B(0, 0)) : nullptr;
 
       pgemr2d(&n_rows,
@@ -801,7 +801,7 @@ ScaLAPACKMatrix<NumberType>::copy_to(
   if (in_context_A)
     {
       if (this->values.size() != 0)
-        loc_vals_A = &this->values[0];
+        loc_vals_A = this->values.data();
 
       for (unsigned int i = 0; i < desc_A.size(); ++i)
         desc_A[i] = this->descriptor[i];
@@ -812,7 +812,7 @@ ScaLAPACKMatrix<NumberType>::copy_to(
   if (in_context_B)
     {
       if (B.values.size() != 0)
-        loc_vals_B = &B.values[0];
+        loc_vals_B = B.values.data();
 
       for (unsigned int i = 0; i < desc_B.size(); ++i)
         desc_B[i] = B.descriptor[i];
@@ -922,7 +922,7 @@ ScaLAPACKMatrix<NumberType>::copy_to(ScaLAPACKMatrix<NumberType> &dest) const
           AssertThrow(this->values.size() > 0,
                       dealii::ExcMessage(
                         "source: process is active but local matrix empty"));
-          loc_vals_source = &this->values[0];
+          loc_vals_source = this->values.data();
         }
       if (dest.grid->mpi_process_is_active && (dest.values.size() > 0))
         {
@@ -930,7 +930,7 @@ ScaLAPACKMatrix<NumberType>::copy_to(ScaLAPACKMatrix<NumberType> &dest) const
             dest.values.size() > 0,
             dealii::ExcMessage(
               "destination: process is active but local matrix empty"));
-          loc_vals_dest = &dest.values[0];
+          loc_vals_dest = dest.values.data();
         }
       pgemr2d(&n_rows,
               &n_columns,
@@ -1012,8 +1012,9 @@ ScaLAPACKMatrix<NumberType>::add(const ScaLAPACKMatrix<NumberType> &B,
     {
       char        trans_b = transpose_B ? 'T' : 'N';
       NumberType *A_loc =
-        (this->values.size() > 0) ? &this->values[0] : nullptr;
-      const NumberType *B_loc = (B.values.size() > 0) ? &B.values[0] : nullptr;
+        (this->values.size() > 0) ? this->values.data() : nullptr;
+      const NumberType *B_loc =
+        (B.values.size() > 0) ? B.values.data() : nullptr;
 
       pgeadd(&trans_b,
              &n_rows,
@@ -1138,10 +1139,10 @@ ScaLAPACKMatrix<NumberType>::mult(const NumberType                   b,
       char trans_b = transpose_B ? 'T' : 'N';
 
       const NumberType *A_loc =
-        (this->values.size() > 0) ? (&(this->values[0])) : nullptr;
+        (this->values.size() > 0) ? this->values.data() : nullptr;
       const NumberType *B_loc =
-        (B.values.size() > 0) ? (&(B.values[0])) : nullptr;
-      NumberType *C_loc = (C.values.size() > 0) ? (&(C.values[0])) : nullptr;
+        (B.values.size() > 0) ? B.values.data() : nullptr;
+      NumberType *C_loc = (C.values.size() > 0) ? C.values.data() : nullptr;
       int         m     = C.n_rows;
       int         n     = C.n_columns;
       int         k     = transpose_A ? this->n_rows : this->n_columns;
@@ -1242,7 +1243,7 @@ ScaLAPACKMatrix<NumberType>::compute_cholesky_factorization()
   if (grid->mpi_process_is_active)
     {
       int         info  = 0;
-      NumberType *A_loc = &this->values[0];
+      NumberType *A_loc = this->values.data();
       // pdpotrf_(&uplo,&n_columns,A_loc,&submatrix_row,&submatrix_column,descriptor,&info);
       ppotrf(&uplo,
              &n_columns,
@@ -1271,7 +1272,7 @@ ScaLAPACKMatrix<NumberType>::compute_lu_factorization()
   if (grid->mpi_process_is_active)
     {
       int         info  = 0;
-      NumberType *A_loc = &this->values[0];
+      NumberType *A_loc = this->values.data();
 
       const int iarow = indxg2p_(&submatrix_row,
                                  &row_block_size,
@@ -1325,7 +1326,7 @@ ScaLAPACKMatrix<NumberType>::invert()
             property == LAPACKSupport::upper_triangular ? 'U' : 'L';
           const char  diag  = 'N';
           int         info  = 0;
-          NumberType *A_loc = &this->values[0];
+          NumberType *A_loc = this->values.data();
           ptrtri(&uploTriangular,
                  &diag,
                  &n_columns,
@@ -1355,7 +1356,7 @@ ScaLAPACKMatrix<NumberType>::invert()
       if (grid->mpi_process_is_active)
         {
           int         info  = 0;
-          NumberType *A_loc = &this->values[0];
+          NumberType *A_loc = this->values.data();
 
           if (is_symmetric)
             {
@@ -1575,7 +1576,7 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
           il = std::min(eigenvalue_idx.first, eigenvalue_idx.second) + 1;
           iu = std::max(eigenvalue_idx.first, eigenvalue_idx.second) + 1;
         }
-      NumberType *A_loc = &this->values[0];
+      NumberType *A_loc = this->values.data();
       /*
        * by setting lwork to -1 a workspace query for optimal length of work is
        * performed
@@ -1583,7 +1584,7 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
       int         lwork  = -1;
       int         liwork = -1;
       NumberType *eigenvectors_loc =
-        (compute_eigenvectors ? &eigenvectors->values[0] : nullptr);
+        (compute_eigenvectors ? eigenvectors->values.data() : nullptr);
       work.resize(1);
       iwork.resize(1);
 
@@ -1596,12 +1597,12 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
                 &submatrix_row,
                 &submatrix_column,
                 descriptor,
-                &ev[0],
+                ev.data(),
                 eigenvectors_loc,
                 &eigenvectors->submatrix_row,
                 &eigenvectors->submatrix_column,
                 eigenvectors->descriptor,
-                &work[0],
+                work.data(),
                 &lwork,
                 &info);
           AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("psyev", info));
@@ -1630,19 +1631,19 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
                  &abstol,
                  &m,
                  &nz,
-                 &ev[0],
+                 ev.data(),
                  &orfac,
                  eigenvectors_loc,
                  &eigenvectors->submatrix_row,
                  &eigenvectors->submatrix_column,
                  eigenvectors->descriptor,
-                 &work[0],
+                 work.data(),
                  &lwork,
-                 &iwork[0],
+                 iwork.data(),
                  &liwork,
-                 &ifail[0],
-                 &iclustr[0],
-                 &gap[0],
+                 ifail.data(),
+                 iclustr.data(),
+                 gap.data(),
                  &info);
           AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("psyevx", info));
         }
@@ -1658,12 +1659,12 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
                 &submatrix_row,
                 &submatrix_column,
                 descriptor,
-                &ev[0],
+                ev.data(),
                 eigenvectors_loc,
                 &eigenvectors->submatrix_row,
                 &eigenvectors->submatrix_column,
                 eigenvectors->descriptor,
-                &work[0],
+                work.data(),
                 &lwork,
                 &info);
 
@@ -1690,19 +1691,19 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
                  &abstol,
                  &m,
                  &nz,
-                 &ev[0],
+                 ev.data(),
                  &orfac,
                  eigenvectors_loc,
                  &eigenvectors->submatrix_row,
                  &eigenvectors->submatrix_column,
                  eigenvectors->descriptor,
-                 &work[0],
+                 work.data(),
                  &lwork,
-                 &iwork[0],
+                 iwork.data(),
                  &liwork,
-                 &ifail[0],
-                 &iclustr[0],
-                 &gap[0],
+                 ifail.data(),
+                 iclustr.data(),
+                 gap.data(),
                  &info);
 
           AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("psyevx", info));
@@ -1880,7 +1881,7 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric_MRRR(
           il = std::min(eigenvalue_idx.first, eigenvalue_idx.second) + 1;
           iu = std::max(eigenvalue_idx.first, eigenvalue_idx.second) + 1;
         }
-      NumberType *A_loc = &this->values[0];
+      NumberType *A_loc = this->values.data();
 
       /*
        * By setting lwork to -1 a workspace query for optimal length of work is
@@ -1889,7 +1890,7 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric_MRRR(
       int         lwork  = -1;
       int         liwork = -1;
       NumberType *eigenvectors_loc =
-        (compute_eigenvectors ? &eigenvectors->values[0] : nullptr);
+        (compute_eigenvectors ? eigenvectors->values.data() : nullptr);
       work.resize(1);
       iwork.resize(1);
 
@@ -2049,9 +2050,9 @@ ScaLAPACKMatrix<NumberType>::compute_SVD(ScaLAPACKMatrix<NumberType> *U,
     {
       char        jobu   = left_singluar_vectors ? 'V' : 'N';
       char        jobvt  = right_singluar_vectors ? 'V' : 'N';
-      NumberType *A_loc  = &this->values[0];
-      NumberType *U_loc  = left_singluar_vectors ? &(U->values[0]) : nullptr;
-      NumberType *VT_loc = right_singluar_vectors ? &(VT->values[0]) : nullptr;
+      NumberType *A_loc  = this->values.data();
+      NumberType *U_loc  = left_singluar_vectors ? U->values.data() : nullptr;
+      NumberType *VT_loc = right_singluar_vectors ? VT->values.data() : nullptr;
       int         info   = 0;
       /*
        * by setting lwork to -1 a workspace query for optimal length of work is
@@ -2077,7 +2078,7 @@ ScaLAPACKMatrix<NumberType>::compute_SVD(ScaLAPACKMatrix<NumberType> *U,
              &VT->submatrix_row,
              &VT->submatrix_column,
              VT->descriptor,
-             &work[0],
+             work.data(),
              &lwork,
              &info);
       AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("pgesvd", info));
@@ -2102,7 +2103,7 @@ ScaLAPACKMatrix<NumberType>::compute_SVD(ScaLAPACKMatrix<NumberType> *U,
              &VT->submatrix_row,
              &VT->submatrix_column,
              VT->descriptor,
-             &work[0],
+             work.data(),
              &lwork,
              &info);
       AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("pgesvd", info));
@@ -2161,8 +2162,8 @@ ScaLAPACKMatrix<NumberType>::least_squares(ScaLAPACKMatrix<NumberType> &B,
   if (grid->mpi_process_is_active)
     {
       char        trans = transpose ? 'T' : 'N';
-      NumberType *A_loc = &this->values[0];
-      NumberType *B_loc = &B.values[0];
+      NumberType *A_loc = this->values.data();
+      NumberType *B_loc = B.values.data();
       int         info  = 0;
       /*
        * by setting lwork to -1 a workspace query for optimal length of work is
@@ -2183,7 +2184,7 @@ ScaLAPACKMatrix<NumberType>::least_squares(ScaLAPACKMatrix<NumberType> &B,
             &B.submatrix_row,
             &B.submatrix_column,
             B.descriptor,
-            &work[0],
+            work.data(),
             &lwork,
             &info);
       AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("pgels", info));
@@ -2203,7 +2204,7 @@ ScaLAPACKMatrix<NumberType>::least_squares(ScaLAPACKMatrix<NumberType> &B,
             &B.submatrix_row,
             &B.submatrix_column,
             B.descriptor,
-            &work[0],
+            work.data(),
             &lwork,
             &info);
       AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("pgels", info));
@@ -2317,7 +2318,7 @@ ScaLAPACKMatrix<NumberType>::reciprocal_condition_number(
       iwork.resize(liwork);
 
       int               info  = 0;
-      const NumberType *A_loc = &this->values[0];
+      const NumberType *A_loc = this->values.data();
 
       // by setting lwork to -1 a workspace query for optimal length of work is
       // performed
@@ -2331,9 +2332,9 @@ ScaLAPACKMatrix<NumberType>::reciprocal_condition_number(
              descriptor,
              &a_norm,
              &rcond,
-             &work[0],
+             work.data(),
              &lwork,
-             &iwork[0],
+             iwork.data(),
              &liwork,
              &info);
       AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("pdpocon", info));
@@ -2349,9 +2350,9 @@ ScaLAPACKMatrix<NumberType>::reciprocal_condition_number(
              descriptor,
              &a_norm,
              &rcond,
-             &work[0],
+             work.data(),
              &lwork,
-             &iwork[0],
+             iwork.data(),
              &liwork,
              &info);
       AssertThrow(info == 0, LAPACKSupport::ExcErrorCode("pdpocon", info));
@@ -2696,7 +2697,7 @@ ScaLAPACKMatrix<NumberType>::save_serial(
       hid_t dataspace_id = H5Screate_simple(2, dims, nullptr);
 
       // create the dataset within the file using chunk creation properties
-      hid_t type_id    = hdf5_type_id(&tmp.values[0]);
+      hid_t type_id    = hdf5_type_id(tmp.values.data());
       hid_t dataset_id = H5Dcreate2(file_id,
                                     "/matrix",
                                     type_id,
@@ -2707,7 +2708,7 @@ ScaLAPACKMatrix<NumberType>::save_serial(
 
       // write the dataset
       status = H5Dwrite(
-        dataset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp.values[0]);
+        dataset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp.values.data());
       AssertThrow(status >= 0, ExcIO());
 
       // create HDF5 enum type for LAPACKSupport::State and
@@ -2842,7 +2843,7 @@ ScaLAPACKMatrix<NumberType>::save_parallel(
   copy_to(tmp);
 
   // get pointer to data held by the process
-  NumberType *data = (tmp.values.size() > 0) ? &tmp.values[0] : nullptr;
+  NumberType *data = (tmp.values.size() > 0) ? tmp.values.data() : nullptr;
 
   herr_t status;
   // dataset dimensions
@@ -3095,7 +3096,7 @@ ScaLAPACKMatrix<NumberType>::load_serial(const std::string &filename)
       // Selection
       hid_t       datatype   = H5Dget_type(dataset_id);
       H5T_class_t t_class_in = H5Tget_class(datatype);
-      H5T_class_t t_class    = H5Tget_class(hdf5_type_id(&tmp.values[0]));
+      H5T_class_t t_class    = H5Tget_class(hdf5_type_id(tmp.values.data()));
       AssertThrow(
         t_class_in == t_class,
         ExcMessage(
@@ -3120,11 +3121,11 @@ ScaLAPACKMatrix<NumberType>::load_serial(const std::string &filename)
 
       // read data
       status = H5Dread(dataset_id,
-                       hdf5_type_id(&tmp.values[0]),
+                       hdf5_type_id(tmp.values.data()),
                        H5S_ALL,
                        H5S_ALL,
                        H5P_DEFAULT,
-                       &tmp.values[0]);
+                       tmp.values.data());
       AssertThrow(status >= 0, ExcIO());
 
       // create HDF5 enum type for LAPACKSupport::State and
@@ -3264,7 +3265,7 @@ ScaLAPACKMatrix<NumberType>::load_parallel(const std::string &filename)
   ScaLAPACKMatrix<NumberType> tmp(n_rows, n_columns, column_grid, MB, NB);
 
   // get pointer to data held by the process
-  NumberType *data = (tmp.values.size() > 0) ? &tmp.values[0] : nullptr;
+  NumberType *data = (tmp.values.size() > 0) ? tmp.values.data() : nullptr;
 
   herr_t status;
 
index 164231fc5922d795040333e4cab942fcaa4467ce..e6698f28aa2cadc18ac9f8884143d4b7327b64fc 100644 (file)
@@ -994,7 +994,7 @@ namespace SparsityTools
       unsigned int idx = 0;
       for (const auto &sparsity_line : send_data)
         {
-          const int ierr = MPI_Isend(&(sparsity_line.second[0]),
+          const int ierr = MPI_Isend(sparsity_line.second.data(),
                                      sparsity_line.second.size(),
                                      DEAL_II_DOF_INDEX_MPI_TYPE,
                                      sparsity_line.first,
@@ -1138,7 +1138,7 @@ namespace SparsityTools
       unsigned int idx = 0;
       for (const auto &sparsity_line : send_data)
         {
-          const int ierr = MPI_Isend(&(sparsity_line.second[0]),
+          const int ierr = MPI_Isend(sparsity_line.second.data(),
                                      sparsity_line.second.size(),
                                      DEAL_II_DOF_INDEX_MPI_TYPE,
                                      sparsity_line.first,
index acad71da8cf99652930441b769a0a0a562cde453..291929c5c359c52d35ef95bf140999a4fe6eb75c 100644 (file)
@@ -146,9 +146,9 @@ namespace TrilinosWrappers
         this->a_row,
         colnums,
         ncols,
-        &((*value_cache)[0]),
+        value_cache->data(),
         reinterpret_cast<TrilinosWrappers::types::int_type *>(
-          &((*colnum_cache)[0])));
+          colnum_cache->data()));
       value_cache->resize(ncols);
       colnum_cache->resize(ncols);
       AssertThrow(ierr == 0, ExcTrilinosError(ierr));
@@ -207,7 +207,7 @@ namespace TrilinosWrappers
                                     *column_space_map,
                                     reinterpret_cast<int *>(
                                       const_cast<unsigned int *>(
-                                        &(n_entries_per_row[0]))),
+                                        n_entries_per_row.data())),
                                     false))
     , last_action(Zero)
     , compressed(false)
@@ -238,7 +238,7 @@ namespace TrilinosWrappers
                                     input_row_map,
                                     reinterpret_cast<int *>(
                                       const_cast<unsigned int *>(
-                                        &(n_entries_per_row[0]))),
+                                        n_entries_per_row.data())),
                                     false))
     , last_action(Zero)
     , compressed(false)
@@ -291,7 +291,7 @@ namespace TrilinosWrappers
                    Utilities::Trilinos::comm_self()),
         *column_space_map,
         reinterpret_cast<int *>(
-          const_cast<unsigned int *>(&(n_entries_per_row[0]))),
+          const_cast<unsigned int *>(n_entries_per_row.data())),
         false))
     , last_action(Zero)
     , compressed(false)
@@ -323,7 +323,7 @@ namespace TrilinosWrappers
                                     *column_space_map,
                                     reinterpret_cast<int *>(
                                       const_cast<unsigned int *>(
-                                        &(n_entries_per_row[0]))),
+                                        n_entries_per_row.data())),
                                     false))
     , last_action(Zero)
     , compressed(false)
@@ -358,7 +358,7 @@ namespace TrilinosWrappers
         Copy,
         row_parallel_partitioning.make_trilinos_map(communicator, false),
         reinterpret_cast<int *>(
-          const_cast<unsigned int *>(&(n_entries_per_row[0]))),
+          const_cast<unsigned int *>(n_entries_per_row.data())),
         false))
     , last_action(Zero)
     , compressed(false)
index 454c0ca394f25832ace1a74d1f6440537fde73d1..33887b18c5512786ca06b27dbb9deb494fff634a 100644 (file)
@@ -60,7 +60,7 @@ namespace TrilinosWrappers
             colnum_cache->size(),
             ncols,
             reinterpret_cast<TrilinosWrappers::types::int_type *>(
-              const_cast<size_type *>(&(*colnum_cache)[0])));
+              const_cast<size_type *>(colnum_cache->data())));
           AssertThrow(ierr == 0, ExcTrilinosError(ierr));
           AssertThrow(static_cast<std::vector<size_type>::size_type>(ncols) ==
                         colnum_cache->size(),
index 6bd39c8cc111dc19a5580f7507af77696765016c..87e2bfdeab57616af78a5b0b0d9ee19675d81296 100644 (file)
@@ -500,7 +500,7 @@ MGTransferMatrixFree<dim, Number>::do_restrict_add(
                                [(cell / vec_size) * three_to_dim],
             n_components,
             fe_degree,
-            &evaluation_data[0]);
+            evaluation_data.data());
           for (unsigned int c = 0; c < n_components; ++c)
             internal::FEEvaluationImplBasisChange<internal::evaluate_general,
                                                   dim,
index 0786356d96d55f31060ac5862be188a19233b3b5..5a05e5ca21bb534232b522d5be61a4987e0b23e5 100644 (file)
@@ -577,8 +577,8 @@ DataOut<dim, DoFHandlerType>::build_patches(
   // now build the patches in parallel
   if (all_cells.size() > 0)
     WorkStream::run(
-      &all_cells[0],
-      &all_cells[0] + all_cells.size(),
+      all_cells.data(),
+      all_cells.data() + all_cells.size(),
       std::bind(&DataOut<dim, DoFHandlerType>::build_one_patch,
                 this,
                 std::placeholders::_1,
index 89d173bc782c318f9f0d2f0b8721f6b1ce6020e7..5e5b013657e3861021d271c949f93dc322a3476b 100644 (file)
@@ -396,8 +396,8 @@ DataOutFaces<dim, DoFHandlerType>::build_patches(
     n_datasets, Utilities::fixed_power<dimension - 1>(n_subdivisions + 1));
 
   // now build the patches in parallel
-  WorkStream::run(&all_faces[0],
-                  &all_faces[0] + all_faces.size(),
+  WorkStream::run(all_faces.data(),
+                  all_faces.data() + all_faces.size(),
                   std::bind(&DataOutFaces<dim, DoFHandlerType>::build_one_patch,
                             this,
                             std::placeholders::_1,
index 41a3f78d0c8d81c65925709e3e8bfaad3178e278..3704e214c56ac0f62df5c2a49d98163cc4810705 100644 (file)
@@ -533,8 +533,8 @@ DataOutRotation<dim, DoFHandlerType>::build_patches(
 
   // now build the patches in parallel
   WorkStream::run(
-    &all_cells[0],
-    &all_cells[0] + all_cells.size(),
+    all_cells.data(),
+    all_cells.data() + all_cells.size(),
     std::bind(&DataOutRotation<dim, DoFHandlerType>::build_one_patch,
               this,
               std::placeholders::_1,
index 4f96a9d281147e62d19a00ca9cbe1dbfac3b5e70..27e41afe0ee69202bfe32cd06908e8202cf9c4e6 100644 (file)
@@ -48,7 +48,7 @@ KDTree<dim>::get_points_within_ball(const Point<dim> &center,
   params.sorted = sorted;
 
   std::vector<std::pair<unsigned int, double>> matches;
-  kdtree->radiusSearch(&center[0], radius, matches, params);
+  kdtree->radiusSearch(center.begin_raw(), radius, matches, params);
 
   return matches;
 }
@@ -67,7 +67,10 @@ KDTree<dim>::get_closest_points(const Point<dim> & target,
   std::vector<unsigned int> indices(n_points);
   std::vector<double>       distances(n_points);
 
-  kdtree->knnSearch(&target[0], n_points, &indices[0], &distances[0]);
+  kdtree->knnSearch(target.begin_raw(),
+                    n_points,
+                    indices.data(),
+                    distances.data());
 
   // convert it to the format we want to return
   std::vector<std::pair<unsigned int, double>> matches(n_points);
index 3d07cbb5f760a8ba01d66a2238ace872be65ff3d..34df0fb9ced37b4a7fe42ca3135f065752ef8b1f 100644 (file)
@@ -904,7 +904,7 @@ namespace Particles
           AssertThrowMPI(ierr);
         }
       const int ierr =
-        MPI_Waitall(2 * n_neighbors, &n_requests[0], MPI_STATUSES_IGNORE);
+        MPI_Waitall(2 * n_neighbors, n_requests.data(), MPI_STATUSES_IGNORE);
       AssertThrowMPI(ierr);
     }
 
@@ -953,7 +953,7 @@ namespace Particles
             recv_ops++;
           }
       const int ierr =
-        MPI_Waitall(send_ops + recv_ops, &requests[0], MPI_STATUSES_IGNORE);
+        MPI_Waitall(send_ops + recv_ops, requests.data(), MPI_STATUSES_IGNORE);
       AssertThrowMPI(ierr);
     }
 

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.