]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Change several places to size_type in /test/petsc/
authorkainan.wang <kainan.wang@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 22 Mar 2013 15:15:57 +0000 (15:15 +0000)
committerkainan.wang <kainan.wang@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 22 Mar 2013 15:15:57 +0000 (15:15 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@28989 0785d39b-7218-0410-832d-ea1e28bc413d

tests/petsc/52.cc
tests/petsc/67.cc
tests/petsc/69.cc
tests/petsc/parallel_sparse_matrix_01.cc

index 1bf6aa4832bd65f56adf7c0d1d1241d886c96373..f305e6bcea435e48494ce5de39aff694bd48943d 100644 (file)
@@ -62,8 +62,9 @@ int main (int argc,char **argv)
     {
       PetscInitialize(&argc,&argv,0,0);
       {
-        std::vector<types::global_dof_index> row_lengths (5,
-            static_cast<types::global_dof_index>(3));
+       typedef PETScWrappers::SparseMatrix::size_type size_type;
+       
+        std::vector<size_type> row_lengths (5, 3U);
         row_lengths.back() = 2;
         PETScWrappers::SparseMatrix m (5,5,row_lengths);
         test (m);
index cbb91719e132cd967947d86e3e5d735a354a71ad..7ebe1b3649c5f403972a7e30cd25e7be84228570 100644 (file)
 
 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<N; ++i)
+  const size_type N = m.m();
+  for (size_type i=0; i<N; ++i)
     {
       if (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<N; ++i)
+  for (size_type i=0; i<N; ++i)
     {
       const double s = m.el(N/2,i);
       norm_sqr -= s*s;
     }
-  for (unsigned int i=0; i<N; ++i)
+  for (size_type i=0; i<N; ++i)
     {
       const double s = m.el(N/3,i);
       norm_sqr -= s*s;
     }
-  const types::global_dof_index rows[2] = { N/3, N/2 };
-  m.clear_rows (std::vector<types::global_dof_index>(&rows[0], &rows[2]));
+  const size_type rows[2] = { N/3, N/2 };
+  m.clear_rows (std::vector<size_type>(&rows[0], &rows[2]));
   
   deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
           << std::endl;
index 63bcedb50453a817b57df2f057158cc629c9ccc7..034bcb1b24b221be1f13b1b63f8bb07c05677350 100644 (file)
@@ -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<N; ++i)
+  const size_type N = m.m();
+  for (size_type i=0; i<N; ++i)
     {
       if (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<N; ++i)
+  for (size_type i=0; i<N; ++i)
     {
       const double s = m.el(N/2,i);
       norm_sqr -= s*s;
     }
-  for (unsigned int i=0; i<N; ++i)
+  for (size_type i=0; i<N; ++i)
     {
       const double s = m.el(N/3,i);
       norm_sqr -= s*s;
     }
   norm_sqr += 2*rnd*rnd;
   
-  const types::global_dof_index rows[2] = { N/3, N/2 };
-  m.clear_rows (std::vector<types::global_dof_index>(&rows[0], &rows[2]), rnd);
+  const size_type rows[2] = { N/3, N/2 };
+  m.clear_rows (std::vector<size_type>(&rows[0], &rows[2]), rnd);
   
   deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
           << std::endl;
index ad8b16339edf1c55595e7a7e8da6f466acc5b9d4..bfd737217d0688d24e625a1b86d75784e335ae5f 100644 (file)
@@ -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<types::global_dof_index> local_rows_per_process (get_n_mpi_processes());
-  std::vector<types::global_dof_index> start_row (get_n_mpi_processes());
+  std::vector<size_type> local_rows_per_process (get_n_mpi_processes());
+  std::vector<size_type> start_row (get_n_mpi_processes());
   for (unsigned int i=0; i<get_n_mpi_processes(); ++i)
     {
       N += (i+1)*10;

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.