From bb1844bc1841245c32dd31ddb694fa7ed2534c1a Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Mon, 28 Mar 2016 20:28:36 +0200 Subject: [PATCH] extend mpi/petsc_distribute_01_block to complex-valued PETSc --- tests/mpi/petsc_distribute_01_block.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/mpi/petsc_distribute_01_block.cc b/tests/mpi/petsc_distribute_01_block.cc index 441480e2a9..fc176c4afc 100644 --- a/tests/mpi/petsc_distribute_01_block.cc +++ b/tests/mpi/petsc_distribute_01_block.cc @@ -112,19 +112,19 @@ void test() // verify correctness if (myid != 0) - AssertThrow (vec(vec.block(0).local_range().first+10) == vec.block(0).local_range().first-25, + AssertThrow (PetscRealPart(vec(vec.block(0).local_range().first+10)) == vec.block(0).local_range().first-25, ExcInternalError()); if (myid != n_processes-1) - AssertThrow (vec(vec.block(0).local_range().first+90) == vec.block(0).local_range().first+105, + AssertThrow (PetscRealPart(vec(vec.block(0).local_range().first+90)) == vec.block(0).local_range().first+105, ExcInternalError()); if (myid != 0) - AssertThrow (vec(vec.block(0).size()+vec.block(1).local_range().first+10) == vec.block(1).local_range().first-25, + AssertThrow (PetscRealPart(vec(vec.block(0).size()+vec.block(1).local_range().first+10)) == vec.block(1).local_range().first-25, ExcInternalError()); if (myid != n_processes-1) - AssertThrow (vec(vec.block(0).size()+vec.block(1).local_range().first+90) == vec.block(1).local_range().first+105, + AssertThrow (PetscRealPart(vec(vec.block(0).size()+vec.block(1).local_range().first+90)) == vec.block(1).local_range().first+105, ExcInternalError()); @@ -134,8 +134,9 @@ void test() && (i != vec.block(0).local_range().first+90)) { - double val = vec.block(0)(i); - AssertThrow (std::fabs(val - i) <= 1e-6, ExcInternalError()); + PetscScalar val = vec.block(0)(i); + AssertThrow (std::fabs(PetscRealPart(val) - i) <= 1e-6, ExcInternalError()); + AssertThrow (PetscImaginaryPart(val) == 0.0, ExcInternalError()); } } for (unsigned int i=vec.block(1).local_range().first; i