From: Denis Davydov Date: Tue, 29 Mar 2016 05:13:46 +0000 (+0200) Subject: add an auxiliary function to return real part of PETSc vector element and test that... X-Git-Tag: v8.5.0-rc1~1153^2~25 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46627f8df44c63f87c952f9a765018adce251b66;p=dealii.git add an auxiliary function to return real part of PETSc vector element and test that imaginary part is zero --- 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.