From 3bbfa4eb900496013b28e6fa96bf42d94ad29d34 Mon Sep 17 00:00:00 2001 From: heister Date: Wed, 27 Mar 2013 14:53:45 +0000 Subject: [PATCH] switch more tests to MPI_InitFinalize git-svn-id: https://svn.dealii.org/trunk@29074 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/compute_mean_value.cc | 10 +--------- tests/mpi/constraint_matrix_trilinos_bug.cc | 10 +--------- tests/mpi/count_dofs_per_block_01.cc | 10 +--------- tests/mpi/count_dofs_per_block_02.cc | 10 +--------- tests/mpi/count_dofs_per_component_01.cc | 10 +--------- tests/mpi/crash_01.cc | 13 ++----------- tests/mpi/crash_02.cc | 10 +--------- tests/mpi/crash_03.cc | 11 +---------- tests/mpi/crash_04.cc | 10 +--------- tests/mpi/dof_handler_number_cache.cc | 10 +--------- tests/mpi/extract_boundary_dofs.cc | 10 +--------- tests/mpi/extract_constant_modes_01.cc | 12 +----------- tests/mpi/extract_locally_active_dofs.cc | 10 +--------- tests/mpi/integrate_difference.cc | 10 +--------- tests/mpi/interpolate_03.cc | 10 +--------- tests/mpi/is_locally_owned.cc | 13 ++----------- tests/mpi/make_zero_boundary_values.cc | 10 +--------- tests/mpi/map_dofs_to_support_points.cc | 10 +--------- tests/mpi/mg_01.cc | 10 +--------- tests/mpi/mg_02.cc | 10 +--------- tests/mpi/mg_03.cc | 10 +--------- tests/mpi/p4est_2d_coarse_01.cc | 11 +---------- tests/mpi/p4est_2d_constraintmatrix_01.cc | 10 +--------- tests/mpi/p4est_2d_constraintmatrix_02.cc | 10 +--------- 24 files changed, 26 insertions(+), 224 deletions(-) diff --git a/tests/mpi/compute_mean_value.cc b/tests/mpi/compute_mean_value.cc index dd9d65c3e8..80c057b7ec 100644 --- a/tests/mpi/compute_mean_value.cc +++ b/tests/mpi/compute_mean_value.cc @@ -88,12 +88,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -126,7 +121,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/constraint_matrix_trilinos_bug.cc b/tests/mpi/constraint_matrix_trilinos_bug.cc index 4f5cff4680..393fbabd5c 100644 --- a/tests/mpi/constraint_matrix_trilinos_bug.cc +++ b/tests/mpi/constraint_matrix_trilinos_bug.cc @@ -187,12 +187,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -213,7 +208,4 @@ int main(int argc, char *argv[]) else test<2>(); -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/count_dofs_per_block_01.cc b/tests/mpi/count_dofs_per_block_01.cc index 1d72b80e90..3e78f68768 100644 --- a/tests/mpi/count_dofs_per_block_01.cc +++ b/tests/mpi/count_dofs_per_block_01.cc @@ -62,12 +62,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -91,7 +86,4 @@ int main(int argc, char *argv[]) test<3>(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/count_dofs_per_block_02.cc b/tests/mpi/count_dofs_per_block_02.cc index af7269705f..9278c2dd8b 100644 --- a/tests/mpi/count_dofs_per_block_02.cc +++ b/tests/mpi/count_dofs_per_block_02.cc @@ -105,12 +105,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -134,7 +129,4 @@ int main(int argc, char *argv[]) test<3>(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/count_dofs_per_component_01.cc b/tests/mpi/count_dofs_per_component_01.cc index 62c67c6abf..e5b25aa563 100644 --- a/tests/mpi/count_dofs_per_component_01.cc +++ b/tests/mpi/count_dofs_per_component_01.cc @@ -71,12 +71,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -100,7 +95,4 @@ int main(int argc, char *argv[]) test<3>(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/crash_01.cc b/tests/mpi/crash_01.cc index b1808ac474..8f4db6a284 100644 --- a/tests/mpi/crash_01.cc +++ b/tests/mpi/crash_01.cc @@ -57,13 +57,8 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif - + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) { @@ -80,8 +75,4 @@ int main(int argc, char *argv[]) { test<2>(); } - -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/crash_02.cc b/tests/mpi/crash_02.cc index aa2ebd426c..fb97d61692 100644 --- a/tests/mpi/crash_02.cc +++ b/tests/mpi/crash_02.cc @@ -52,12 +52,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -78,7 +73,4 @@ int main(int argc, char *argv[]) test<2>(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/crash_03.cc b/tests/mpi/crash_03.cc index be61fe3b19..8050d7925d 100644 --- a/tests/mpi/crash_03.cc +++ b/tests/mpi/crash_03.cc @@ -82,12 +82,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -107,8 +102,4 @@ int main(int argc, char *argv[]) { test<2>(); } - -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/crash_04.cc b/tests/mpi/crash_04.cc index 6bc41068fc..652301f2b7 100644 --- a/tests/mpi/crash_04.cc +++ b/tests/mpi/crash_04.cc @@ -105,12 +105,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -131,7 +126,4 @@ int main(int argc, char *argv[]) test<2>(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/dof_handler_number_cache.cc b/tests/mpi/dof_handler_number_cache.cc index 32d80085d0..6b7002f64f 100644 --- a/tests/mpi/dof_handler_number_cache.cc +++ b/tests/mpi/dof_handler_number_cache.cc @@ -130,12 +130,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) @@ -159,7 +154,4 @@ int main(int argc, char *argv[]) test<3>(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/extract_boundary_dofs.cc b/tests/mpi/extract_boundary_dofs.cc index 306d81fcfe..62375417ba 100644 --- a/tests/mpi/extract_boundary_dofs.cc +++ b/tests/mpi/extract_boundary_dofs.cc @@ -59,12 +59,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -97,7 +92,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/extract_constant_modes_01.cc b/tests/mpi/extract_constant_modes_01.cc index 95ac8f974a..fffc73da49 100644 --- a/tests/mpi/extract_constant_modes_01.cc +++ b/tests/mpi/extract_constant_modes_01.cc @@ -98,16 +98,10 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); - deallog.push(Utilities::int_to_string(myid)); if (myid == 0) @@ -127,8 +121,4 @@ int main(int argc, char *argv[]) test<2>(); deallog.pop(); } - -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/extract_locally_active_dofs.cc b/tests/mpi/extract_locally_active_dofs.cc index 6d5fcff8a2..8a7855a426 100644 --- a/tests/mpi/extract_locally_active_dofs.cc +++ b/tests/mpi/extract_locally_active_dofs.cc @@ -75,12 +75,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -113,7 +108,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/integrate_difference.cc b/tests/mpi/integrate_difference.cc index 6c63b55ac3..640a5a1b2b 100644 --- a/tests/mpi/integrate_difference.cc +++ b/tests/mpi/integrate_difference.cc @@ -109,12 +109,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -147,7 +142,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/interpolate_03.cc b/tests/mpi/interpolate_03.cc index c41a2236eb..25c8533c0d 100644 --- a/tests/mpi/interpolate_03.cc +++ b/tests/mpi/interpolate_03.cc @@ -81,12 +81,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -119,7 +114,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/is_locally_owned.cc b/tests/mpi/is_locally_owned.cc index 4cb7374704..f529465424 100644 --- a/tests/mpi/is_locally_owned.cc +++ b/tests/mpi/is_locally_owned.cc @@ -81,12 +81,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -106,9 +101,5 @@ int main(int argc, char *argv[]) } else test<2>(); - - -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif + } diff --git a/tests/mpi/make_zero_boundary_values.cc b/tests/mpi/make_zero_boundary_values.cc index 2ea650dcef..d462093411 100644 --- a/tests/mpi/make_zero_boundary_values.cc +++ b/tests/mpi/make_zero_boundary_values.cc @@ -64,12 +64,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -102,7 +97,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/map_dofs_to_support_points.cc b/tests/mpi/map_dofs_to_support_points.cc index 027f531d2c..fce981619e 100644 --- a/tests/mpi/map_dofs_to_support_points.cc +++ b/tests/mpi/map_dofs_to_support_points.cc @@ -71,12 +71,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -109,7 +104,4 @@ int main(int argc, char *argv[]) deallog.pop(); } -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/mg_01.cc b/tests/mpi/mg_01.cc index 9424fcd472..e9654a9df9 100644 --- a/tests/mpi/mg_01.cc +++ b/tests/mpi/mg_01.cc @@ -124,12 +124,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -150,7 +145,4 @@ int main(int argc, char *argv[]) else test<2>(); -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/mg_02.cc b/tests/mpi/mg_02.cc index 79fc94b6ed..8e9938372b 100644 --- a/tests/mpi/mg_02.cc +++ b/tests/mpi/mg_02.cc @@ -124,12 +124,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -150,7 +145,4 @@ int main(int argc, char *argv[]) else test<2>(); -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/mg_03.cc b/tests/mpi/mg_03.cc index 734d90fd6c..3a14741b65 100644 --- a/tests/mpi/mg_03.cc +++ b/tests/mpi/mg_03.cc @@ -125,12 +125,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -151,7 +146,4 @@ int main(int argc, char *argv[]) else test<2>(); -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/p4est_2d_coarse_01.cc b/tests/mpi/p4est_2d_coarse_01.cc index 20481bf047..ca4bf381e7 100644 --- a/tests/mpi/p4est_2d_coarse_01.cc +++ b/tests/mpi/p4est_2d_coarse_01.cc @@ -90,12 +90,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -116,8 +111,4 @@ int main(int argc, char *argv[]) else test<2>(); - -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/p4est_2d_constraintmatrix_01.cc b/tests/mpi/p4est_2d_constraintmatrix_01.cc index 0e78ee7dcd..943cc41925 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_01.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_01.cc @@ -91,12 +91,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -117,7 +112,4 @@ int main(int argc, char *argv[]) else test<2>(); -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } diff --git a/tests/mpi/p4est_2d_constraintmatrix_02.cc b/tests/mpi/p4est_2d_constraintmatrix_02.cc index c45b793d3b..5df85c6213 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_02.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_02.cc @@ -91,12 +91,7 @@ void test() int main(int argc, char *argv[]) { -#ifdef DEAL_II_WITH_MPI - MPI_Init (&argc,&argv); -#else - (void)argc; - (void)argv; -#endif + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); @@ -117,7 +112,4 @@ int main(int argc, char *argv[]) else test<2>(); -#ifdef DEAL_II_WITH_MPI - MPI_Finalize(); -#endif } -- 2.39.5