From 3692ab6d19671459071c7eb25ea423c7b45a8a25 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 29 Mar 2016 23:02:58 +0200 Subject: [PATCH] use get_real_assert_zero_imag() instead of PetscRealPart() --- tests/mpi/ghost_01.cc | 12 ++++---- tests/mpi/ghost_02.cc | 28 +++++++++---------- tests/mpi/p4est_save_02.cc | 2 +- tests/mpi/p4est_save_03.cc | 4 +-- tests/mpi/p4est_save_04.cc | 4 +-- tests/mpi/periodicity_01.cc | 14 +++------- tests/mpi/petsc_bug_ghost_vector_01.cc | 4 +-- tests/mpi/petsc_distribute_01.cc | 7 ++--- tests/mpi/petsc_distribute_01_block.cc | 14 ++++------ tests/mpi/petsc_distribute_01_inhomogenous.cc | 19 ++++--------- 10 files changed, 45 insertions(+), 63 deletions(-) diff --git a/tests/mpi/ghost_01.cc b/tests/mpi/ghost_01.cc index 71578edf2b..5a917805c7 100644 --- a/tests/mpi/ghost_01.cc +++ b/tests/mpi/ghost_01.cc @@ -59,18 +59,18 @@ void test () // check local values if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) { - deallog << myid*2 << ":" << PetscRealPart(v(myid*2)) << std::endl; - deallog << myid*2+1 << ":" << PetscRealPart(v(myid*2+1)) << std::endl; + deallog << myid*2 << ":" << get_real_assert_zero_imag(v(myid*2)) << std::endl; + deallog << myid*2+1 << ":" << get_real_assert_zero_imag(v(myid*2+1)) << std::endl; } - Assert(PetscRealPart(v(myid*2)) == myid*4.0, ExcInternalError()); - Assert(PetscRealPart(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v(myid*2)) == myid*4.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError()); // check ghost values if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) - deallog << "ghost: " << PetscRealPart(v(1)) << std::endl; - Assert(PetscRealPart(v(1)) == 2.0, ExcInternalError()); + deallog << "ghost: " << get_real_assert_zero_imag(v(1)) << std::endl; + Assert(get_real_assert_zero_imag(v(1)) == 2.0, ExcInternalError()); // done if (myid==0) diff --git a/tests/mpi/ghost_02.cc b/tests/mpi/ghost_02.cc index 63c02e9863..eaa877b5c6 100644 --- a/tests/mpi/ghost_02.cc +++ b/tests/mpi/ghost_02.cc @@ -52,10 +52,10 @@ void test () vb = a; v2 = vb; if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) - deallog << "ghost: " << PetscRealPart(v2(1)) << std::endl; - Assert(PetscRealPart(v2(1)) == 1.5, ExcInternalError()); - Assert(PetscRealPart(v2(myid*2)) == 1.5, ExcInternalError()); - Assert(PetscRealPart(v2(myid*2+1)) == 1.5, ExcInternalError()); + deallog << "ghost: " << get_real_assert_zero_imag(v2(1)) << std::endl; + Assert(get_real_assert_zero_imag(v2(1)) == 1.5, ExcInternalError()); + Assert(get_real_assert_zero_imag(v2(myid*2)) == 1.5, ExcInternalError()); + Assert(get_real_assert_zero_imag(v2(myid*2+1)) == 1.5, ExcInternalError()); // set local values vb(myid*2)=b; @@ -69,26 +69,26 @@ void test () // check local values if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) { - deallog << myid*2 << ":" << PetscRealPart(v(myid*2)) << std::endl; - deallog << myid*2+1 << ":" << PetscRealPart(v(myid*2+1)) << std::endl; + deallog << myid*2 << ":" << get_real_assert_zero_imag(v(myid*2)) << std::endl; + deallog << myid*2+1 << ":" << get_real_assert_zero_imag(v(myid*2+1)) << std::endl; } - Assert(PetscRealPart(v(myid*2)) == myid*4.0, ExcInternalError()); - Assert(PetscRealPart(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v(myid*2)) == myid*4.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v(myid*2+1)) == myid*4.0+2.0, ExcInternalError()); // check ghost values if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) - deallog << "ghost: " << PetscRealPart(v(1)) << std::endl; - Assert(PetscRealPart(v(1)) == 2.0, ExcInternalError()); + deallog << "ghost: " << get_real_assert_zero_imag(v(1)) << std::endl; + Assert(get_real_assert_zero_imag(v(1)) == 2.0, ExcInternalError()); //assignment from ghosted to ghosted v2 = v; - Assert(PetscRealPart(v2(1)) == 2.0, ExcInternalError()); - Assert(PetscRealPart(v2(myid*2)) == myid*4.0, ExcInternalError()); - Assert(PetscRealPart(v2(myid*2+1)) == myid*4.0+2.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v2(1)) == 2.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v2(myid*2)) == myid*4.0, ExcInternalError()); + Assert(get_real_assert_zero_imag(v2(myid*2+1)) == myid*4.0+2.0, ExcInternalError()); if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) - deallog << "ghost: " << PetscRealPart(v2(1)) << std::endl; + deallog << "ghost: " << get_real_assert_zero_imag(v2(1)) << std::endl; // done if (myid==0) diff --git a/tests/mpi/p4est_save_02.cc b/tests/mpi/p4est_save_02.cc index 26592aab9a..05676d3e44 100644 --- a/tests/mpi/p4est_save_02.cc +++ b/tests/mpi/p4est_save_02.cc @@ -134,7 +134,7 @@ void test() { unsigned int idx = locally_owned_dofs.nth_index_in_set(i); //std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl; - Assert(idx == PetscRealPart(solution(idx)),ExcInternalError()); + Assert(idx == get_real_assert_zero_imag(solution(idx)),ExcInternalError()); } diff --git a/tests/mpi/p4est_save_03.cc b/tests/mpi/p4est_save_03.cc index 723556e71f..bbadf28e9e 100644 --- a/tests/mpi/p4est_save_03.cc +++ b/tests/mpi/p4est_save_03.cc @@ -146,8 +146,8 @@ void test() { unsigned int idx = locally_owned_dofs.nth_index_in_set (i); //std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl; - AssertThrow (idx == PetscRealPart(solution (idx)), ExcInternalError()); - AssertThrow (2*idx == PetscRealPart(solution2 (idx)), ExcInternalError()); + AssertThrow (idx == get_real_assert_zero_imag(solution (idx)), ExcInternalError()); + AssertThrow (2*idx == get_real_assert_zero_imag(solution2 (idx)), ExcInternalError()); } double norm = solution.l1_norm(); diff --git a/tests/mpi/p4est_save_04.cc b/tests/mpi/p4est_save_04.cc index 57d9f278ba..28086449d6 100644 --- a/tests/mpi/p4est_save_04.cc +++ b/tests/mpi/p4est_save_04.cc @@ -88,7 +88,7 @@ void test() { unsigned int idx = locally_owned_dofs.nth_index_in_set (i); x (idx) = idx; - deallog << '[' << idx << ']' << ' ' << PetscRealPart(x(idx)) << std::endl; + deallog << '[' << idx << ']' << ' ' << get_real_assert_zero_imag(x(idx)) << std::endl; } @@ -132,7 +132,7 @@ void test() for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i) { unsigned int idx = locally_owned_dofs.nth_index_in_set (i); - deallog << '[' << idx << ']' << ' ' << PetscRealPart(solution(idx)) << std::endl; + deallog << '[' << idx << ']' << ' ' << get_real_assert_zero_imag(solution(idx)) << std::endl; } deallog << "#cells = " << tr.n_global_active_cells() << std::endl; diff --git a/tests/mpi/periodicity_01.cc b/tests/mpi/periodicity_01.cc index fae79441fb..d645d559de 100644 --- a/tests/mpi/periodicity_01.cc +++ b/tests/mpi/periodicity_01.cc @@ -317,7 +317,7 @@ namespace Step40 for (unsigned int i=0; i1e-8) { std::cout<1e-8) { std::cout<1e-8) { std::cout<