]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
udpate test and make it pass
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Oct 2011 15:58:09 +0000 (15:58 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Oct 2011 15:58:09 +0000 (15:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@24603 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/p4est_save_03.cc
tests/mpi/p4est_save_03/ncpu_10/cmp/generic
tests/mpi/p4est_save_03/ncpu_4/cmp/generic

index 03fbbdcdde64ccf026f4db4a9e682dbb2cd570e7..c201e0601676117d99154109a69286dcfc105f63 100644 (file)
@@ -49,46 +49,46 @@ void test()
     deallog << "hyper_cube" << std::endl;
 
   std::string filename =
-      (std::string("p4est_save_03/ncpu_") + Utilities::int_to_string(Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD)) + "/dat");
+    (std::string ("p4est_save_03/ncpu_") + Utilities::int_to_string (Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD)) + "/dat");
   {
-    parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
+    parallel::distributed::Triangulation<dim> tr (MPI_COMM_WORLD);
 
-    GridGenerator::hyper_cube(tr);
+    GridGenerator::hyper_cube (tr);
 
-    tr.refine_global(2);
+    tr.refine_global (2);
     for (typename Triangulation<dim>::active_cell_iterator
-          cell = tr.begin_active();
-        cell != tr.end(); ++cell)
+         cell = tr.begin_active();
+         cell != tr.end(); ++cell)
       if (!cell->is_ghost() && !cell->is_artificial())
-       if (cell->center().norm() < 0.3)
-         {
-           cell->set_refine_flag();
-         }
+        if (cell->center().norm() < 0.3)
+          {
+            cell->set_refine_flag();
+          }
 
     tr.execute_coarsening_and_refinement ();
 
-    FE_Q<dim> fe(1);
-    DoFHandler<dim> dh(tr);
+    FE_Q<dim> fe (1);
+    DoFHandler<dim> dh (tr);
 
-    dh.distribute_dofs(fe);
+    dh.distribute_dofs (fe);
 
     IndexSet locally_owned_dofs = dh.locally_owned_dofs ();
     IndexSet locally_relevant_dofs;
 
-    DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs);
+    DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs);
 
-    PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
-       PETScWrappers::MPI::Vector solution2(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
+    PETScWrappers::MPI::Vector solution (MPI_COMM_WORLD, locally_owned_dofs, locally_relevant_dofs);
+    PETScWrappers::MPI::Vector solution2 (MPI_COMM_WORLD, locally_owned_dofs, locally_relevant_dofs);
 
-    parallel::distributed::SolutionTransfer<dim,PETScWrappers::MPI::Vector> soltrans(dh);
-       parallel::distributed::SolutionTransfer<dim,PETScWrappers::MPI::Vector> soltrans2(dh);
+    parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector> soltrans (dh);
+    parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector> soltrans2 (dh);
 
-    for (unsigned int i=0;i<locally_owned_dofs.n_elements();++i)
+    for (unsigned int i = 0;i < locally_owned_dofs.n_elements();++i)
       {
-       unsigned int idx = locally_owned_dofs.nth_index_in_set(i);
-       solution(idx)=idx;
-       solution2(idx)=2*idx;
-       
+        unsigned int idx = locally_owned_dofs.nth_index_in_set (i);
+        solution (idx) = idx;
+        solution2 (idx) = 2 * idx;
+
 //     std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
       }
 
@@ -96,69 +96,69 @@ void test()
     solution.update_ghost_values();
     solution2.compress();
     solution2.update_ghost_values();
-    
+
     soltrans.prepare_serialization (solution);
     soltrans2.prepare_serialization (solution2);
 
-    tr.save(filename.c_str());
-  
+    tr.save (filename.c_str());
+
     if (myid == 0)
       {
-       deallog << "#cells = " << tr.n_global_active_cells() << std::endl;
-       deallog << "cells(0) = " << tr.n_active_cells() << std::endl;
+        deallog << "#cells = " << tr.n_global_active_cells() << std::endl;
+        deallog << "cells(0) = " << tr.n_active_cells() << std::endl;
       }
     deallog << "Checksum: "
-           << tr.get_checksum ()
-           << std::endl;
-  
+    << tr.get_checksum ()
+    << std::endl;
+
   }
-  MPI_Barrier(MPI_COMM_WORLD);
+  MPI_Barrier (MPI_COMM_WORLD);
 
   {
-    parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
+    parallel::distributed::Triangulation<dim> tr (MPI_COMM_WORLD);
 
-    GridGenerator::hyper_cube(tr);
-    tr.load(filename.c_str());
-    FE_Q<dim> fe(1);
-    DoFHandler<dim> dh(tr);
+    GridGenerator::hyper_cube (tr);
+    tr.load (filename.c_str());
+    FE_Q<dim> fe (1);
+    DoFHandler<dim> dh (tr);
 
-    dh.distribute_dofs(fe);
+    dh.distribute_dofs (fe);
 
     IndexSet locally_owned_dofs = dh.locally_owned_dofs ();
     IndexSet locally_relevant_dofs;
 
-    DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs);
+    DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs);
 
-    PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs);
-       PETScWrappers::MPI::Vector solution2(MPI_COMM_WORLD,locally_owned_dofs);
-    parallel::distributed::SolutionTransfer<dim,PETScWrappers::MPI::Vector> soltrans(dh);
-       parallel::distributed::SolutionTransfer<dim,PETScWrappers::MPI::Vector> soltrans2(dh);
+    PETScWrappers::MPI::Vector solution (MPI_COMM_WORLD, locally_owned_dofs);
+    PETScWrappers::MPI::Vector solution2 (MPI_COMM_WORLD, locally_owned_dofs);
+    parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector> soltrans (dh);
+    parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector> soltrans2 (dh);
     solution = 2;
-    soltrans.deserialize(solution);
-       soltrans2.deserialize(solution2);
-    
-    for (unsigned int i=0;i<locally_owned_dofs.n_elements();++i)
+    soltrans.deserialize (solution);
+    soltrans2.deserialize (solution2);
+
+    for (unsigned int i = 0;i < locally_owned_dofs.n_elements();++i)
       {
-       unsigned int idx = locally_owned_dofs.nth_index_in_set(i);
-       //std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
-       Assert(idx == solution(idx),ExcInternalError());
-       Assert(2*idx == solution(idx),ExcInternalError());
-       
+        unsigned int idx = locally_owned_dofs.nth_index_in_set (i);
+        //std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
+        Assert (idx == solution (idx), ExcInternalError());
+        Assert (2*idx == solution2 (idx), ExcInternalError());
       }
 
     double norm = solution.l1_norm();
+       double norm2 = solution2.l1_norm();
 
     if (myid == 0)
       {
-       deallog << "#cells = " << tr.n_global_active_cells() << std::endl;
-       deallog << "cells(0) = " << tr.n_active_cells() << std::endl;
+        deallog << "#cells = " << tr.n_global_active_cells() << std::endl;
+        deallog << "cells(0) = " << tr.n_active_cells() << std::endl;
       }
     deallog << "Checksum: "
-           << tr.get_checksum ()
-           << std::endl;
+    << tr.get_checksum ()
+    << std::endl;
     deallog << "sum: "
-           << norm
-           << std::endl;
+    << norm << " " << norm2
+    << std::endl;
   }
 
   if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0)
@@ -166,30 +166,30 @@ void test()
 }
 
 
-int main(int argc, char *argv[])
+int main (int argc, char *argv[])
 {
 #ifdef DEAL_II_COMPILER_SUPPORTS_MPI
-  PetscInitialize(&argc,&argv,0,0);
+  PetscInitialize (&argc, &argv, 0, 0);
 
 //  MPI_Init (&argc,&argv);
 #else
-  (void)argc;
-  (void)argv;
+  (void) argc;
+  (void) argv;
 #endif
 
   unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD);
 
 
-  deallog.push(Utilities::int_to_string(myid));
+  deallog.push (Utilities::int_to_string (myid));
 
   if (myid == 0)
     {
-      std::ofstream logfile(output_file_for_mpi("p4est_save_03").c_str());
-      deallog.attach(logfile);
-      deallog.depth_console(0);
-      deallog.threshold_double(1.e-10);
+      std::ofstream logfile (output_file_for_mpi ("p4est_save_03").c_str());
+      deallog.attach (logfile);
+      deallog.depth_console (0);
+      deallog.threshold_double (1.e-10);
 
-      deallog.push("2d");
+      deallog.push ("2d");
       test<2>();
       deallog.pop();
     }
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
 
 
 #ifdef DEAL_II_COMPILER_SUPPORTS_MPI
-                                  //MPI_Finalize();
+  //MPI_Finalize();
   PetscFinalize();
 
 #endif
index 8b71035d8dcc93ddc1357ab83a8f0a0304f9be5e..68c7fbdf19d380d5f8b9d4a9933dda6a4a302508 100644 (file)
@@ -6,5 +6,5 @@ DEAL:0:2d::Checksum: 136119115
 DEAL:0:2d::#cells = 19
 DEAL:0:2d::cells(0) = 1
 DEAL:0:2d::Checksum: 136119115
-DEAL:0:2d::sum: 435.000
+DEAL:0:2d::sum: 435.000 870.000
 DEAL:0:2d::OK
index d6287bcc8999236b6eb817277edd66a14e6e59d1..bf97dfd8ef1af0fc633ff1d3ad2c7fffee1ab00c 100644 (file)
@@ -6,5 +6,5 @@ DEAL:0:2d::Checksum: 136119115
 DEAL:0:2d::#cells = 19
 DEAL:0:2d::cells(0) = 10
 DEAL:0:2d::Checksum: 136119115
-DEAL:0:2d::sum: 435.000
+DEAL:0:2d::sum: 435.000 870.000
 DEAL:0:2d::OK

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.