From: Kainan Wang Date: Fri, 22 Mar 2013 15:15:57 +0000 (+0000) Subject: Change several places to size_type in /test/petsc/ X-Git-Tag: v8.0.0~316^2~111 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=971c8b3184ed41ac4f77b3b2cee99c480d991c34;p=dealii.git Change several places to size_type in /test/petsc/ git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@28989 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/petsc/52.cc b/tests/petsc/52.cc index 1bf6aa4832..f305e6bcea 100644 --- a/tests/petsc/52.cc +++ b/tests/petsc/52.cc @@ -62,8 +62,9 @@ int main (int argc,char **argv) { PetscInitialize(&argc,&argv,0,0); { - std::vector row_lengths (5, - static_cast(3)); + typedef PETScWrappers::SparseMatrix::size_type size_type; + + std::vector row_lengths (5, 3U); row_lengths.back() = 2; PETScWrappers::SparseMatrix m (5,5,row_lengths); test (m); diff --git a/tests/petsc/67.cc b/tests/petsc/67.cc index cbb91719e1..7ebe1b3649 100644 --- a/tests/petsc/67.cc +++ b/tests/petsc/67.cc @@ -25,14 +25,16 @@ void test (PETScWrappers::MatrixBase &m) { + typedef PETScWrappers::MatrixBase::size_type size_type; + Assert (m.m() != 0, ExcInternalError()); Assert (m.n() != 0, ExcInternalError()); // build a tri-diagonal pattern double norm_sqr = 0; unsigned int nnz = 0; - const unsigned int N = m.m(); - for (unsigned int i=0; i=5) { @@ -67,18 +69,18 @@ void test (PETScWrappers::MatrixBase &m) Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError()); // now remove the entries of rows N/2 and N/3 - for (unsigned int i=0; i(&rows[0], &rows[2])); + const size_type rows[2] = { N/3, N/2 }; + m.clear_rows (std::vector(&rows[0], &rows[2])); deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr) << std::endl; diff --git a/tests/petsc/69.cc b/tests/petsc/69.cc index 63bcedb504..034bcb1b24 100644 --- a/tests/petsc/69.cc +++ b/tests/petsc/69.cc @@ -28,11 +28,13 @@ void test (PETScWrappers::MatrixBase &m) Assert (m.m() != 0, ExcInternalError()); Assert (m.n() != 0, ExcInternalError()); + typedef PETScWrappers::MatrixBase::size_type size_type; + // build a tri-diagonal pattern double norm_sqr = 0; unsigned int nnz = 0; - const unsigned int N = m.m(); - for (unsigned int i=0; i=5) { @@ -69,20 +71,20 @@ void test (PETScWrappers::MatrixBase &m) // now remove the entries of rows N/2 and // N/3. set diagonal entries to rnd const double rnd = rand(); - for (unsigned int i=0; i(&rows[0], &rows[2]), rnd); + const size_type rows[2] = { N/3, N/2 }; + m.clear_rows (std::vector(&rows[0], &rows[2]), rnd); deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr) << std::endl; diff --git a/tests/petsc/parallel_sparse_matrix_01.cc b/tests/petsc/parallel_sparse_matrix_01.cc index ad8b16339e..bfd737217d 100644 --- a/tests/petsc/parallel_sparse_matrix_01.cc +++ b/tests/petsc/parallel_sparse_matrix_01.cc @@ -53,12 +53,14 @@ get_this_mpi_process () void test () { + typedef PETScWrappers::MPI::SparseMatrix::size_type size_type; + // create a parallel matrix where the first // process has 10 rows, the second one 20, // the third one 30, and so on unsigned int N = 0; - std::vector local_rows_per_process (get_n_mpi_processes()); - std::vector start_row (get_n_mpi_processes()); + std::vector local_rows_per_process (get_n_mpi_processes()); + std::vector start_row (get_n_mpi_processes()); for (unsigned int i=0; i