From e2327be66f651c67479d29ea8825d0d216b8aa9f Mon Sep 17 00:00:00 2001 From: young Date: Thu, 17 Oct 2013 14:18:41 +0000 Subject: [PATCH] Fix test cc. git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@31281 0785d39b-7218-0410-832d-ea1e28bc413d --- .../00-manipulate_petsc_scalar.cc | 10 +++++----- .../00-manipulate_petsc_scalar/cmp/generic | 0 .../00-manipulate_petsc_scalar/generic | 12 ------------ 3 files changed, 5 insertions(+), 17 deletions(-) create mode 100644 tests/petsc_scalar_complex/00-manipulate_petsc_scalar/cmp/generic delete mode 100644 tests/petsc_scalar_complex/00-manipulate_petsc_scalar/generic diff --git a/tests/petsc_scalar_complex/00-manipulate_petsc_scalar.cc b/tests/petsc_scalar_complex/00-manipulate_petsc_scalar.cc index 3c353b83a4..5cab80c1d2 100644 --- a/tests/petsc_scalar_complex/00-manipulate_petsc_scalar.cc +++ b/tests/petsc_scalar_complex/00-manipulate_petsc_scalar.cc @@ -33,7 +33,7 @@ std::ofstream logfile ("00-manipulate_petsc_scalar/output"); // Divide a PETSc complex number by a real number. void divide_petsc_complex_by_a_number () { - PetscScalar alpha = 1.0 + 2.0i; + PetscScalar alpha = 1.0 + 2.0*PETSC_i; const PetscScalar beta = alpha/2.; logfile << " divide a petsc complex by 2.: " @@ -58,7 +58,7 @@ void divide_petsc_complex_by_a_number () // Initialize a std::complex number from an PETSc complex number void make_std_complex_from_petsc_complex () { - const PetscScalar alpha = 1.0 + 2.0i; + const PetscScalar alpha = 1.0 + 2.0*PETSC_i; const std::complex beta = alpha; logfile << " make std::complex from petsc complex: " @@ -89,7 +89,7 @@ void make_petsc_complex_from_std_complex () // Initialize a PETSc complex number directly. void make_petsc_complex () { - const PetscScalar alpha = 1.0 + 2.0i; + const PetscScalar alpha = 1.0 + 2.0*PETSC_i; logfile << " make petsc complex: " << PetscRealPart (alpha) @@ -157,7 +157,7 @@ int main (int argc, char **argv) // then try to use operators to do the same thing - except it // seems to work without(!) logfile << " make std::complex from petsc complex: "; - const PetscScalar alpha2 = 1.0 + 2.0i; + const PetscScalar alpha2 = 1.0 + 2.0*PETSC_i; std::complex number2; number2 += alpha2; @@ -168,7 +168,7 @@ int main (int argc, char **argv) << std::endl; logfile << " make std::complex from petsc complex: "; - const PetscScalar alpha3 = 1.0 - 2.0i; + const PetscScalar alpha3 = 1.0 - 2.0*PETSC_i; number2 += alpha3; logfile << std::real (number2) diff --git a/tests/petsc_scalar_complex/00-manipulate_petsc_scalar/cmp/generic b/tests/petsc_scalar_complex/00-manipulate_petsc_scalar/cmp/generic new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/petsc_scalar_complex/00-manipulate_petsc_scalar/generic b/tests/petsc_scalar_complex/00-manipulate_petsc_scalar/generic deleted file mode 100644 index d76579b0c3..0000000000 --- a/tests/petsc_scalar_complex/00-manipulate_petsc_scalar/generic +++ /dev/null @@ -1,12 +0,0 @@ - - make petsc complex: 0.00000+0.00000i should be 0+0i - make petsc complex: 0.00000+0.00000i should be 0+0i - make petsc complex: 1.00000+2.00000i should be 1+2i - make petsc complex from std::complex: 1.00000+2.00000i - make std::complex from petsc complex: 1.00000+2.00000i - make petsc complex from std::complex: 1.00000+2.00000i should be 1+2i - make std::complex from petsc complex: 1.00000+2.00000i should be 1+2i - make std::complex from petsc complex: 2.00000+0.00000i should be 2+0i - divide a petsc complex by 2.: 0.500000+1.00000i should be 0.5+1i - divide-equals a petsc complex by 2.: 0.500000+1.00000i should be 0.5+1i - -- 2.39.5