]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add an auxiliary function to return real part of PETSc vector element and test that...
authorDenis Davydov <davydden@gmail.com>
Tue, 29 Mar 2016 05:13:46 +0000 (07:13 +0200)
committerDenis Davydov <davydden@gmail.com>
Tue, 29 Mar 2016 18:48:46 +0000 (20:48 +0200)
tests/tests.h

index 6d8846bcf58528deb9d4eca09f9d58fe98a3ce44..3525a34384924fbc3cff79e44d8bfad345d80fe8 100644 (file)
@@ -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 <deal.II/lac/petsc_vector_base.h>
+PetscReal get_real_assert_zero_imag(const PETScWrappers::internal::VectorReference &a)
+{
+  Assert (a.imag() == 0.0, ExcInternalError());
+  return a.real();
+}
+#endif
+
+template<typename number>
+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.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.