]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer v.data() to &v[0].
authorDavid Wells <wellsd2@rpi.edu>
Sat, 7 Oct 2017 00:42:55 +0000 (20:42 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 12 Oct 2017 19:57:46 +0000 (15:57 -0400)
53 files changed:
include/deal.II/base/array_view.h
include/deal.II/distributed/grid_tools.h
include/deal.II/fe/fe_tools_extrapolate.templates.h
include/deal.II/lac/arpack_solver.h
include/deal.II/lac/block_matrix_base.h
include/deal.II/lac/block_vector_base.h
include/deal.II/lac/chunk_sparse_matrix.templates.h
include/deal.II/lac/full_matrix.templates.h
include/deal.II/lac/la_parallel_vector.templates.h
include/deal.II/lac/matrix_block.h
include/deal.II/lac/parpack_solver.h
include/deal.II/lac/petsc_matrix_base.h
include/deal.II/lac/read_write_vector.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/lac/slepc_solver.h
include/deal.II/lac/sparse_matrix.h
include/deal.II/lac/sparse_matrix.templates.h
include/deal.II/lac/sparse_matrix_ez.templates.h
include/deal.II/lac/trilinos_sparse_matrix.h
include/deal.II/lac/trilinos_vector.h
include/deal.II/lac/utilities.h
include/deal.II/lac/vector_operations_internal.h
include/deal.II/matrix_free/cuda_matrix_free.templates.cuh
include/deal.II/matrix_free/matrix_free.h
source/base/data_out_base.cc
source/base/function_cspline.cc
source/base/index_set.cc
source/base/mpi.cc
source/base/partitioner.cc
source/base/polynomial.cc
source/base/polynomials_piecewise.cc
source/distributed/tria.cc
source/distributed/tria_base.cc
source/dofs/dof_handler_policy.cc
source/dofs/dof_renumbering.cc
source/dofs/dof_tools.cc
source/fe/fe_abf.cc
source/grid/grid_tools.cc
source/grid/manifold.cc
source/lac/lapack_full_matrix.cc
source/lac/petsc_matrix_base.cc
source/lac/petsc_parallel_sparse_matrix.cc
source/lac/petsc_sparse_matrix.cc
source/lac/petsc_vector_base.cc
source/lac/sparse_direct.cc
source/lac/sparsity_tools.cc
source/lac/trilinos_precondition_ml.cc
source/lac/trilinos_precondition_muelu.cc
source/lac/trilinos_sparse_matrix.cc
source/lac/trilinos_sparsity_pattern.cc
source/lac/trilinos_vector.cc
source/multigrid/mg_transfer_internal.cc
source/multigrid/mg_transfer_prebuilt.cc

index 7086d56d3398b7e0b0a6638cfd68fb416562acc8..dbeb9569b659485476afd3e0dd5d965c8d3375d5 100644 (file)
@@ -431,7 +431,7 @@ inline
 ArrayView<ElementType>
 make_array_view (std::vector<ElementType> &vector)
 {
-  return ArrayView<ElementType> (&vector[0], vector.size());
+  return ArrayView<ElementType> (vector.data(), vector.size());
 }
 
 
@@ -455,7 +455,7 @@ inline
 ArrayView<const ElementType>
 make_array_view (const std::vector<ElementType> &vector)
 {
-  return ArrayView<const ElementType> (&vector[0], vector.size());
+  return ArrayView<const ElementType> (vector.data(), vector.size());
 }
 
 
index 769dae436a52fcf41151997e5192b07a62773b31..5e3a0203e3ca4409b779d93900a2b2c390b53beb 100644 (file)
@@ -243,7 +243,7 @@ namespace parallel
             decompressing_stream.push(boost::iostreams::gzip_decompressor());
             decompressing_stream.push(boost::iostreams::back_inserter(decompressed_buffer));
 
-            decompressing_stream.write (&buffer[0], buffer.size());
+            decompressing_stream.write (buffer.data(), buffer.size());
           }
 
           // then restore the object from the buffer
@@ -372,7 +372,7 @@ namespace parallel
 
           receive.resize(len);
 
-          char *ptr = &receive[0];
+          char *ptr = receive.data();
           ierr = MPI_Recv(ptr, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
                           tria->get_communicator(), &status);
           AssertThrowMPI(ierr);
@@ -397,7 +397,7 @@ namespace parallel
       // when we leave this function.
       if (requests.size())
         {
-          const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+          const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
           AssertThrowMPI(ierr);
         }
 #endif // DEAL_II_WITH_MPI
index d788c7421d689d5b9189c12e35acaaa59c19d998..5ccfb7573876b5843b31dd5f34ec4b29c46b12f5 100644 (file)
@@ -144,7 +144,7 @@ namespace FETools
         {
           buffer.resize(bytes_for_buffer());
 
-          char *ptr = &buffer[0];
+          char *ptr = buffer.data();
 
           unsigned int n_dofs = dof_values.size ();
           std::memcpy(ptr, &n_dofs, sizeof(unsigned int));
@@ -159,13 +159,13 @@ namespace FETools
           std::memcpy(ptr,&quadrant,sizeof(typename dealii::internal::p4est::types<dim>::quadrant));
           ptr += sizeof(typename dealii::internal::p4est::types<dim>::quadrant);
 
-          Assert (ptr == &buffer[0]+buffer.size(),
+          Assert (ptr == buffer.data()+buffer.size(),
                   ExcInternalError());
         }
 
         void unpack_data (const std::vector<char> &buffer)
         {
-          const char *ptr = &buffer[0];
+          const char *ptr = buffer.data();
           unsigned int n_dofs;
           memcpy(&n_dofs, ptr, sizeof(unsigned int));
           ptr += sizeof(unsigned int);
@@ -180,7 +180,7 @@ namespace FETools
           std::memcpy(&quadrant,ptr,sizeof(typename dealii::internal::p4est::types<dim>::quadrant));
           ptr += sizeof(typename dealii::internal::p4est::types<dim>::quadrant);
 
-          Assert (ptr == &buffer[0]+buffer.size(),
+          Assert (ptr == buffer.data()+buffer.size(),
                   ExcInternalError());
         }
       };
@@ -1100,7 +1100,7 @@ namespace FETools
           AssertThrowMPI(ierr);
           receive.resize (len);
 
-          char *buf = &receive[0];
+          char *buf = receive.data();
           ierr = MPI_Recv (buf, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG, communicator, &status);
           AssertThrowMPI(ierr);
 
@@ -1116,7 +1116,7 @@ namespace FETools
 
       if (requests.size () > 0)
         {
-          const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+          const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
           AssertThrowMPI(ierr);
         }
 
index 6bf57a35836816cf8c36f89c37b45af886fba47b..a1409565b4263f4a4ccca95e07def169a67a4ce6 100644 (file)
@@ -550,12 +550,12 @@ void ArpackSolver::solve (const MatrixType1                  &/*system_matrix*/,
       // call of ARPACK dsaupd/dnaupd routine
       if (additional_data.symmetric)
         dsaupd_(&ido, bmat, &n, which, &nev, &tol,
-                &resid[0], &ncv, &v[0], &ldv, &iparam[0], &ipntr[0],
-                &workd[0], &workl[0], &lworkl, &info);
+                resid.data(), &ncv, v.data(), &ldv, iparam.data(), ipntr.data(),
+                workd.data(), workl.data(), &lworkl, &info);
       else
         dnaupd_(&ido, bmat, &n, which, &nev, &tol,
-                &resid[0], &ncv, &v[0], &ldv, &iparam[0], &ipntr[0],
-                &workd[0], &workl[0], &lworkl, &info);
+                resid.data(), &ncv, v.data(), &ldv, iparam.data(), ipntr.data(),
+                workd.data(), workl.data(), &lworkl, &info);
 
       if (ido == 99)
         break;
@@ -671,19 +671,19 @@ void ArpackSolver::solve (const MatrixType1                  &/*system_matrix*/,
       if (additional_data.symmetric)
         {
           std::vector<double> z (ldz*nev, 0.);
-          dseupd_(&rvec, &howmany, &select[0], &eigenvalues_real[0],
-                  &z[0], &ldz, &sigmar, bmat, &n, which, &nev, &tol,
-                  &resid[0], &ncv, &v[0], &ldv,
-                  &iparam[0], &ipntr[0], &workd[0], &workl[0], &lworkl, &info);
+          dseupd_(&rvec, &howmany, select.data(), eigenvalues_real.data(),
+                  z.data(), &ldz, &sigmar, bmat, &n, which, &nev, &tol,
+                  resid.data(), &ncv, v.data(), &ldv,
+                  iparam.data(), ipntr.data(), workd.data(), workl.data(), &lworkl, &info);
         }
       else
         {
           std::vector<double> workev (3*ncv, 0.);
-          dneupd_(&rvec, &howmany, &select[0], &eigenvalues_real[0],
-                  &eigenvalues_im[0], &v[0], &ldz, &sigmar, &sigmai,
-                  &workev[0], bmat, &n, which, &nev, &tol,
-                  &resid[0], &ncv, &v[0], &ldv,
-                  &iparam[0], &ipntr[0], &workd[0], &workl[0], &lworkl, &info);
+          dneupd_(&rvec, &howmany, select.data(), eigenvalues_real.data(),
+                  eigenvalues_im.data(), v.data(), &ldz, &sigmar, &sigmai,
+                  workev.data(), bmat, &n, which, &nev, &tol,
+                  resid.data(), &ncv, v.data(), &ldv,
+                  iparam.data(), ipntr.data(), workd.data(), workl.data(), &lworkl, &info);
         }
 
       if (info == 1)
index fe42bb20a459e7bf822aad3f5112d51613678c9f..80fb3ffc0f9eb10a9c01b1ca95f72913853476d4 100644 (file)
@@ -1668,7 +1668,7 @@ BlockMatrixBase<MatrixType>::set (const std::vector<size_type> &row_indices,
           ExcDimensionMismatch(col_indices.size(), values.n()));
 
   for (size_type i=0; i<row_indices.size(); ++i)
-    set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+    set (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1687,7 +1687,7 @@ BlockMatrixBase<MatrixType>::set (const std::vector<size_type> &indices,
   Assert (values.n() == values.m(), ExcNotQuadratic());
 
   for (size_type i=0; i<indices.size(); ++i)
-    set (indices[i], indices.size(), &indices[0], &values(i,0),
+    set (indices[i], indices.size(), indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1705,7 +1705,7 @@ BlockMatrixBase<MatrixType>::set (const size_type               row,
   Assert (col_indices.size() == values.size(),
           ExcDimensionMismatch(col_indices.size(), values.size()));
 
-  set (row, col_indices.size(), &col_indices[0], &values[0],
+  set (row, col_indices.size(), col_indices.data(), values.data(),
        elide_zero_values);
 }
 
@@ -1865,7 +1865,7 @@ BlockMatrixBase<MatrixType>::add (const std::vector<size_type> &row_indices,
           ExcDimensionMismatch(col_indices.size(), values.n()));
 
   for (size_type i=0; i<row_indices.size(); ++i)
-    add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+    add (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1884,7 +1884,7 @@ BlockMatrixBase<MatrixType>::add (const std::vector<size_type> &indices,
   Assert (values.n() == values.m(), ExcNotQuadratic());
 
   for (size_type i=0; i<indices.size(); ++i)
-    add (indices[i], indices.size(), &indices[0], &values(i,0),
+    add (indices[i], indices.size(), indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1902,7 +1902,7 @@ BlockMatrixBase<MatrixType>::add (const size_type               row,
   Assert (col_indices.size() == values.size(),
           ExcDimensionMismatch(col_indices.size(), values.size()));
 
-  add (row, col_indices.size(), &col_indices[0], &values[0],
+  add (row, col_indices.size(), col_indices.data(), values.data(),
        elide_zero_values);
 }
 
index 744996373c16a0f960d514b3fec04c10bac61671..331fbfb2f23c6ad2a7960eb7301af3c2db559340 100644 (file)
@@ -1797,7 +1797,7 @@ BlockVectorBase<VectorType>::add (const std::vector<size_type> &indices,
 {
   Assert (indices.size() == values.size(),
           ExcDimensionMismatch(indices.size(), values.size()));
-  add (indices.size(), &indices[0], &values[0]);
+  add (indices.size(), indices.data(), values.data());
 }
 
 
index 30269cae4f70c09f9315e3feb3dfa0feed01f67c..18c83e1754eff4830febe24c0ba765be9ac1f86d 100644 (file)
@@ -271,9 +271,9 @@ namespace internal
               val_ptr += chunk_size * chunk_size;
             }
         }
-      Assert(std::size_t(colnum_ptr-&colnums[0]) == rowstart[end_row],
+      Assert(std::size_t(colnum_ptr-colnums) == rowstart[end_row],
              ExcInternalError());
-      Assert(std::size_t(val_ptr-&values[0]) ==
+      Assert(std::size_t(val_ptr - values) ==
              rowstart[end_row] * chunk_size * chunk_size,
              ExcInternalError());
     }
@@ -411,7 +411,7 @@ ChunkSparseMatrix<number>::operator = (const double d)
                                             val.get()),
                                   grain_size);
   else if (matrix_size > 0)
-    std::memset (&val[0], 0, matrix_size*sizeof(number));
+    std::memset (val.get(), 0, matrix_size*sizeof(number));
 
   return *this;
 }
@@ -512,9 +512,9 @@ ChunkSparseMatrix<number>::n_actually_nonzero_elements () const
   // around the matrix. since we have the invariant that padding elements are
   // zero, nothing bad can happen here
   const size_type chunk_size = cols->get_chunk_size();
-  return std::count_if(&val[0],
-                       &val[cols->sparsity_pattern.n_nonzero_elements () *
-                            chunk_size * chunk_size],
+  return std::count_if(val.get(),
+                       val.get() + cols->sparsity_pattern.n_nonzero_elements ()
+                       * chunk_size * chunk_size,
                        std::bind(std::not_equal_to<double>(), std::placeholders::_1, 0));
 }
 
@@ -543,10 +543,10 @@ ChunkSparseMatrix<number>::copy_from (const ChunkSparseMatrix<somenumber> &matri
 
   // copy everything, including padding elements
   const size_type chunk_size = cols->get_chunk_size();
-  std::copy (&matrix.val[0],
-             &matrix.val[cols->sparsity_pattern.n_nonzero_elements()
-                         * chunk_size * chunk_size],
-             &val[0]);
+  std::copy (matrix.val.get(),
+             matrix.val.get() + cols->sparsity_pattern.n_nonzero_elements()
+             * chunk_size * chunk_size,
+             val.get());
 
   return *this;
 }
@@ -582,10 +582,10 @@ ChunkSparseMatrix<number>::add (const number factor,
 
   // add everything, including padding elements
   const size_type     chunk_size = cols->get_chunk_size();
-  number             *val_ptr    = &val[0];
+  number             *val_ptr    = val.get();
   const somenumber   *matrix_ptr = &matrix.val[0];
-  const number *const end_ptr    = &val[cols->sparsity_pattern.n_nonzero_elements()
-                                        * chunk_size * chunk_size];
+  const number *const end_ptr    = val.get() + cols->sparsity_pattern.n_nonzero_elements()
+                                   * chunk_size * chunk_size;
 
   while (val_ptr != end_ptr)
     *val_ptr++ += factor **matrix_ptr++;
@@ -1110,7 +1110,7 @@ ChunkSparseMatrix<number>::frobenius_norm () const
   //
   // padding elements are zero, so we can add them up as well
   real_type norm_sqr = 0;
-  for (const number *ptr = &val[0]; ptr != &val[max_len]; ++ptr)
+  for (const number *ptr = val.get(); ptr != val.get() + max_len; ++ptr)
     norm_sqr +=  numbers::NumberTraits<number>::abs_square(*ptr);
 
   return std::sqrt (norm_sqr);
index a12020cf4b7e83ddbe2616365f6ad3d438ca45e4..38ec19d0561b52d0784bfa051919c3211a118238 100644 (file)
@@ -1794,7 +1794,7 @@ FullMatrix<number>::gauss_jordan ()
 
         // Use the LAPACK function getrf for
         // calculating the LU factorization.
-        getrf(&nn, &nn, &this->values[0], &nn, &ipiv[0], &info);
+        getrf(&nn, &nn, &this->values[0], &nn, ipiv.data(), &info);
 
         Assert(info >= 0, ExcInternalError());
         Assert(info == 0, LACExceptions::ExcSingular());
@@ -1805,7 +1805,7 @@ 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[0], &inv_work[0], &nn, &info);
+        getri(&nn, &this->values[0], &nn, ipiv.data(), inv_work.data(), &nn, &info);
 
         Assert(info >= 0, ExcInternalError());
         Assert(info == 0, LACExceptions::ExcSingular());
index c98916c8d80c3212c201510c4923364ec2188161..3128f13299ccd77780239010116e71b22f28fe02 100644 (file)
@@ -656,7 +656,7 @@ namespace LinearAlgebra
       // first wait for the receive to complete
       if (compress_requests.size() > 0 && n_import_targets > 0)
         {
-          const int ierr = MPI_Waitall (n_import_targets, &compress_requests[0],
+          const int ierr = MPI_Waitall (n_import_targets, compress_requests.data(),
                                         MPI_STATUSES_IGNORE);
           AssertThrowMPI(ierr);
 
@@ -814,7 +814,7 @@ namespace LinearAlgebra
           Threads::Mutex::ScopedLock lock (mutex);
 
           const int ierr = MPI_Waitall (update_ghost_values_requests.size(),
-                                        &update_ghost_values_requests[0],
+                                        update_ghost_values_requests.data(),
                                         MPI_STATUSES_IGNORE);
           AssertThrowMPI (ierr);
         }
@@ -893,7 +893,7 @@ namespace LinearAlgebra
           if (update_ghost_values_requests.size()>0)
             {
               const int ierr = MPI_Testall (update_ghost_values_requests.size(),
-                                            &update_ghost_values_requests[0],
+                                            update_ghost_values_requests.data(),
                                             &flag, MPI_STATUSES_IGNORE);
               AssertThrowMPI (ierr);
               Assert (flag == 1,
@@ -902,7 +902,7 @@ namespace LinearAlgebra
             }
           if (compress_requests.size()>0)
             {
-              const int ierr = MPI_Testall (compress_requests.size(), &compress_requests[0],
+              const int ierr = MPI_Testall (compress_requests.size(), compress_requests.data(),
                                             &flag, MPI_STATUSES_IGNORE);
               AssertThrowMPI (ierr);
               Assert (flag == 1,
index 96da584c15b12ed8d5013efb4723df48add83b42..5a391688510816d09104f2b0c3a5137b7b627036 100644 (file)
@@ -682,7 +682,7 @@ MatrixBlock<MatrixType>::add (const std::vector<size_type> &r_indices,
   AssertDimension (c_indices.size(), values.n());
 
   for (size_type i=0; i<row_indices.size(); ++i)
-    add (r_indices[i], c_indices.size(), &c_indices[0], &values(i,0),
+    add (r_indices[i], c_indices.size(), c_indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -742,7 +742,7 @@ MatrixBlock<MatrixType>::add (const std::vector<size_type> &indices,
   Assert (values.n() == values.m(), ExcNotQuadratic());
 
   for (size_type i=0; i<indices.size(); ++i)
-    add (indices[i], indices.size(), &indices[0], &values(i,0),
+    add (indices[i], indices.size(), indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -761,7 +761,7 @@ MatrixBlock<MatrixType>::add (const size_type               row,
   Assert(column_indices.size() != 0, ExcNotInitialized());
 
   AssertDimension (col_indices.size(), values.size());
-  add (row, col_indices.size(), &col_indices[0], &values[0],
+  add (row, col_indices.size(), col_indices.data(), values.data(),
        elide_zero_values);
 }
 
index 2cb2bbc65285167dfc903453595906a8ea70fd8c..019baf364e966a87fe5ad1e69948f40f70f1fcf6 100644 (file)
@@ -636,7 +636,7 @@ set_initial_vector(const VectorType &vec)
           ExcDimensionMismatch(resid.size(),local_indices.size()));
   vec.extract_subvector_to (local_indices.begin(),
                             local_indices.end(),
-                            &resid[0]);
+                            resid.data());
 }
 
 
@@ -876,12 +876,12 @@ void PArpackSolver<VectorType>::solve
       // call of ARPACK pdnaupd routine
       if (additional_data.symmetric)
         pdsaupd_(&mpi_communicator_fortran,&ido, bmat, &n_inside_arpack, which, &nev, &tol,
-                 &resid[0], &ncv, &v[0], &ldv, &iparam[0], &ipntr[0],
-                 &workd[0], &workl[0], &lworkl, &info);
+                 resid.data(), &ncv, v.data(), &ldv, iparam.data(), ipntr.data(),
+                 workd.data(), workl.data(), &lworkl, &info);
       else
         pdnaupd_(&mpi_communicator_fortran,&ido, bmat, &n_inside_arpack, which, &nev, &tol,
-                 &resid[0], &ncv, &v[0], &ldv, &iparam[0], &ipntr[0],
-                 &workd[0], &workl[0], &lworkl, &info);
+                 resid.data(), &ncv, v.data(), &ldv, iparam.data(), ipntr.data(),
+                 workd.data(), workl.data(), &lworkl, &info);
 
       AssertThrow (info == 0, PArpackExcInfoPdnaupd(info));
 
@@ -906,8 +906,8 @@ void PArpackSolver<VectorType>::solve
         // compute  Y = OP * X
         {
           src.add (nloc,
-                   &local_indices[0],
-                   &workd[0]+shift_x );
+                   local_indices.data(),
+                   workd.data()+shift_x );
           src.compress (VectorOperation::add);
 
           if (mode == 3)
@@ -923,7 +923,7 @@ void PArpackSolver<VectorType>::solve
               // store M*X in X
               tmp.extract_subvector_to (local_indices.begin(),
                                         local_indices.end(),
-                                        &workd[0]+shift_x);
+                                        workd.data()+shift_x);
               inverse.vmult(dst,tmp);
             }
           else if (mode == 1)
@@ -944,8 +944,8 @@ void PArpackSolver<VectorType>::solve
 
           // B*X
           src.add (nloc,
-                   &local_indices[0],
-                   &workd[0]+shift_b_x );
+                   local_indices.data(),
+                   workd.data()+shift_b_x );
           src.compress (VectorOperation::add);
 
           // solving linear system
@@ -956,8 +956,8 @@ void PArpackSolver<VectorType>::solve
         // compute  Y = B * X
         {
           src.add (nloc,
-                   &local_indices[0],
-                   &workd[0]+shift_x );
+                   local_indices.data(),
+                   workd.data()+shift_x );
           src.compress (VectorOperation::add);
 
           // Multiplication with mass matrix M
@@ -979,7 +979,7 @@ void PArpackSolver<VectorType>::solve
       // store the result
       dst.extract_subvector_to (local_indices.begin(),
                                 local_indices.end(),
-                                &workd[0]+shift_y);
+                                workd.data()+shift_y);
     } // end of pd*aupd_ loop
 
   // 1 - compute eigenvectors,
@@ -994,17 +994,17 @@ void PArpackSolver<VectorType>::solve
 
   // call of ARPACK pdneupd routine
   if (additional_data.symmetric)
-    pdseupd_(&mpi_communicator_fortran, &rvec, howmany, &select[0], &eigenvalues_real[0],
-             &z[0], &ldz, &sigmar,
+    pdseupd_(&mpi_communicator_fortran, &rvec, howmany, select.data(), eigenvalues_real.data(),
+             z.data(), &ldz, &sigmar,
              bmat, &n_inside_arpack, which, &nev, &tol,
-             &resid[0], &ncv, &v[0], &ldv,
-             &iparam[0], &ipntr[0], &workd[0], &workl[0], &lworkl, &info);
+             resid.data(), &ncv, v.data(), &ldv,
+             iparam.data(), ipntr.data(), workd.data(), workl.data(), &lworkl, &info);
   else
-    pdneupd_(&mpi_communicator_fortran, &rvec, howmany, &select[0], &eigenvalues_real[0],
-             &eigenvalues_im[0], &v[0], &ldz, &sigmar, &sigmai,
-             &workev[0], bmat, &n_inside_arpack, which, &nev, &tol,
-             &resid[0], &ncv, &v[0], &ldv,
-             &iparam[0], &ipntr[0], &workd[0], &workl[0], &lworkl, &info);
+    pdneupd_(&mpi_communicator_fortran, &rvec, howmany, select.data(), eigenvalues_real.data(),
+             eigenvalues_im.data(), v.data(), &ldz, &sigmar, &sigmai,
+             workev.data(), bmat, &n_inside_arpack, which, &nev, &tol,
+             resid.data(), &ncv, v.data(), &ldv,
+             iparam.data(), ipntr.data(), workd.data(), workl.data(), &lworkl, &info);
 
   if (info == 1)
     {
@@ -1025,7 +1025,7 @@ void PArpackSolver<VectorType>::solve
       Assert (i*nloc + nloc <= (int)v.size(), dealii::ExcInternalError() );
 
       eigenvectors[i]->add (nloc,
-                            &local_indices[0],
+                            local_indices.data(),
                             &v[i*nloc] );
       eigenvectors[i]->compress (VectorOperation::add);
     }
@@ -1046,8 +1046,8 @@ void PArpackSolver<VectorType>::solve
 
     tmp = 0.0;
     tmp.add (nloc,
-             &local_indices[0],
-             &resid[0]);
+             local_indices.data(),
+             resid.data());
     solver_control.check  ( iparam[2], tmp.l2_norm() );
   }
 
index 1a515ac24db25db1e41cdeb04d93c57858c8da64..c4a8c9e202fd39323f60c02cb94bce2ff35ebe10 100644 (file)
@@ -1156,7 +1156,7 @@ namespace PETScWrappers
     Assert (values.m() == values.n(), ExcNotQuadratic());
 
     for (size_type i=0; i<indices.size(); ++i)
-      set (indices[i], indices.size(), &indices[0], &values(i,0),
+      set (indices[i], indices.size(), indices.data(), &values(i,0),
            elide_zero_values);
   }
 
@@ -1175,7 +1175,7 @@ namespace PETScWrappers
             ExcDimensionMismatch(col_indices.size(), values.n()));
 
     for (size_type i=0; i<row_indices.size(); ++i)
-      set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+      set (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
            elide_zero_values);
   }
 
@@ -1191,7 +1191,7 @@ namespace PETScWrappers
     Assert (col_indices.size() == values.size(),
             ExcDimensionMismatch(col_indices.size(), values.size()));
 
-    set (row, col_indices.size(), &col_indices[0], &values[0],
+    set (row, col_indices.size(), col_indices.data(), values.data(),
          elide_zero_values);
   }
 
@@ -1244,8 +1244,8 @@ namespace PETScWrappers
           }
         Assert(n_columns <= (int)n_cols, ExcInternalError());
 
-        col_index_ptr = &column_indices[0];
-        col_value_ptr = &column_values[0];
+        col_index_ptr = column_indices.data();
+        col_value_ptr = column_values.data();
       }
 
     const PetscErrorCode ierr = MatSetValues (matrix, 1, &petsc_i, n_columns,
@@ -1292,7 +1292,7 @@ namespace PETScWrappers
     Assert (values.m() == values.n(), ExcNotQuadratic());
 
     for (size_type i=0; i<indices.size(); ++i)
-      add (indices[i], indices.size(), &indices[0], &values(i,0),
+      add (indices[i], indices.size(), indices.data(), &values(i,0),
            elide_zero_values);
   }
 
@@ -1311,7 +1311,7 @@ namespace PETScWrappers
             ExcDimensionMismatch(col_indices.size(), values.n()));
 
     for (size_type i=0; i<row_indices.size(); ++i)
-      add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+      add (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
            elide_zero_values);
   }
 
@@ -1327,7 +1327,7 @@ namespace PETScWrappers
     Assert (col_indices.size() == values.size(),
             ExcDimensionMismatch(col_indices.size(), values.size()));
 
-    add (row, col_indices.size(), &col_indices[0], &values[0],
+    add (row, col_indices.size(), col_indices.data(), values.data(),
          elide_zero_values);
   }
 
@@ -1383,8 +1383,8 @@ namespace PETScWrappers
           }
         Assert(n_columns <= (int)n_cols, ExcInternalError());
 
-        col_index_ptr = &column_indices[0];
-        col_value_ptr = &column_values[0];
+        col_index_ptr = column_indices.data();
+        col_value_ptr = column_values.data();
       }
 
     const PetscErrorCode ierr = MatSetValues (matrix, 1, &petsc_i, n_columns,
index 60feffc99b31df0be77939007e254fbc2ced9d28..91c165a4e5488661979dfd851339b4a04e34c823 100644 (file)
@@ -892,7 +892,7 @@ namespace LinearAlgebra
                                 const std::vector<Number2>   &values)
   {
     AssertDimension (indices.size(), values.size());
-    add (indices.size(), &indices[0], &values[0]);
+    add (indices.size(), indices.data(), values.data());
   }
 
 
index 80037c4139eb7ca3a03afb681fa9c01967a2ac0c..8fd8c25999e443cc655fa88feb41ca8a942c9cc3 100644 (file)
@@ -447,7 +447,7 @@ namespace LinearAlgebra
       {
         // Copy the vector from the device to a temporary vector on the host
         std::vector<Number> tmp(n_elements);
-        cudaError_t error_code = cudaMemcpy(&tmp[0], cuda_vec.get_values(),
+        cudaError_t error_code = cudaMemcpy(tmp.data(), cuda_vec.get_values(),
                                             n_elements*sizeof(Number),
                                             cudaMemcpyDeviceToHost);
         AssertCuda(error_code);
index e69b6f6eb1d20a098139f173bd92bda6a420c0a5..04707d046d9cbcde49f1dacc01a412a7ff732340 100644 (file)
@@ -803,7 +803,7 @@ namespace SLEPcWrappers
     // One could still build a vector that is rich in the directions of all guesses,
     // by taking a linear combination of them. (TODO: make function virtual?)
 
-    const PetscErrorCode ierr = EPSSetInitialSpace (eps, vecs.size(), &vecs[0]);
+    const PetscErrorCode ierr = EPSSetInitialSpace (eps, vecs.size(), vecs.data());
     AssertThrow (ierr == 0, ExcSLEPcError(ierr));
   }
 
index 313a1444e280dff90a376e3d798341e8b2ac57e4..0e764fa4e130717967e95bec49b954c9f9c9a5c1 100644 (file)
@@ -1692,7 +1692,7 @@ SparseMatrix<number>::set (const std::vector<size_type> &indices,
   Assert (values.m() == values.n(), ExcNotQuadratic());
 
   for (size_type i=0; i<indices.size(); ++i)
-    set (indices[i], indices.size(), &indices[0], &values(i,0),
+    set (indices[i], indices.size(), indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1713,7 +1713,7 @@ SparseMatrix<number>::set (const std::vector<size_type> &row_indices,
           ExcDimensionMismatch(col_indices.size(), values.n()));
 
   for (size_type i=0; i<row_indices.size(); ++i)
-    set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+    set (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1731,7 +1731,7 @@ SparseMatrix<number>::set (const size_type               row,
   Assert (col_indices.size() == values.size(),
           ExcDimensionMismatch(col_indices.size(), values.size()));
 
-  set (row, col_indices.size(), &col_indices[0], &values[0],
+  set (row, col_indices.size(), col_indices.data(), values.data(),
        elide_zero_values);
 }
 
@@ -1779,7 +1779,7 @@ SparseMatrix<number>::add (const std::vector<size_type> &indices,
   Assert (values.m() == values.n(), ExcNotQuadratic());
 
   for (size_type i=0; i<indices.size(); ++i)
-    add (indices[i], indices.size(), &indices[0], &values(i,0),
+    add (indices[i], indices.size(), indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1800,7 +1800,7 @@ SparseMatrix<number>::add (const std::vector<size_type> &row_indices,
           ExcDimensionMismatch(col_indices.size(), values.n()));
 
   for (size_type i=0; i<row_indices.size(); ++i)
-    add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+    add (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
          elide_zero_values);
 }
 
@@ -1818,7 +1818,7 @@ SparseMatrix<number>::add (const size_type               row,
   Assert (col_indices.size() == values.size(),
           ExcDimensionMismatch(col_indices.size(), values.size()));
 
-  add (row, col_indices.size(), &col_indices[0], &values[0],
+  add (row, col_indices.size(), col_indices.data(), values.data(),
        elide_zero_values);
 }
 
@@ -1832,8 +1832,8 @@ SparseMatrix<number>::operator *= (const number factor)
   Assert (cols != nullptr, ExcNotInitialized());
   Assert (val != nullptr, ExcNotInitialized());
 
-  number             *val_ptr    = &val[0];
-  const number *const end_ptr    = &val[cols->n_nonzero_elements()];
+  number             *val_ptr    = val.get();
+  const number *const end_ptr    = val.get() + cols->n_nonzero_elements();
 
   while (val_ptr != end_ptr)
     *val_ptr++ *= factor;
@@ -1854,8 +1854,8 @@ SparseMatrix<number>::operator /= (const number factor)
 
   const number factor_inv = number(1.) / factor;
 
-  number             *val_ptr    = &val[0];
-  const number *const end_ptr    = &val[cols->n_nonzero_elements()];
+  number             *val_ptr    = val.get();
+  const number *const end_ptr    = val.get() + cols->n_nonzero_elements();
 
   while (val_ptr != end_ptr)
     *val_ptr++ *= factor_inv;
index 917d69584c60e97628570ffb77a81aa90c0ba619..f3969d8d7dc769d00bea98ecf2065817ce098eb1 100644 (file)
@@ -205,7 +205,7 @@ SparseMatrix<number>::operator = (const double d)
                                             val.get()),
                                   grain_size);
   else if (matrix_size > 0)
-    std::memset (&val[0], 0, matrix_size*sizeof(number));
+    std::memset (val.get(), 0, matrix_size*sizeof(number));
 
   return *this;
 }
@@ -363,8 +363,8 @@ SparseMatrix<number>::copy_from (const SparseMatrix<somenumber> &matrix)
   Assert (val != nullptr, ExcNotInitialized());
   Assert (cols == matrix.cols, ExcDifferentSparsityPatterns());
 
-  std::copy (&matrix.val[0], &matrix.val[cols->n_nonzero_elements()],
-             &val[0]);
+  std::copy (matrix.val.get(), matrix.val.get() + cols->n_nonzero_elements(),
+             val.get());
 
   return *this;
 }
@@ -445,9 +445,9 @@ SparseMatrix<number>::add (const number factor,
   Assert (val != nullptr, ExcNotInitialized());
   Assert (cols == matrix.cols, ExcDifferentSparsityPatterns());
 
-  number             *val_ptr    = &val[0];
-  const somenumber   *matrix_ptr = &matrix.val[0];
-  const number *const end_ptr    = &val[cols->n_nonzero_elements()];
+  number             *val_ptr    = val.get();
+  const somenumber   *matrix_ptr = matrix.val.get();
+  const number *const end_ptr    = val.get() + cols->n_nonzero_elements();
 
   while (val_ptr != end_ptr)
     *val_ptr++ += factor * number(*matrix_ptr++);
@@ -1084,14 +1084,14 @@ SparseMatrix<number>::mmult (SparseMatrix<numberC>       &C,
           // now the innermost loop that goes over all the elements in row
           // 'col' of matrix B. Cache the elements, and then write them into C
           // at once
-          numberC *new_ptr = &new_entries[0];
+          numberC *new_ptr = new_entries.data();
           const numberB *B_val_ptr =
             &B.val[new_cols-&sp_B.colnums[sp_B.rowstart[0]]];
           const numberB *const end_cols = &B.val[sp_B.rowstart[col+1]];
           for (; B_val_ptr != end_cols; ++B_val_ptr)
             *new_ptr++ = numberC(A_val) * numberC(*B_val_ptr) * numberC(use_vector ? V(col) : 1);
 
-          C.add (i, new_ptr-&new_entries[0], new_cols, &new_entries[0],
+          C.add (i, new_ptr-new_entries.data(), new_cols, new_entries.data(),
                  false, true);
         }
     }
@@ -1215,13 +1215,13 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC>       &C,
           // now the innermost loop that goes over all the elements in row
           // 'col' of matrix B. Cache the elements, and then write them into C
           // at once
-          numberC *new_ptr = &new_entries[0];
+          numberC *new_ptr = new_entries.data();
           const numberB *B_val_ptr =
             &B.val[new_cols-&sp_B.colnums[sp_B.rowstart[0]]];
           for (; B_val_ptr != end_cols; ++B_val_ptr)
             *new_ptr++ = numberC(A_val) * numberC(*B_val_ptr) * numberC(use_vector ? V(i) : 1);
 
-          C.add (row, new_ptr-&new_entries[0], new_cols, &new_entries[0],
+          C.add (row, new_ptr-new_entries.data(), new_cols, new_entries.data(),
                  false, true);
         }
     }
@@ -1281,8 +1281,8 @@ SparseMatrix<number>::frobenius_norm () const
   // reference to rows or columns
   real_type norm_sqr = 0;
   const size_type n_rows = m();
-  for (const number *ptr = &val[0];
-       ptr != &val[cols->rowstart[n_rows]]; ++ptr)
+  for (const number *ptr = val.get();
+       ptr != val.get() + cols->rowstart[n_rows]; ++ptr)
     norm_sqr +=  numbers::NumberTraits<number>::abs_square(*ptr);
 
   return std::sqrt (norm_sqr);
@@ -1974,9 +1974,9 @@ SparseMatrix<number>::block_write (std::ostream &out) const
   // bracketed in [...]
   out << '[' << max_len << "][";
   // then write out real data
-  out.write (reinterpret_cast<const char *>(&val[0]),
-             reinterpret_cast<const char *>(&val[max_len])
-             - reinterpret_cast<const char *>(&val[0]));
+  out.write (reinterpret_cast<const char *>(val.get()),
+             reinterpret_cast<const char *>(val.get() +  max_len)
+             - reinterpret_cast<const char *>(val.get()));
   out << ']';
 
   AssertThrow (out, ExcIO());
@@ -2006,9 +2006,9 @@ SparseMatrix<number>::block_read (std::istream &in)
   val.reset (new number[max_len]);
 
   // then read data
-  in.read (reinterpret_cast<char *>(&val[0]),
-           reinterpret_cast<char *>(&val[max_len])
-           - reinterpret_cast<char *>(&val[0]));
+  in.read (reinterpret_cast<char *>(val.get()),
+           reinterpret_cast<char *>(val.get() + max_len)
+           - reinterpret_cast<char *>(val.get()));
   in >> c;
   AssertThrow (c == ']', ExcIO());
 }
index 6a6f3623bbb292cf51061a6582852e21fb02d103..92ea656afc9e5d19ce69a39147e6045f691e4abb 100644 (file)
@@ -599,13 +599,13 @@ SparseMatrixEZ<number>::block_read (std::istream &in)
   DEAL_II_CHECK_INPUT(in,'[',c);
 
   // then read data
-  in.read(reinterpret_cast<char *>(&row_info[0]),
+  in.read(reinterpret_cast<char *>(row_info.data()),
           sizeof(RowInfo) * row_info.size());
 
   DEAL_II_CHECK_INPUT(in,']',c);
   DEAL_II_CHECK_INPUT(in,'[',c);
 
-  in.read(reinterpret_cast<char *>(&data[0]),
+  in.read(reinterpret_cast<char *>(data.data()),
           sizeof(Entry) * data.size());
 
   DEAL_II_CHECK_INPUT(in,']',c);
index 263d3feab2bbdc3c313b677c15f4c09486dd6a90..3e79ca4a02163afc77ed34a287fd8f13f573cc91 100644 (file)
@@ -2962,7 +2962,7 @@ namespace TrilinosWrappers
     Assert (values.m() == values.n(), ExcNotQuadratic());
 
     for (size_type i=0; i<indices.size(); ++i)
-      set (indices[i], indices.size(), &indices[0], &values(i,0),
+      set (indices[i], indices.size(), indices.data(), &values(i,0),
            elide_zero_values);
   }
 
index 521b2a469b8093709e8c13f5af3e6fba522cfc98..1b1e12fa30e25f486c353a128927f1bef171ecd8 100644 (file)
@@ -1519,7 +1519,7 @@ namespace TrilinosWrappers
       Assert (indices.size() == values.size(),
               ExcDimensionMismatch(indices.size(),values.size()));
 
-      set (indices.size(), &indices[0], &values[0]);
+      set (indices.size(), indices.data(), values.data());
     }
 
 
@@ -1536,7 +1536,7 @@ namespace TrilinosWrappers
       Assert (indices.size() == values.size(),
               ExcDimensionMismatch(indices.size(),values.size()));
 
-      set (indices.size(), &indices[0], values.begin());
+      set (indices.size(), indices.data(), values.begin());
     }
 
 
@@ -1595,7 +1595,7 @@ namespace TrilinosWrappers
       Assert (indices.size() == values.size(),
               ExcDimensionMismatch(indices.size(),values.size()));
 
-      add (indices.size(), &indices[0], &values[0]);
+      add (indices.size(), indices.data(), values.data());
     }
 
 
@@ -1611,7 +1611,7 @@ namespace TrilinosWrappers
       Assert (indices.size() == values.size(),
               ExcDimensionMismatch(indices.size(),values.size()));
 
-      add (indices.size(), &indices[0], values.begin());
+      add (indices.size(), indices.data(), values.begin());
     }
 
 
index de92c03488b18efeee46fcdf97076421b9f7c834..e1530f90c5d4254a24dd5a888e2d1345f0568b70 100644 (file)
@@ -216,8 +216,8 @@ namespace Utilities
       int info;
       // call lapack_templates.h wrapper:
       stev ("N", &n,
-            &diagonal[0], &subdiagonal[0],
-            &Z[0], &ldz, &work[0],
+            diagonal.data(), subdiagonal.data(),
+            Z.data(), &ldz, work.data(),
             &info);
 
       Assert (info == 0,
index 2366be4cb11c4d53e08c567eff110554243fb0a1..3211f8d72e7fe21943987b7521677d139c086ad5 100644 (file)
@@ -1200,7 +1200,7 @@ namespace internal
             // make sure we allocate an even number of elements,
             // access to the new last element is needed in do_sum()
             large_array.resize(2*((n_chunks+1)/2));
-            array_ptr = &large_array[0];
+            array_ptr = large_array.data();
           }
         else
           array_ptr = &small_array[0];
index 56e1cc94702e6527d6787b50d71f4a6340f31e69..83bc19859c952312e916005f69b92ea842f98d32 100644 (file)
@@ -73,7 +73,7 @@ namespace CUDAWrappers
       std::vector<Number> old(array_host.size());
       old.swap(array_host);
 
-      transpose(n, m, &old[0], &array_host[0]);
+      transpose(n, m, old.data(), array_host.data());
     }
 
 
@@ -88,7 +88,7 @@ namespace CUDAWrappers
       cudaError_t error_code = cudaMalloc(array_device, n*sizeof(Number1));
       AssertCuda(error_code);
 
-      error_code = cudaMemcpy(*array_device, &array_host[0], n*sizeof(Number1),
+      error_code = cudaMemcpy(*array_device, array_host.data(), n*sizeof(Number1),
                               cudaMemcpyHostToDevice);
       AssertCuda(error_code);
     }
@@ -246,7 +246,7 @@ namespace CUDAWrappers
       for (unsigned int i=0; i<dofs_per_cell; ++i)
         lexicographic_dof_indices[i] = local_dof_indices[lexicographic_inv[i]];
 
-      memcpy(&local_to_global_host[cell_id*padding_length], &lexicographic_dof_indices[0],
+      memcpy(&local_to_global_host[cell_id*padding_length], lexicographic_dof_indices.data(),
              dofs_per_cell*sizeof(unsigned int));
 
       fe_values.reinit(cell);
@@ -255,7 +255,7 @@ namespace CUDAWrappers
       if (update_flags & update_quadrature_points)
         {
           const std::vector<Point<dim>> &q_points = fe_values.get_quadrature_points();
-          memcpy(&q_points_host[cell_id*padding_length], &q_points[0],
+          memcpy(&q_points_host[cell_id*padding_length], q_points.data(),
                  q_points_per_cell*sizeof(Point<dim>));
         }
 
@@ -271,7 +271,7 @@ namespace CUDAWrappers
         {
           const std::vector<DerivativeForm<1,dim,dim>> &inv_jacobians =
                                                       fe_values.get_inverse_jacobians();
-          memcpy(&inv_jacobian_host[cell_id*padding_length*dim*dim], &inv_jacobians[0],
+          memcpy(&inv_jacobian_host[cell_id*padding_length*dim*dim], inv_jacobians.data(),
                  q_points_per_cell*sizeof(DerivativeForm<1,dim,dim>));
         }
     }
@@ -548,7 +548,7 @@ namespace CUDAWrappers
                                 sizeof(dealii::types::global_dof_index));
         AssertCuda(cuda_error);
 
-        cuda_error = cudaMemcpy(constrained_dofs, &constrained_dofs_host[0],
+        cuda_error = cudaMemcpy(constrained_dofs, constrained_dofs_host.data(),
                                 n_constrained_dofs * sizeof(dealii::types::global_dof_index),
                                 cudaMemcpyHostToDevice);
         AssertCuda(cuda_error);
index 84e28635f838ac8321e2a13f4035e0341354559d..dcd631309da9f4c242fa63af61d77a6a14bac5a0 100644 (file)
@@ -1164,7 +1164,7 @@ MatrixFree<dim,Number>::constraint_pool_begin (const unsigned int row) const
 {
   AssertIndexRange (row, constraint_pool_row_index.size()-1);
   return constraint_pool_data.empty() ? nullptr :
-         &constraint_pool_data[0] + constraint_pool_row_index[row];
+         constraint_pool_data.data() + constraint_pool_row_index[row];
 }
 
 
@@ -1176,7 +1176,7 @@ MatrixFree<dim,Number>::constraint_pool_end (const unsigned int row) const
 {
   AssertIndexRange (row, constraint_pool_row_index.size()-1);
   return constraint_pool_data.empty() ? nullptr :
-         &constraint_pool_data[0] + constraint_pool_row_index[row+1];
+         constraint_pool_data.data() + constraint_pool_row_index[row+1];
 }
 
 
@@ -1235,13 +1235,13 @@ MatrixFree<dim,Number>::create_cell_subrange_hp_by_index
 #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, fe_index)
-        -&fe_indices[0] ;
+        std::lower_bound(fe_indices.data() + range.first,
+                         fe_indices.data() + range.second, fe_index)
+        -fe_indices.data() ;
       return_range.second =
-        std::lower_bound(&fe_indices[0] + return_range.first,
-                         &fe_indices[0] + range.second,
-                         fe_index + 1)-&fe_indices[0];
+        std::lower_bound(fe_indices.data() + return_range.first,
+                         fe_indices.data() + range.second,
+                         fe_index + 1)-fe_indices.data();
       Assert(return_range.first >= range.first &&
              return_range.second <= range.second, ExcInternalError());
       return return_range;
index 5e808e21715759c54337c1068eb1d68c4dfc38a8..e2005c9bf2bda05b08a59104bb64fcfd867715ad 100644 (file)
@@ -271,7 +271,7 @@ namespace
         char *compressed_data = new char[compressed_data_length];
         int err = compress2 ((Bytef *) compressed_data,
                              &compressed_data_length,
-                             (const Bytef *) &data[0],
+                             (const Bytef *) data.data(),
                              data.size() * sizeof(T),
                              get_zlib_compression_level(flags.compression_level));
         (void)err;
@@ -1154,7 +1154,7 @@ namespace
   {
     if (flags.data_binary)
       {
-        stream.write(reinterpret_cast<const char *>(&values[0]),
+        stream.write(reinterpret_cast<const char *>(values.data()),
                      values.size()*sizeof(data));
       }
     else
@@ -7010,13 +7010,13 @@ void DataOutBase::write_hdf5_parallel (const std::vector<Patch<dim,spacedim> > &
 
       // And finally, write the node data
       data_filter.fill_node_data(node_data_vec);
-      status = H5Dwrite(node_dataset, H5T_NATIVE_DOUBLE, node_memory_dataspace, node_file_dataspace, plist_id, &node_data_vec[0]);
+      status = H5Dwrite(node_dataset, H5T_NATIVE_DOUBLE, node_memory_dataspace, node_file_dataspace, plist_id, node_data_vec.data());
       AssertThrow(status >= 0, ExcIO());
       node_data_vec.clear();
 
       // And the cell data
       data_filter.fill_cell_data(global_node_cell_offsets[0], cell_data_vec);
-      status = H5Dwrite(cell_dataset, H5T_NATIVE_UINT, cell_memory_dataspace, cell_file_dataspace, plist_id, &cell_data_vec[0]);
+      status = H5Dwrite(cell_dataset, H5T_NATIVE_UINT, cell_memory_dataspace, cell_file_dataspace, plist_id, cell_data_vec.data());
       AssertThrow(status >= 0, ExcIO());
       cell_data_vec.clear();
 
index 72ccbf54c56de2613bfafb4ea43c9b8724409003..eebf42e11e15f7e19a766216a766d55ddc6318e9 100644 (file)
@@ -46,7 +46,7 @@ namespace Functions
     const unsigned int n = interpolation_points.size();
     cspline = gsl_spline_alloc (gsl_interp_cspline, n);
     // gsl_spline_init returns something but it seems nobody knows what
-    gsl_spline_init (cspline, &interpolation_points[0], &interpolation_values[0], n);
+    gsl_spline_init (cspline, interpolation_points.data(), interpolation_values.data(), n);
   }
 
 
index 9543531e65946fce6691fb95a5a52dab193a85dc..306866634c0573d546b853cdd4b39ea2aad5e64a 100644 (file)
@@ -598,7 +598,7 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator,
                          TrilinosWrappers::types::int_type(n_elements()),
                          (n_elements() > 0
                           ?
-                          reinterpret_cast<TrilinosWrappers::types::int_type *>(&indices[0])
+                          reinterpret_cast<TrilinosWrappers::types::int_type *>(indices.data())
                           :
                           nullptr),
                          0,
index aa42b950fc25ca6fbfc2cd528d788ebc1da19c9e..f829c0d5fb1e0c2e7c3eb4af3687d7a8fe5a5729 100644 (file)
@@ -125,8 +125,8 @@ namespace Utilities
       // processors in this case, which is more expensive than the reduction
       // operation above in MPI_Allreduce)
       std::vector<unsigned int> all_destinations (max_n_destinations * n_procs);
-      const int ierr = MPI_Allgather (&my_destinations[0], max_n_destinations, MPI_UNSIGNED,
-                                      &all_destinations[0], max_n_destinations, MPI_UNSIGNED,
+      const int ierr = MPI_Allgather (my_destinations.data(), max_n_destinations, MPI_UNSIGNED,
+                                      all_destinations.data(), max_n_destinations, MPI_UNSIGNED,
                                       mpi_comm);
       AssertThrowMPI(ierr);
 
@@ -388,8 +388,8 @@ namespace Utilities
 
           std::vector<char> all_hostnames(max_hostname_size *
                                           MPI::n_mpi_processes(MPI_COMM_WORLD));
-          const int ierr = MPI_Allgather (&hostname_array[0], max_hostname_size, MPI_CHAR,
-                                          &all_hostnames[0], max_hostname_size, MPI_CHAR,
+          const int ierr = MPI_Allgather (hostname_array.data(), max_hostname_size, MPI_CHAR,
+                                          all_hostnames.data(), max_hostname_size, MPI_CHAR,
                                           MPI_COMM_WORLD);
           AssertThrowMPI(ierr);
 
@@ -398,7 +398,7 @@ namespace Utilities
           unsigned int n_local_processes=0;
           unsigned int nth_process_on_host = 0;
           for (unsigned int i=0; i<MPI::n_mpi_processes(MPI_COMM_WORLD); ++i)
-            if (std::string (&all_hostnames[0] + i*max_hostname_size) == hostname)
+            if (std::string (all_hostnames.data() + i*max_hostname_size) == hostname)
               {
                 ++n_local_processes;
                 if (i <= MPI::this_mpi_process (MPI_COMM_WORLD))
index b4fd341a538964bcb4ffa2733bd67950aa877369..d4da3a51448cb4b03d868c0ea93e28d2a4a2d002 100644 (file)
@@ -183,7 +183,7 @@ namespace Utilities
       // Allow non-zero start index for the vector. send this data to all
       // processors
       first_index[0] = local_range_data.first;
-      int ierr = MPI_Bcast(&first_index[0], 1, DEAL_II_DOF_INDEX_MPI_TYPE,
+      int ierr = MPI_Bcast(first_index.data(), 1, DEAL_II_DOF_INDEX_MPI_TYPE,
                            0, communicator);
       AssertThrowMPI(ierr);
 
@@ -262,7 +262,7 @@ namespace Utilities
         for (unsigned int i=0; i<n_ghost_targets; i++)
           send_buffer[ghost_targets_data[i].first] = ghost_targets_data[i].second;
 
-        const int ierr = MPI_Alltoall (&send_buffer[0], 1, MPI_INT, &receive_buffer[0], 1,
+        const int ierr = MPI_Alltoall (send_buffer.data(), 1, MPI_INT, receive_buffer.data(), 1,
                                        MPI_INT, communicator);
         AssertThrowMPI(ierr);
 
@@ -314,7 +314,7 @@ namespace Utilities
         if (import_requests.size()>0)
           {
             const int ierr = MPI_Waitall (import_requests.size(),
-                                          &import_requests[0],
+                                          import_requests.data(),
                                           MPI_STATUSES_IGNORE);
             AssertThrowMPI(ierr);
           }
index ee259b9743a4d3863dadf043b8f53c34c3f046ab..b82971ed1f034ad0007db9f36ec30f78bf4545af 100644 (file)
@@ -104,7 +104,7 @@ namespace Polynomials
   {
     Assert (values.size() > 0, ExcZero());
 
-    value(x,values.size()-1,&values[0]);
+    value(x,values.size()-1,values.data());
   }
 
 
index bf574b0887c793c61e7fef7e00b5d9d295771d43..b6c8d159a9850865dd4bc939a894045e25e8d847 100644 (file)
@@ -47,7 +47,7 @@ namespace Polynomials
   {
     Assert (values.size() > 0, ExcZero());
 
-    value(x,values.size()-1,&values[0]);
+    value(x,values.size()-1,values.data());
   }
 
 
index 3e45432cf0872c3f0afb9b69cddc1fcb816d5941..ec3a462211c3ec3b622cb09f0488d306e5cb75f8 100644 (file)
@@ -1403,52 +1403,52 @@ namespace parallel
           {
             buffer.resize(bytes_for_buffer());
 
-            char *ptr = &buffer[0];
+            char *ptr = buffer.data();
 
             const unsigned int num_cells = tree_index.size();
             std::memcpy(ptr, &num_cells, sizeof(unsigned int));
             ptr += sizeof(unsigned int);
 
             std::memcpy(ptr,
-                        &tree_index[0],
+                        tree_index.data(),
                         num_cells*sizeof(unsigned int));
             ptr += num_cells*sizeof(unsigned int);
 
             std::memcpy(ptr,
-                        &quadrants[0],
+                        quadrants.data(),
                         num_cells * sizeof(typename dealii::internal::p4est::
                                            types<dim>::quadrant));
             ptr += num_cells*sizeof(typename dealii::internal::p4est::types<dim>::
                                     quadrant);
 
             std::memcpy(ptr,
-                        &vertex_indices[0],
+                        vertex_indices.data(),
                         vertex_indices.size() * sizeof(unsigned int));
             ptr += vertex_indices.size() * sizeof(unsigned int);
 
             std::memcpy(ptr,
-                        &vertices[0],
+                        vertices.data(),
                         vertices.size() * sizeof(dealii::Point<spacedim>));
             ptr += vertices.size() * sizeof(dealii::Point<spacedim>);
 
-            Assert (ptr == &buffer[0]+buffer.size(),
+            Assert (ptr == buffer.data()+buffer.size(),
                     ExcInternalError());
 
           }
 
           void unpack_data (const std::vector<char> &buffer)
           {
-            const char *ptr = &buffer[0];
+            const char *ptr = buffer.data();
             unsigned int cells;
             memcpy(&cells, ptr, sizeof(unsigned int));
             ptr += sizeof(unsigned int);
 
             tree_index.resize(cells);
-            memcpy(&tree_index[0],ptr,sizeof(unsigned int)*cells);
+            memcpy(tree_index.data(),ptr,sizeof(unsigned int)*cells);
             ptr += sizeof(unsigned int)*cells;
 
             quadrants.resize(cells);
-            memcpy(&quadrants[0],ptr,
+            memcpy(quadrants.data(),ptr,
                    sizeof(typename dealii::internal::p4est::types<dim>::quadrant)*cells);
             ptr += sizeof(typename dealii::internal::p4est::types<dim>::quadrant)*cells;
 
@@ -1494,7 +1494,7 @@ namespace parallel
             for (unsigned int c=0; c<cells; ++c)
               first_vertices[c] = &vertices[first_indices[c]];
 
-            Assert (ptr == &buffer[0]+buffer.size(),
+            Assert (ptr == buffer.data() + buffer.size(),
                     ExcInternalError());
           }
         };
@@ -3143,7 +3143,7 @@ namespace parallel
           AssertThrowMPI(ierr);
           receive.resize(len);
 
-          char *ptr = &receive[0];
+          char *ptr = receive.data();
           ierr = MPI_Recv(ptr, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
                           this->get_communicator(), &status);
           AssertThrowMPI(ierr);
@@ -3173,7 +3173,7 @@ namespace parallel
       // safely destroy the buffers.
       if (requests.size() > 0)
         {
-          const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+          const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
           AssertThrowMPI(ierr);
         }
 
index 222b32d898bdf1f178c0c835208657172d169580..c9e3d92011a37f97037a8e076ed37fdb13eecd3b 100644 (file)
@@ -202,7 +202,7 @@ namespace parallel
     const int ierr = MPI_Allgather (&send_value,
                                     1,
                                     MPI_UNSIGNED,
-                                    &number_cache.n_locally_owned_active_cells[0],
+                                    number_cache.n_locally_owned_active_cells.data(),
                                     1,
                                     MPI_UNSIGNED,
                                     this->mpi_communicator);
@@ -276,7 +276,7 @@ namespace parallel
 
           if (requests.size() > 0)
             {
-              ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+              ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
               AssertThrowMPI(ierr);
             }
 
index fd78e7cd92a9667225704a2b321d9907e6bd1cc5..d8b397fe31708bcf8ade34a862c769db962b0fea 100644 (file)
@@ -2872,7 +2872,7 @@ namespace internal
               // set rcounts based on new_numbers:
               int cur_count = new_numbers_copy.size ();
               int ierr = MPI_Allgather (&cur_count,  1, MPI_INT,
-                                        &rcounts[0], 1, MPI_INT,
+                                        rcounts.data(), 1, MPI_INT,
                                         tr->get_communicator ());
               AssertThrowMPI(ierr);
 
@@ -2887,10 +2887,10 @@ namespace internal
               Assert(((int)new_numbers_copy.size()) ==
                      rcounts[Utilities::MPI::this_mpi_process (tr->get_communicator ())],
                      ExcInternalError());
-              ierr = MPI_Allgatherv (&new_numbers_copy[0],     new_numbers_copy.size (),
+              ierr = MPI_Allgatherv (new_numbers_copy.data(),     new_numbers_copy.size (),
                                      DEAL_II_DOF_INDEX_MPI_TYPE,
-                                     &gathered_new_numbers[0], &rcounts[0],
-                                     &displacements[0],
+                                     gathered_new_numbers.data(), rcounts.data(),
+                                     displacements.data(),
                                      DEAL_II_DOF_INDEX_MPI_TYPE,
                                      tr->get_communicator ());
               AssertThrowMPI(ierr);
@@ -3008,8 +3008,8 @@ namespace internal
             // know how to serialize itself. consequently, first copy it over
             // to an array of bytes, and then serialize that
             std::vector<char> quadrants_as_chars (sizeof(quadrants[0]) * quadrants.size());
-            std::memcpy(&quadrants_as_chars[0],
-                        &quadrants[0],
+            std::memcpy(quadrants_as_chars.data(),
+                        quadrants.data(),
                         quadrants_as_chars.size());
 
             // now serialize everything
@@ -3033,8 +3033,8 @@ namespace internal
             &dof_numbers_and_indices;
 
             quadrants.resize (quadrants_as_chars.size() / sizeof(quadrants[0]));
-            std::memcpy(&quadrants[0],
-                        &quadrants_as_chars[0],
+            std::memcpy(quadrants.data(),
+                        quadrants_as_chars.data(),
                         quadrants_as_chars.size());
           }
 
@@ -3083,7 +3083,7 @@ namespace internal
               decompressing_stream.push(boost::iostreams::gzip_decompressor());
               decompressing_stream.push(boost::iostreams::back_inserter(decompressed_buffer));
 
-              decompressing_stream.write (&buffer[0], buffer.size());
+              decompressing_stream.write (buffer.data(), buffer.size());
             }
 
             // then restore the object from the buffer
@@ -3307,7 +3307,7 @@ namespace internal
               AssertThrowMPI(ierr);
               receive.resize(len);
 
-              char *ptr = &receive[0];
+              char *ptr = receive.data();
               ierr = MPI_Recv(ptr, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
                               tria.get_communicator(), &status);
               AssertThrowMPI(ierr);
@@ -3355,7 +3355,7 @@ namespace internal
               AssertThrowMPI(ierr);
               receive.resize(len);
 
-              char *ptr = &receive[0];
+              char *ptr = receive.data();
               ierr = MPI_Recv(ptr, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
                               tria.get_communicator(), &status);
               AssertThrowMPI(ierr);
@@ -3391,12 +3391,12 @@ namespace internal
           // buffers.
           if (requests.size() > 0)
             {
-              const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+              const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
               AssertThrowMPI(ierr);
             }
           if (reply_requests.size() > 0)
             {
-              const int ierr = MPI_Waitall(reply_requests.size(), &reply_requests[0], MPI_STATUSES_IGNORE);
+              const int ierr = MPI_Waitall(reply_requests.size(), reply_requests.data(), MPI_STATUSES_IGNORE);
               AssertThrowMPI(ierr);
             }
         }
@@ -3739,7 +3739,7 @@ namespace internal
 
         const int ierr = MPI_Allgather ( &n_locally_owned_dofs,
                                          1, DEAL_II_DOF_INDEX_MPI_TYPE,
-                                         &n_locally_owned_dofs_per_processor[0],
+                                         n_locally_owned_dofs_per_processor.data(),
                                          1, DEAL_II_DOF_INDEX_MPI_TYPE,
                                          triangulation->get_communicator());
         AssertThrowMPI(ierr);
@@ -4318,8 +4318,8 @@ namespace internal
           my_data.resize(max_size);
 
           std::vector<char> buffer(max_size*n_cpus);
-          const int ierr = MPI_Allgather(&my_data[0], max_size, MPI_BYTE,
-                                         &buffer[0], max_size, MPI_BYTE,
+          const int ierr = MPI_Allgather(my_data.data(), max_size, MPI_BYTE,
+                                         buffer.data(), max_size, MPI_BYTE,
                                          triangulation->get_communicator());
           AssertThrowMPI(ierr);
 
index 702bde741567fa204826c2ad0c91961efe77abfe..fee4acbd907cce0cadd1b5bc4fd385323c0588cd 100644 (file)
@@ -315,10 +315,10 @@ namespace DoFRenumbering
 
       minimum_degree_ordering
       (G,
-       make_iterator_property_map(&degree[0], id, degree[0]),
-       &inverse_perm[0],
-       &perm[0],
-       make_iterator_property_map(&supernode_sizes[0], id, supernode_sizes[0]),
+       make_iterator_property_map(degree.begin(), id, degree[0]),
+       inverse_perm.data(),
+       perm.data(),
+       make_iterator_property_map(supernode_sizes.begin(), id, supernode_sizes[0]),
        delta, id);
 
 
@@ -733,9 +733,9 @@ namespace DoFRenumbering
         all_dof_counts(fe_collection.n_components() *
                        Utilities::MPI::n_mpi_processes (tria->get_communicator()));
 
-        const int ierr = MPI_Allgather ( &local_dof_count[0],
+        const int ierr = MPI_Allgather ( local_dof_count.data(),
                                          n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE,
-                                         &all_dof_counts[0],
+                                         all_dof_counts.data(),
                                          n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE,
                                          tria->get_communicator());
         AssertThrowMPI(ierr);
@@ -1021,9 +1021,9 @@ namespace DoFRenumbering
         all_dof_counts(fe_collection.n_components() *
                        Utilities::MPI::n_mpi_processes (tria->get_communicator()));
 
-        const int ierr = MPI_Allgather ( &local_dof_count[0],
+        const int ierr = MPI_Allgather ( local_dof_count.data(),
                                          n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE,
-                                         &all_dof_counts[0],
+                                         all_dof_counts.data(),
                                          n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE,
                                          tria->get_communicator());
         AssertThrowMPI(ierr);
index d17ec89caaf41bf3a61afbfaf495e449281f8e3e..ab956ffcb8b924de130a5641d684fdb053d5bbf6 100644 (file)
@@ -1806,7 +1806,7 @@ namespace DoFTools
       {
         std::vector<types::global_dof_index> local_dof_count = dofs_per_component;
 
-        const int ierr = MPI_Allreduce (&local_dof_count[0], &dofs_per_component[0], n_target_components,
+        const int ierr = MPI_Allreduce (local_dof_count.data(), dofs_per_component.data(), n_target_components,
                                         DEAL_II_DOF_INDEX_MPI_TYPE,
                                         MPI_SUM, tria->get_communicator());
         AssertThrowMPI (ierr);
@@ -1884,7 +1884,7 @@ namespace DoFTools
                (&dof_handler.get_triangulation())))
           {
             std::vector<types::global_dof_index> local_dof_count = dofs_per_block;
-            const int ierr = MPI_Allreduce (&local_dof_count[0], &dofs_per_block[0],
+            const int ierr = MPI_Allreduce (local_dof_count.data(), dofs_per_block.data(),
                                             n_target_blocks,
                                             DEAL_II_DOF_INDEX_MPI_TYPE,
                                             MPI_SUM, tria->get_communicator());
index fa31e097ac0b7d88ff8a924af3194a2151e504d6..094700373c2ab22285cb1fa66b9d7ed17e72d6d9 100644 (file)
@@ -92,7 +92,7 @@ FE_ABF<dim>::FE_ABF (const unsigned int deg)
                                                  this->dofs_per_face));
   // TODO: Something goes wrong there. The error of the least squares fit
   // is to large ...
-  // FETools::compute_face_embedding_matrices(*this, &face_embeddings[0], 0, 0);
+  // FETools::compute_face_embedding_matrices(*this, face_embeddings.data(), 0, 0);
   this->interface_constraints.reinit((1<<(dim-1)) * this->dofs_per_face,
                                      this->dofs_per_face);
   unsigned int target_row=0;
index 2437f006a04ebb18b1eec7f3b5c64bae852c38db..51390ceb092c16872708a018582eb5fd2fc73d02 100644 (file)
@@ -2332,7 +2332,7 @@ next_cell:
     // processors and shifting the indices accordingly
     const unsigned int n_cpu = Utilities::MPI::n_mpi_processes(triangulation.get_communicator());
     std::vector<types::global_vertex_index> indices(n_cpu);
-    int ierr = MPI_Allgather(&next_index, 1, DEAL_II_DOF_INDEX_MPI_TYPE, &indices[0],
+    int ierr = MPI_Allgather(&next_index, 1, DEAL_II_DOF_INDEX_MPI_TYPE, indices.data(),
                              indices.size(), DEAL_II_DOF_INDEX_MPI_TYPE, triangulation.get_communicator());
     AssertThrowMPI(ierr);
     const types::global_vertex_index shift = std::accumulate(&indices[0],
index 5b9c0abe33a284ebcfedf48a03f3baf0456712fa..1866193aaeef2404fd0378fec6cc42848886037c 100644 (file)
@@ -612,7 +612,7 @@ get_new_points (const ArrayView<const Point<spacedim>> &surrounding_points,
           for (unsigned int i=0; i<n_points; ++i)
             if ((surrounding_points[i][d]-minP[d]) > periodicity[d]/2.0)
               modified_points[i][d] -= periodicity[d];
-      surrounding_points_start = &modified_points[0];
+      surrounding_points_start = modified_points.data();
     }
 
   // Now perform the interpolation
index e298960064eba90ad7b0fec20150c3acc4214e9d..6be51ecfa3743364486127aacfeb37047b74664c 100644 (file)
@@ -202,12 +202,12 @@ LAPACKFullMatrix<number>::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[0], &one);
+      gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, work.data(), &one);
       // Multiply by singular values
       for (size_type i=0; i<wr.size(); ++i)
         work[i] *= wr[i];
       // Multiply with U
-      gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, &work[0], &one, &beta, w.val, &one);
+      gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, work.data(), &one, &beta, w.val, &one);
       break;
     }
     case inverse_svd:
@@ -217,12 +217,12 @@ LAPACKFullMatrix<number>::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[0], &one);
+      gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, work.data(), &one);
       // Multiply by singular values
       for (size_type i=0; i<wr.size(); ++i)
         work[i] *= wr[i];
       // Multiply with V
-      gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one);
+      gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, work.data(), &one, &beta, w.val, &one);
       break;
     }
     default:
@@ -263,12 +263,12 @@ LAPACKFullMatrix<number>::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[0], &one);
+      gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, work.data(), &one);
       // Multiply by singular values
       for (size_type i=0; i<wr.size(); ++i)
         work[i] *= wr[i];
       // Multiply with V
-      gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one);
+      gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, work.data(), &one, &beta, w.val, &one);
       break;
     }
     case inverse_svd:
@@ -279,12 +279,12 @@ LAPACKFullMatrix<number>::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[0], &one);
+      gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, work.data(), &one);
       // Multiply by singular values
       for (size_type i=0; i<wr.size(); ++i)
         work[i] *= wr[i];
       // Multiply with U
-      gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, &work[0], &one, &beta, w.val, &one);
+      gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, work.data(), &one, &beta, w.val, &one);
       break;
     }
     default:
@@ -513,7 +513,7 @@ LAPACKFullMatrix<number>::compute_lu_factorization()
   number *values = const_cast<number *> (&this->values[0]);
   ipiv.resize(mm);
   int info = 0;
-  getrf(&mm, &nn, values, &mm, &ipiv[0], &info);
+  getrf(&mm, &nn, values, &mm, ipiv.data(), &info);
 
   Assert(info >= 0, ExcInternalError());
 
@@ -580,7 +580,7 @@ number LAPACKFullMatrix<number>::norm(const char type) const
                         std::max(1,N) :
                         0;
       work.resize(lwork);
-      return lansy (&type, &LAPACKSupport::L, &N, values, &lda, &work[0]);
+      return lansy (&type, &LAPACKSupport::L, &N, values, &lda, work.data());
     }
   else
     {
@@ -589,7 +589,7 @@ number LAPACKFullMatrix<number>::norm(const char type) const
                         std::max(1,M) :
                         0;
       work.resize(lwork);
-      return lange (&type, &M, &N, values, &lda, &work[0]);
+      return lange (&type, &M, &N, values, &lda, work.data());
     }
 }
 
@@ -658,7 +658,7 @@ LAPACKFullMatrix<number>::reciprocal_condition_number(const number a_norm) const
   // use the same uplo as in Cholesky
   pocon (&LAPACKSupport::L, &N, values, &lda,
          &a_norm, &rcond,
-         &work[0], &iwork[0], &info);
+         work.data(), iwork.data(), &info);
 
   Assert(info >= 0, ExcInternalError());
 
@@ -691,8 +691,8 @@ LAPACKFullMatrix<number>::compute_svd()
   work.resize(1);
   int lwork = -1;
   gesdd(&LAPACKSupport::A, &mm, &nn, values, &mm,
-        &wr[0], mu, &mm, mvt, &nn,
-        &work[0], &lwork, &ipiv[0], &info);
+        wr.data(), mu, &mm, mvt, &nn,
+        work.data(), &lwork, ipiv.data(), &info);
   AssertThrow (info==0, LAPACKSupport::ExcErrorCode("gesdd", info));
   // Resize the work array. Add one to the size computed by LAPACK to be on
   // the safe side.
@@ -701,8 +701,8 @@ LAPACKFullMatrix<number>::compute_svd()
   work.resize(lwork);
   // Do the actual SVD.
   gesdd(&LAPACKSupport::A, &mm, &nn, values, &mm,
-        &wr[0], mu, &mm, mvt, &nn,
-        &work[0], &lwork, &ipiv[0], &info);
+        wr.data(), mu, &mm, mvt, &nn,
+        work.data(), &lwork, ipiv.data(), &info);
   AssertThrow (info==0, LAPACKSupport::ExcErrorCode("gesdd", info));
 
   work.resize(0);
@@ -753,7 +753,7 @@ LAPACKFullMatrix<number>::invert()
 
       ipiv.resize(mm);
       inv_work.resize (mm);
-      getri(&mm, values, &mm, &ipiv[0], &inv_work[0], &mm, &info);
+      getri(&mm, values, &mm, ipiv.data(), inv_work.data(), &mm, &info);
     }
   else
     {
@@ -790,7 +790,7 @@ LAPACKFullMatrix<number>::apply_lu_factorization(Vector<number> &v,
   const number *values = &this->values[0];
   int info = 0;
 
-  getrs(trans, &nn, &one, values, &nn, &ipiv[0],
+  getrs(trans, &nn, &one, values, &nn, ipiv.data(),
         v.begin(), &nn, &info);
 
   Assert(info == 0, ExcInternalError());
@@ -813,7 +813,7 @@ LAPACKFullMatrix<number>::apply_lu_factorization(LAPACKFullMatrix<number> &B,
   const number *values = &this->values[0];
   int info = 0;
 
-  getrs(trans, &nn, &kk, values, &nn, &ipiv[0], &B.values[0], &nn, &info);
+  getrs(trans, &nn, &kk, values, &nn, ipiv.data(), &B.values[0], &nn, &info);
 
   Assert(info == 0, ExcInternalError());
 }
@@ -881,9 +881,9 @@ LAPACKFullMatrix<number>::compute_eigenvalues(const bool right,
   work.resize(1);
 
   geev(jobvl, jobvr, &nn, values, &nn,
-       &wr[0], &wi[0],
-       &vl[0], &nn, &vr[0], &nn,
-       &work[0], &lwork, &info);
+       wr.data(), wi.data(),
+       vl.data(), &nn, vr.data(), &nn,
+       work.data(), &lwork, &info);
   // geev returns info=0 on success. Since we only queried the optimal size
   // for work, everything else would not be acceptable.
   Assert (info == 0, ExcInternalError());
@@ -896,9 +896,9 @@ LAPACKFullMatrix<number>::compute_eigenvalues(const bool right,
 
   // Finally compute the eigenvalues.
   geev(jobvl, jobvr, &nn, values, &nn,
-       &wr[0], &wi[0],
-       &vl[0], &nn, &vr[0], &nn,
-       &work[0], &lwork, &info);
+       wr.data(), wi.data(),
+       vl.data(), &nn, vr.data(), &nn,
+       work.data(), &lwork, &info);
   // Negative return value implies a wrong argument. This should be internal.
 
   Assert (info >=0, ExcInternalError());
@@ -954,9 +954,9 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric(const number        lowe
          uplo, &nn, values_A, &nn,
          &lower_bound, &upper_bound,
          dummy, dummy, &abs_accuracy,
-         &n_eigenpairs, &wr[0], values_eigenvectors,
-         &nn, &work[0], &lwork, &iwork[0],
-         &ifail[0], &info);
+         &n_eigenpairs, wr.data(), values_eigenvectors,
+         &nn, work.data(), &lwork, iwork.data(),
+         ifail.data(), &info);
   // syevx returns info=0 on success. Since we only queried the optimal size
   // for work, everything else would not be acceptable.
   Assert (info == 0, ExcInternalError());
@@ -970,9 +970,9 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric(const number        lowe
          uplo, &nn, values_A, &nn,
          &lower_bound, &upper_bound,
          dummy, dummy, &abs_accuracy,
-         &n_eigenpairs, &wr[0], values_eigenvectors,
-         &nn, &work[0], &lwork, &iwork[0],
-         &ifail[0], &info);
+         &n_eigenpairs, wr.data(), values_eigenvectors,
+         &nn, work.data(), &lwork, iwork.data(),
+         ifail.data(), &info);
 
   // Negative return value implies a wrong argument. This should be internal.
   Assert (info >=0, ExcInternalError());
@@ -1046,8 +1046,8 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric(
   sygvx (&itype, jobz, range, uplo, &nn, values_A, &nn,
          values_B, &nn, &lower_bound, &upper_bound,
          dummy, dummy, &abs_accuracy, &n_eigenpairs,
-         &wr[0], values_eigenvectors, &nn, &work[0],
-         &lwork, &iwork[0], &ifail[0], &info);
+         wr.data(), values_eigenvectors, &nn, work.data(),
+         &lwork, iwork.data(), ifail.data(), &info);
   // sygvx returns info=0 on success. Since we only queried the optimal size
   // for work, everything else would not be acceptable.
   Assert (info == 0, ExcInternalError());
@@ -1062,8 +1062,8 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric(
   sygvx (&itype, jobz, range, uplo, &nn, values_A, &nn,
          values_B, &nn, &lower_bound, &upper_bound,
          dummy, dummy, &abs_accuracy, &n_eigenpairs,
-         &wr[0], values_eigenvectors, &nn, &work[0],
-         &lwork, &iwork[0], &ifail[0], &info);
+         wr.data(), values_eigenvectors, &nn, work.data(),
+         &lwork, iwork.data(), ifail.data(), &info);
 
   // Negative return value implies a wrong argument. This should be internal.
   Assert (info >=0, ExcInternalError());
@@ -1129,7 +1129,7 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric (
 
   sygv (&itype, jobz, uplo, &nn, values_A, &nn,
         values_B, &nn,
-        &wr[0], &work[0], &lwork, &info);
+        wr.data(), work.data(), &lwork, &info);
   // sygv returns info=0 on success. Since we only queried the optimal size
   // for work, everything else would not be acceptable.
   Assert (info == 0, ExcInternalError());
@@ -1143,7 +1143,7 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric (
   // Finally compute the generalized eigenvalues.
   sygv (&itype, jobz, uplo, &nn, values_A, &nn,
         values_B, &nn,
-        &wr[0], &work[0], &lwork, &info);
+        wr.data(), work.data(), &lwork, &info);
   // Negative return value implies a wrong argument. This should be internal.
 
   Assert (info >=0, ExcInternalError());
index 012286016e54f5ed25b183c44501afc47d7c9f2f..efc57ad532c53d44020eda34944ffd2239d567d9 100644 (file)
@@ -150,7 +150,7 @@ namespace PETScWrappers
     IS index_set;
 
     ISCreateGeneral (get_mpi_communicator(), rows.size(),
-                     &petsc_rows[0], PETSC_COPY_VALUES, &index_set);
+                     petsc_rows.data(), PETSC_COPY_VALUES, &index_set);
 
     const PetscErrorCode ierr = MatZeroRowsIS(matrix, index_set, new_diag_value,
                                               nullptr, nullptr);
index d922448588b842782276096b2b137e8a14c659f7..65461a0e6b47bfbc135a3f7bcb95aff2ac78264d 100644 (file)
@@ -298,9 +298,9 @@ namespace PETScWrappers
                                   (communicator,
                                    local_rows, local_columns,
                                    m, n,
-                                   0, &int_row_lengths[0],
+                                   0, int_row_lengths.data(),
                                    0,
-                                   offdiag_row_lengths.size() ? &int_offdiag_row_lengths[0] : nullptr,
+                                   offdiag_row_lengths.size() ? int_offdiag_row_lengths.data() : nullptr,
                                    &matrix);
 
 //TODO: Sometimes the actual number of nonzero entries allocated is greater than the number of nonzero entries, which petsc will complain about unless explicitly disabled with MatSetOption. There is probably a way to prevent a different number nonzero elements being allocated in the first place. (See also previous TODO).
@@ -429,8 +429,8 @@ namespace PETScWrappers
           // that summarily allocates these
           // entries:
           ierr = MatMPIAIJSetPreallocationCSR (matrix,
-                                               &rowstart_in_window[0],
-                                               &colnums_in_window[0],
+                                               rowstart_in_window.data(),
+                                               colnums_in_window.data(),
                                                nullptr);
           AssertThrow (ierr == 0, ExcPETScError(ierr));
         }
@@ -558,8 +558,8 @@ namespace PETScWrappers
           // that summarily allocates these
           // entries:
           ierr = MatMPIAIJSetPreallocationCSR (matrix,
-                                               &rowstart_in_window[0],
-                                               &colnums_in_window[0],
+                                               rowstart_in_window.data(),
+                                               colnums_in_window.data(),
                                                nullptr);
           AssertThrow (ierr == 0, ExcPETScError(ierr));
 
index e71099b7129f98b4592e92ca6e45806958073077..0e2215ed76b378b6e906ff770b7ce8dfe7111ac8 100644 (file)
@@ -180,7 +180,7 @@ namespace PETScWrappers
     int_row_lengths (row_lengths.begin(), row_lengths.end());
 
     const PetscErrorCode ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, 0,
-                                                &int_row_lengths[0], &matrix);
+                                                int_row_lengths.data(), &matrix);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
     // set symmetric flag, if so requested
@@ -231,8 +231,8 @@ namespace PETScWrappers
 
             const PetscInt int_row = i;
             const PetscErrorCode ierr = MatSetValues (matrix, 1, &int_row,
-                                                      row_lengths[i], &row_entries[0],
-                                                      &row_values[0], INSERT_VALUES);
+                                                      row_lengths[i], row_entries.data(),
+                                                      row_values.data(), INSERT_VALUES);
             AssertThrow (ierr == 0, ExcPETScError(ierr));
           }
         compress (VectorOperation::insert);
index 6f5dc4177b69e9dd4e33a7196d812518b90c385a..763e6adf7e5e21b3a2fc76f98846713f0638a258 100644 (file)
@@ -289,7 +289,7 @@ namespace PETScWrappers
   {
     Assert (indices.size() == values.size(),
             ExcMessage ("Function called with arguments of different sizes"));
-    do_set_add_operation(indices.size(), &indices[0], &values[0], false);
+    do_set_add_operation(indices.size(), indices.data(), values.data(), false);
   }
 
 
@@ -300,7 +300,7 @@ namespace PETScWrappers
   {
     Assert (indices.size() == values.size(),
             ExcMessage ("Function called with arguments of different sizes"));
-    do_set_add_operation(indices.size(), &indices[0], &values[0], true);
+    do_set_add_operation(indices.size(), indices.data(), values.data(), true);
   }
 
 
@@ -311,7 +311,7 @@ namespace PETScWrappers
   {
     Assert (indices.size() == values.size(),
             ExcMessage ("Function called with arguments of different sizes"));
-    do_set_add_operation(indices.size(), &indices[0], values.begin(), true);
+    do_set_add_operation(indices.size(), indices.data(), values.begin(), true);
   }
 
 
index b7c51851ad09f9526b3ca285cf2c158254f65c12..7956a3e91ffeb51a7f0988afb871a272d2fa2f78 100644 (file)
@@ -59,7 +59,7 @@ SparseDirectUMFPACK::SparseDirectUMFPACK ()
   numeric_decomposition (nullptr),
   control (UMFPACK_CONTROL)
 {
-  umfpack_dl_defaults (&control[0]);
+  umfpack_dl_defaults (control.data());
 }
 
 
@@ -95,7 +95,7 @@ SparseDirectUMFPACK::clear ()
     tmp.swap (Ax);
   }
 
-  umfpack_dl_defaults (&control[0]);
+  umfpack_dl_defaults (control.data());
 }
 
 
@@ -279,16 +279,16 @@ factorize (const Matrix &matrix)
 
   int status;
   status = umfpack_dl_symbolic (N, N,
-                                &Ap[0], &Ai[0], &Ax[0],
+                                Ap.data(), Ai.data(), Ax.data(),
                                 &symbolic_decomposition,
-                                &control[0], nullptr);
+                                control.data(), nullptr);
   AssertThrow (status == UMFPACK_OK,
                ExcUMFPACKError("umfpack_dl_symbolic", status));
 
-  status = umfpack_dl_numeric (&Ap[0], &Ai[0], &Ax[0],
+  status = umfpack_dl_numeric (Ap.data(), Ai.data(), Ax.data(),
                                symbolic_decomposition,
                                &numeric_decomposition,
-                               &control[0], nullptr);
+                               control.data(), nullptr);
   AssertThrow (status == UMFPACK_OK,
                ExcUMFPACKError("umfpack_dl_numeric", status));
 
@@ -317,10 +317,10 @@ SparseDirectUMFPACK::solve (Vector<double> &rhs_and_solution,
   // instead.
   const int status
     = umfpack_dl_solve (transpose ? UMFPACK_A : UMFPACK_At,
-                        &Ap[0], &Ai[0], &Ax[0],
+                        Ap.data(), Ai.data(), Ax.data(),
                         rhs_and_solution.begin(), rhs.begin(),
                         numeric_decomposition,
-                        &control[0], nullptr);
+                        control.data(), nullptr);
   AssertThrow (status == UMFPACK_OK, ExcUMFPACKError("umfpack_dl_solve", status));
 }
 
index ef32909eaa321f0ba1e3e503fcb5fa41d7be1142..1d8c3365f5ec27d8d429f4ba0bae90eb58ef8c1a 100644 (file)
@@ -119,17 +119,17 @@ namespace SparsityTools
 
     // Use recursive if the number of partitions is less than or equal to 8
     if (nparts <= 8)
-      ierr = METIS_PartGraphRecursive(&n, &ncon, &int_rowstart[0], &int_colnums[0],
+      ierr = METIS_PartGraphRecursive(&n, &ncon, int_rowstart.data(), int_colnums.data(),
                                       nullptr, nullptr, nullptr,
-                                      &nparts,nullptr,nullptr,&options[0],
-                                      &dummy,&int_partition_indices[0]);
+                                      &nparts,nullptr,nullptr,options,
+                                      &dummy,int_partition_indices.data());
 
     // Otherwise use kway
     else
-      ierr = METIS_PartGraphKway(&n, &ncon, &int_rowstart[0], &int_colnums[0],
+      ierr = METIS_PartGraphKway(&n, &ncon, int_rowstart.data(), int_colnums.data(),
                                  nullptr, nullptr, nullptr,
-                                 &nparts,nullptr,nullptr,&options[0],
-                                 &dummy,&int_partition_indices[0]);
+                                 &nparts,nullptr,nullptr,options,
+                                 &dummy,int_partition_indices.data());
 
     // If metis returns normally, an error code METIS_OK=1 is returned from
     // the above functions (see metish.h)
@@ -604,7 +604,7 @@ namespace SparsityTools
           ierr = MPI_Get_count(&status, DEAL_II_DOF_INDEX_MPI_TYPE, &len);
           AssertThrowMPI(ierr);
           recv_buf.resize(len);
-          ierr = MPI_Recv(&recv_buf[0], len, DEAL_II_DOF_INDEX_MPI_TYPE, status.MPI_SOURCE,
+          ierr = MPI_Recv(recv_buf.data(), len, DEAL_II_DOF_INDEX_MPI_TYPE, status.MPI_SOURCE,
                           status.MPI_TAG, mpi_comm, &status);
           AssertThrowMPI(ierr);
 
@@ -629,7 +629,7 @@ namespace SparsityTools
     // complete all sends, so that we can safely destroy the buffers.
     if (requests.size())
       {
-        const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+        const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
         AssertThrowMPI(ierr);
       }
 
@@ -735,7 +735,7 @@ namespace SparsityTools
           ierr = MPI_Get_count(&status, DEAL_II_DOF_INDEX_MPI_TYPE, &len);
           AssertThrowMPI(ierr);
           recv_buf.resize(len);
-          ierr = MPI_Recv(&recv_buf[0], len, DEAL_II_DOF_INDEX_MPI_TYPE, status.MPI_SOURCE,
+          ierr = MPI_Recv(recv_buf.data(), len, DEAL_II_DOF_INDEX_MPI_TYPE, status.MPI_SOURCE,
                           status.MPI_TAG, mpi_comm, &status);
           AssertThrowMPI(ierr);
 
@@ -760,7 +760,7 @@ namespace SparsityTools
     // complete all sends, so that we can safely destroy the buffers.
     if (requests.size())
       {
-        const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+        const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
         AssertThrowMPI(ierr);
       }
   }
index 3912e3948014590064c5d2dff704587b4f63c3f9..16fb391023d6f8a8c7c56024f89b85f4d5d45af0 100644 (file)
@@ -191,7 +191,7 @@ namespace TrilinosWrappers
         // the current processor. Therefore, pass a dummy in that case
         else
           parameter_list.set("null space: vectors",
-                             &dummy[0]);
+                             dummy.data());
       }
 
     initialize (matrix, parameter_list);
index c70281cec2e6a008e36dcdd1c32b32fba9f113b0..b10c04d4620f3c2601c91389926c4c740ab5e854 100644 (file)
@@ -184,7 +184,7 @@ namespace TrilinosWrappers
         // the current processor. Therefore, pass a dummy in that case
         else
           parameter_list.set("null space: vectors",
-                             &dummy[0]);
+                             dummy.data());
       }
 
     initialize (matrix, parameter_list);
index af8c0d3aae4cea470b86b876e92613dd7702e861..b4730994b2cc1e977db5cc922427b6b81667d477 100644 (file)
@@ -498,10 +498,10 @@ namespace TrilinosWrappers
       std::shared_ptr<Epetra_CrsGraph> graph;
       if (input_row_map.Comm().NumProc() > 1)
         graph.reset (new Epetra_CrsGraph (Copy, input_row_map,
-                                          &n_entries_per_row[0], true));
+                                          n_entries_per_row.data(), true));
       else
         graph.reset (new Epetra_CrsGraph (Copy, input_row_map, input_col_map,
-                                          &n_entries_per_row[0], true));
+                                          n_entries_per_row.data(), true));
 
       // This functions assumes that the sparsity pattern sits on all
       // processors (completely). The parallel version uses an Epetra graph
@@ -523,7 +523,7 @@ namespace TrilinosWrappers
               row_indices[col] = p->column();
           }
           graph->Epetra_CrsGraph::InsertGlobalIndices (row, row_length,
-                                                       &row_indices[0]);
+                                                       row_indices.data());
         }
 
       // Eventually, optimize the graph structure (sort indices, make memory
@@ -613,7 +613,7 @@ namespace TrilinosWrappers
         Epetra_Map relevant_map (TrilinosWrappers::types::int_type(-1),
                                  TrilinosWrappers::types::int_type(relevant_rows.n_elements()),
                                  (indices.empty() ? nullptr :
-                                  reinterpret_cast<TrilinosWrappers::types::int_type *>(&indices[0])),
+                                  reinterpret_cast<TrilinosWrappers::types::int_type *>(indices.data())),
                                  0, input_row_map.Comm());
         if (relevant_map.SameAs(input_row_map))
           have_ghost_rows = false;
@@ -639,7 +639,7 @@ namespace TrilinosWrappers
         }
 
       Epetra_Map off_processor_map(-1, ghost_rows.size(),
-                                   (ghost_rows.size()>0)?(&ghost_rows[0]):nullptr,
+                                   (ghost_rows.size()>0)?(ghost_rows.data()):nullptr,
                                    0, input_row_map.Comm());
 
       std::shared_ptr<Epetra_CrsGraph> graph;
@@ -647,15 +647,15 @@ namespace TrilinosWrappers
       if (input_row_map.Comm().NumProc() > 1)
         {
           graph.reset (new Epetra_CrsGraph (Copy, input_row_map,
-                                            (n_entries_per_row.size()>0)?(&n_entries_per_row[0]):nullptr,
+                                            (n_entries_per_row.size()>0)?(n_entries_per_row.data()):nullptr,
                                             exchange_data ? false : true));
           if (have_ghost_rows == true)
             nonlocal_graph.reset (new Epetra_CrsGraphMod (off_processor_map,
-                                                          &n_entries_per_ghost_row[0]));
+                                                          n_entries_per_ghost_row.data()));
         }
       else
         graph.reset (new Epetra_CrsGraph (Copy, input_row_map, input_col_map,
-                                          (n_entries_per_row.size()>0)?(&n_entries_per_row[0]):nullptr,
+                                          (n_entries_per_row.size()>0)?(n_entries_per_row.data()):nullptr,
                                           true));
 
       // now insert the indices, select between the right matrix
@@ -674,12 +674,12 @@ namespace TrilinosWrappers
             row_indices[col] = sparsity_pattern.column_number(global_row, col);
 
           if (input_row_map.MyGID(global_row))
-            graph->InsertGlobalIndices (global_row, row_length, &row_indices[0]);
+            graph->InsertGlobalIndices (global_row, row_length, row_indices.data());
           else
             {
               Assert(nonlocal_graph.get() != nullptr, ExcInternalError());
               nonlocal_graph->InsertGlobalIndices (global_row, row_length,
-                                                   &row_indices[0]);
+                                                   row_indices.data());
             }
         }
 
@@ -937,8 +937,8 @@ namespace TrilinosWrappers
               ++select_index;
               ++it;
             }
-          set (row, col, reinterpret_cast<size_type *>(&row_indices[0]),
-               &values[0], false);
+          set (row, col, reinterpret_cast<size_type *>(row_indices.data()),
+               values.data(), false);
         }
     compress(VectorOperation::insert);
   }
@@ -1015,7 +1015,7 @@ namespace TrilinosWrappers
         const TrilinosScalar *in_values = input_matrix[0];
         TrilinosScalar *values = (*matrix)[0];
         const size_type my_nonzeros = input_matrix.NumMyNonzeros();
-        std::memcpy (&values[0], &in_values[0],
+        std::memcpy (values, in_values,
                      my_nonzeros*sizeof (TrilinosScalar));
       }
 
@@ -1347,7 +1347,7 @@ namespace TrilinosWrappers
             ExcDimensionMismatch(col_indices.size(), values.n()));
 
     for (size_type i=0; i<row_indices.size(); ++i)
-      set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
+      set (row_indices[i], col_indices.size(), col_indices.data(), &values(i,0),
            elide_zero_values);
   }
 
@@ -1362,7 +1362,7 @@ namespace TrilinosWrappers
     Assert (col_indices.size() == values.size(),
             ExcDimensionMismatch(col_indices.size(), values.size()));
 
-    set (row, col_indices.size(), &col_indices[0], &values[0],
+    set (row, col_indices.size(), col_indices.data(), values.data(),
          elide_zero_values);
   }
 
@@ -1505,7 +1505,7 @@ namespace TrilinosWrappers
     Assert (values.m() == values.n(), ExcNotQuadratic());
 
     for (size_type i=0; i<indices.size(); ++i)
-      add (indices[i], indices.size(), &indices[0], &values(i,0),
+      add (indices[i], indices.size(), indices.data(), &values(i,0),
            elide_zero_values);
   }
 
@@ -1523,7 +1523,7 @@ namespace TrilinosWrappers
             ExcDimensionMismatch(col_indices.size(), values.n()));
 
     for (size_type i=0; i<row_indices.size(); ++i)
-      add (row_indices[i], col_indices.size(), &col_indices[0],
+      add (row_indices[i], col_indices.size(), col_indices.data(),
            &values(i,0), elide_zero_values);
   }
 
@@ -1538,7 +1538,7 @@ namespace TrilinosWrappers
     Assert (col_indices.size() == values.size(),
             ExcDimensionMismatch(col_indices.size(), values.size()));
 
-    add (row, col_indices.size(), &col_indices[0], &values[0],
+    add (row, col_indices.size(), col_indices.data(), values.data(),
          elide_zero_values);
   }
 
@@ -1679,7 +1679,7 @@ namespace TrilinosWrappers
         indices.resize(graph->NumGlobalIndices(static_cast<TrilinosWrappers::types::int_type>(row)));
         int n_indices = 0;
         graph->ExtractGlobalRowCopy(static_cast<TrilinosWrappers::types::int_type>(row),
-                                    indices.size(), n_indices, &indices[0]);
+                                    indices.size(), n_indices, indices.data());
         AssertDimension(static_cast<unsigned int>(n_indices), indices.size());
 
         for (TrilinosWrappers::types::int_type i=0; i<n_indices; ++i)
index 75284615bb79b67248f2e4ddb6e52b6b20421fd6..98da5f3e1a46cf1faa4c4714001f87495f70d2ed 100644 (file)
@@ -321,7 +321,7 @@ namespace TrilinosWrappers
 
       if (row_map.Comm().NumProc() > 1)
         graph.reset(new Epetra_FECrsGraph(Copy, row_map,
-                                          &local_entries_per_row[0],
+                                          local_entries_per_row.data(),
                                           false
                                           // TODO: Check which new Trilinos
                                           // version supports this... Remember
@@ -333,7 +333,7 @@ namespace TrilinosWrappers
                                          ));
       else
         graph.reset(new Epetra_FECrsGraph(Copy, row_map, col_map,
-                                          &local_entries_per_row[0],
+                                          local_entries_per_row.data(),
                                           false));
     }
 
@@ -373,11 +373,11 @@ namespace TrilinosWrappers
 
       if (row_map.Comm().NumProc() > 1)
         graph.reset(new Epetra_FECrsGraph(Copy, row_map,
-                                          &n_entries_per_row[0],
+                                          n_entries_per_row.data(),
                                           false));
       else
         graph.reset (new Epetra_FECrsGraph(Copy, row_map, col_map,
-                                           &n_entries_per_row[0],
+                                           n_entries_per_row.data(),
                                            false));
 
       AssertDimension (sp.n_rows(),
@@ -407,7 +407,7 @@ namespace TrilinosWrappers
                 }
             }
             graph->Epetra_CrsGraph::InsertGlobalIndices (row, row_length,
-                                                         &row_indices[0]);
+                                                         row_indices.data());
           }
       else
         for (size_type row=0; row<sp.n_rows(); ++row)
@@ -430,7 +430,7 @@ namespace TrilinosWrappers
             }
             graph->InsertGlobalIndices (1,
                                         reinterpret_cast<TrilinosWrappers::types::int_type *>(&row),
-                                        row_length, &row_indices[0]);
+                                        row_length, row_indices.data());
           }
 
       int ierr =
index 5e1d7041fbbb4c9bc22598afd76fad724b0bcfbe..d566f9863c8fe9f2843103e2a1d70df091aefebd 100644 (file)
@@ -298,7 +298,7 @@ namespace TrilinosWrappers
         }
 
       Assert (n_elements == added_elements, ExcInternalError());
-      Epetra_Map new_map (v.size(), n_elements, &global_ids[0], 0,
+      Epetra_Map new_map (v.size(), n_elements, global_ids.data(), 0,
                           v.block(0).vector_partitioner().Comm());
 
       std::shared_ptr<Epetra_FEVector> actual_vec;
index 69b6c14204b080166fcad670a9045bc7284f2ac7..b0ef61090d9dfe3bc183094892d1bf99fc2171e1 100644 (file)
@@ -200,7 +200,7 @@ namespace internal
                 // just send an empty message.
                 if (data.size())
                   {
-                    const int ierr = MPI_Isend(&data[0], data.size()*sizeof(data[0]),
+                    const int ierr = MPI_Isend(data.data(), data.size()*sizeof(data[0]),
                                                MPI_BYTE, dest, 71, tria->get_communicator(),
                                                &*requests.rbegin());
                     AssertThrowMPI(ierr);
@@ -239,7 +239,7 @@ namespace internal
                 Assert(static_cast<int>(count * sizeof(DoFPair)) == len, ExcInternalError());
                 receive_buffer.resize(count);
 
-                void *ptr = &receive_buffer[0];
+                void *ptr = receive_buffer.data();
                 ierr = MPI_Recv(ptr, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG,
                                 tria->get_communicator(), &status);
                 AssertThrowMPI(ierr);
@@ -256,7 +256,7 @@ namespace internal
           // * wait for all MPI_Isend to complete
           if (requests.size() > 0)
             {
-              const int ierr = MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE);
+              const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
               AssertThrowMPI(ierr);
               requests.clear();
             }
index e9b3e25b0aa8048bf4ec121ff646b36eb7462579..1b71be7c91cd4af98f1e995c6c7e963162d98280 100644 (file)
@@ -280,7 +280,7 @@ void MGTransferPrebuilt<VectorType>::build_matrices
                 for (unsigned int i=0; i<dofs_per_cell; ++i)
                   prolongation_matrices[level]->set (dof_indices_child[i],
                                                      dofs_per_cell,
-                                                     &dof_indices_parent[0],
+                                                     dof_indices_parent.data(),
                                                      &prolongation(i,0),
                                                      true);
               }

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.