From 46627f8df44c63f87c952f9a765018adce251b66 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Tue, 29 Mar 2016 07:13:46 +0200 Subject: [PATCH] add an auxiliary function to return real part of PETSc vector element and test that imaginary part is zero --- tests/tests.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/tests.h b/tests/tests.h index 6d8846bcf5..3525a34384 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -64,6 +64,26 @@ using namespace dealii; // ------------------------------ Utility functions used in tests ----------------------- +/** + * A function to return real part of the number and check that + * its imaginary part is zero. + */ +#ifdef DEAL_II_WITH_PETSC +#include +PetscReal get_real_assert_zero_imag(const PETScWrappers::internal::VectorReference &a) +{ + Assert (a.imag() == 0.0, ExcInternalError()); + return a.real(); +} +#endif + +template +number get_real_assert_zero_imag(const number &a) +{ + return a; +} + + // Cygwin has a different implementation for rand() which causes many tests to fail. // This here is a reimplementation that gives the same sequence of numbers as a program // that uses rand() on a typical linux machine. -- 2.39.5