From 633af9f85da2e17e91d29c2a9e2baedaa9b2870f Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 20 Sep 2018 16:07:40 +0200 Subject: [PATCH] Test for complex values --- tests/trilinos/tpetra_vector_01.cc | 24 +- tests/trilinos/tpetra_vector_02.cc | 34 ++- tests/trilinos/tpetra_vector_03.cc | 2 + .../trilinos/tpetra_vector_03.mpirun=2.output | 118 +++++++++ .../trilinos/tpetra_vector_03.mpirun=4.output | 246 ++++++++++++++++++ 5 files changed, 402 insertions(+), 22 deletions(-) diff --git a/tests/trilinos/tpetra_vector_01.cc b/tests/trilinos/tpetra_vector_01.cc index ba39dfa34e..a294f78503 100644 --- a/tests/trilinos/tpetra_vector_01.cc +++ b/tests/trilinos/tpetra_vector_01.cc @@ -147,13 +147,13 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 6; ++i) - AssertThrow(2. * read_write_2[i] == read_write_3[i], + AssertThrow(Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in operator *=.")); } else { for (unsigned int i = 4; i < 10; ++i) - AssertThrow(2. * read_write_2[i] == read_write_3[i], + AssertThrow(Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in operator *=.")); } @@ -162,13 +162,13 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 6; ++i) - AssertThrow(0.5 * read_write_2[i] == read_write_3[i], + AssertThrow(Number(0.5) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in operator /=.")); } else { for (unsigned int i = 4; i < 10; ++i) - AssertThrow(0.5 * read_write_2[i] == read_write_3[i], + AssertThrow(Number(0.5) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in operator /=.")); } @@ -177,13 +177,15 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 6; ++i) - AssertThrow(2. * read_write_2[i] + read_write_1[i] == read_write_3[i], + AssertThrow(Number(2.) * read_write_2[i] + read_write_1[i] == + read_write_3[i], ExcMessage("Problem in operator +=.")); } else { for (unsigned int i = 4; i < 10; ++i) - AssertThrow(2. * read_write_2[i] + read_write_1[i] == read_write_3[i], + AssertThrow(Number(2.) * read_write_2[i] + read_write_1[i] == + read_write_3[i], ExcMessage("Problem in operator +=.")); } @@ -192,20 +194,22 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 6; ++i) - AssertThrow(1.5 * read_write_2[i] + read_write_1[i] == read_write_3[i], + AssertThrow(Number(1.5) * read_write_2[i] + read_write_1[i] == + read_write_3[i], ExcMessage("Problem in operator -=.")); } else { for (unsigned int i = 4; i < 10; ++i) - AssertThrow(1.5 * read_write_2[i] + read_write_1[i] == read_write_3[i], + AssertThrow(Number(1.5) * read_write_2[i] + read_write_1[i] == + read_write_3[i], ExcMessage("Problem in operator -=.")); } b.import(read_write_1, VectorOperation::insert); c.import(read_write_1, VectorOperation::insert); const Number val = b * c; - AssertThrow(val == 285., ExcMessage("Problem in operator *.")); + AssertThrow(val == Number(285.), ExcMessage("Problem in operator *.")); } @@ -219,6 +223,8 @@ main(int argc, char **argv) test(); test(); + test>(); + test>(); deallog << "OK" << std::endl; diff --git a/tests/trilinos/tpetra_vector_02.cc b/tests/trilinos/tpetra_vector_02.cc index a775c7ec30..41b62d9a4c 100644 --- a/tests/trilinos/tpetra_vector_02.cc +++ b/tests/trilinos/tpetra_vector_02.cc @@ -88,13 +88,13 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 5; ++i) - AssertThrow(1. + read_write_1[i] == read_write_3[i], + AssertThrow(Number(1.) + read_write_1[i] == read_write_3[i], ExcMessage("Problem in add(scalar).")); } else { for (unsigned int i = 5; i < 10; ++i) - AssertThrow(1. + read_write_1[i] == read_write_3[i], + AssertThrow(Number(1.) + read_write_1[i] == read_write_3[i], ExcMessage("Problem in add(scalar).")); } @@ -103,14 +103,16 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 5; ++i) - AssertThrow(1. + read_write_1[i] + 2. * read_write_2[i] == + AssertThrow(Number(1.) + read_write_1[i] + + Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in add(scalar,Vector).")); } else { for (unsigned int i = 5; i < 10; ++i) - AssertThrow(1. + read_write_1[i] + 2. * read_write_2[i] == + AssertThrow(Number(1.) + read_write_1[i] + + Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in add(scalar,Vector).")); } @@ -122,14 +124,16 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 5; ++i) - AssertThrow(4. + 4. * read_write_1[i] + 10. * read_write_2[i] == + AssertThrow(Number(4.) + Number(4.) * read_write_1[i] + + Number(10.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in add(scalar,Vector,scalar,Vector).")); } else { for (unsigned int i = 5; i < 10; ++i) - AssertThrow(4. + 4. * read_write_1[i] + 10. * read_write_2[i] == + AssertThrow(Number(4.) + Number(4.) * read_write_1[i] + + Number(10.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in add(scalar,Vector,scalar,Vector).")); } @@ -141,14 +145,16 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 5; ++i) - AssertThrow(3. * read_write_1[i] + 2. * read_write_2[i] == + AssertThrow(Number(3.) * read_write_1[i] + + Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in sadd(scalar,scalar,Vector).")); } else { for (unsigned int i = 5; i < 10; ++i) - AssertThrow(3. * read_write_1[i] + 2. * read_write_2[i] == + AssertThrow(Number(3.) * read_write_1[i] + + Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in sadd(scalar,scalar,Vector).")); } @@ -176,28 +182,28 @@ test() if (rank == 0) { for (unsigned int i = 0; i < 5; ++i) - AssertThrow(2. * read_write_2[i] == read_write_3[i], + AssertThrow(Number(2.) * read_write_2[i] == read_write_3[i], ExcMessage("Problem in scale.")); } else { for (unsigned int i = 5; i < 10; ++i) - AssertThrow(2. * read_write_2[i] == read_write_3[i], + AssertThrow((Number)2. * read_write_2[i] == read_write_3[i], ExcMessage("Problem in equ.")); } AssertThrow(b.l1_norm() == 95., ExcMessage("Problem in l1_norm.")); - const Number eps = 1e-6; - AssertThrow(std::fabs(b.l2_norm() - 31.3847096) < eps, + const double eps = 1e-6; + AssertThrow(std::fabs(b.l2_norm() - Number(31.3847096)) < eps, ExcMessage("Problem in l2_norm")); AssertThrow(b.linfty_norm() == 14., ExcMessage("Problem in linfty_norm.")); a.import(read_write_1, VectorOperation::insert); const Number val = a.add_and_dot(2., a, b); - AssertThrow(val == 1530., ExcMessage("Problem in add_and_dot")); + AssertThrow(val == Number(1530.), ExcMessage("Problem in add_and_dot")); } @@ -211,6 +217,8 @@ main(int argc, char **argv) test(); test(); + test>(); + test>(); deallog << "OK" << std::endl; diff --git a/tests/trilinos/tpetra_vector_03.cc b/tests/trilinos/tpetra_vector_03.cc index 650296a491..d97b8ce13a 100644 --- a/tests/trilinos/tpetra_vector_03.cc +++ b/tests/trilinos/tpetra_vector_03.cc @@ -101,4 +101,6 @@ main(int argc, char **argv) MPILogInitAll log; test(); test(); + test>(); + test>(); } diff --git a/tests/trilinos/tpetra_vector_03.mpirun=2.output b/tests/trilinos/tpetra_vector_03.mpirun=2.output index e94f192176..0a598a5c3b 100644 --- a/tests/trilinos/tpetra_vector_03.mpirun=2.output +++ b/tests/trilinos/tpetra_vector_03.mpirun=2.output @@ -63,6 +63,70 @@ IndexSet: {[0,2]} [0]: 4.000e+00 [1]: 2.000e+02 [2]: 1.000e+02 +DEAL:0::Tpetra first import add: +(2.000e+00,0.000e+00) (1.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (1.000e+00,0.000e+00) +[1]: (1.000e+02,0.000e+00) +[2]: (1.000e+01,0.000e+00) +DEAL:0::Tpetra second import add: +(4.000e+00,0.000e+00) (2.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (2.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (2.000e+01,0.000e+00) +DEAL:0::ReadWrite import add: +IndexSet: {[0,2]} + +[0]: (6.000e+00,0.000e+00) +[1]: (4.000e+02,0.000e+00) +[2]: (5.000e+01,0.000e+00) +DEAL:0::ReadWrite import min: +IndexSet: {[0,2]} + +[0]: (4.000e+00,0.000e+00) +[1]: (1.000e+00,0.000e+00) +[2]: (3.000e+01,0.000e+00) +DEAL:0::ReadWrite import max: +IndexSet: {[0,2]} + +[0]: (4.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (1.000e+02,0.000e+00) +DEAL:0::Tpetra first import add: +(2.000e+00,0.000e+00) (1.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (1.000e+00,0.000e+00) +[1]: (1.000e+02,0.000e+00) +[2]: (1.000e+01,0.000e+00) +DEAL:0::Tpetra second import add: +(4.000e+00,0.000e+00) (2.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (2.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (2.000e+01,0.000e+00) +DEAL:0::ReadWrite import add: +IndexSet: {[0,2]} + +[0]: (6.000e+00,0.000e+00) +[1]: (4.000e+02,0.000e+00) +[2]: (5.000e+01,0.000e+00) +DEAL:0::ReadWrite import min: +IndexSet: {[0,2]} + +[0]: (4.000e+00,0.000e+00) +[1]: (1.000e+00,0.000e+00) +[2]: (3.000e+01,0.000e+00) +DEAL:0::ReadWrite import max: +IndexSet: {[0,2]} + +[0]: (4.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (1.000e+02,0.000e+00) DEAL:1::Tpetra first import add: 1.000e+01 1.010e+02 @@ -118,4 +182,58 @@ IndexSet: {0, 3} [0]: 4.000e+00 [3]: 2.010e+02 +DEAL:1::Tpetra first import add: +(1.000e+01,0.000e+00) (1.010e+02,0.000e+00) +IndexSet: {0, 3} + +[0]: (1.000e+00,0.000e+00) +[3]: (1.010e+02,0.000e+00) +DEAL:1::Tpetra second import add: +(3.000e+01,0.000e+00) (2.010e+02,0.000e+00) +IndexSet: {0, 3} + +[0]: (2.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +DEAL:1::ReadWrite import add: +IndexSet: {0, 3} + +[0]: (6.000e+00,0.000e+00) +[3]: (4.020e+02,0.000e+00) +DEAL:1::ReadWrite import min: +IndexSet: {0, 3} + +[0]: (4.000e+00,0.000e+00) +[3]: (1.000e+00,0.000e+00) +DEAL:1::ReadWrite import max: +IndexSet: {0, 3} + +[0]: (4.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +DEAL:1::Tpetra first import add: +(1.000e+01,0.000e+00) (1.010e+02,0.000e+00) +IndexSet: {0, 3} + +[0]: (1.000e+00,0.000e+00) +[3]: (1.010e+02,0.000e+00) +DEAL:1::Tpetra second import add: +(3.000e+01,0.000e+00) (2.010e+02,0.000e+00) +IndexSet: {0, 3} + +[0]: (2.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +DEAL:1::ReadWrite import add: +IndexSet: {0, 3} + +[0]: (6.000e+00,0.000e+00) +[3]: (4.020e+02,0.000e+00) +DEAL:1::ReadWrite import min: +IndexSet: {0, 3} + +[0]: (4.000e+00,0.000e+00) +[3]: (1.000e+00,0.000e+00) +DEAL:1::ReadWrite import max: +IndexSet: {0, 3} + +[0]: (4.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) diff --git a/tests/trilinos/tpetra_vector_03.mpirun=4.output b/tests/trilinos/tpetra_vector_03.mpirun=4.output index 5fbf8dea2d..a65e3464e6 100644 --- a/tests/trilinos/tpetra_vector_03.mpirun=4.output +++ b/tests/trilinos/tpetra_vector_03.mpirun=4.output @@ -63,6 +63,70 @@ IndexSet: {[0,2]} [0]: 8.000e+00 [1]: 2.000e+02 [2]: 1.000e+02 +DEAL:0::Tpetra first import add: +(4.000e+00,0.000e+00) (1.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (1.000e+00,0.000e+00) +[1]: (1.000e+02,0.000e+00) +[2]: (1.000e+01,0.000e+00) +DEAL:0::Tpetra second import add: +(8.000e+00,0.000e+00) (2.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (2.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (2.000e+01,0.000e+00) +DEAL:0::ReadWrite import add: +IndexSet: {[0,2]} + +[0]: (1.000e+01,0.000e+00) +[1]: (4.000e+02,0.000e+00) +[2]: (5.000e+01,0.000e+00) +DEAL:0::ReadWrite import min: +IndexSet: {[0,2]} + +[0]: (4.000e+00,0.000e+00) +[1]: (1.000e+00,0.000e+00) +[2]: (3.000e+01,0.000e+00) +DEAL:0::ReadWrite import max: +IndexSet: {[0,2]} + +[0]: (8.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (1.000e+02,0.000e+00) +DEAL:0::Tpetra first import add: +(4.000e+00,0.000e+00) (1.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (1.000e+00,0.000e+00) +[1]: (1.000e+02,0.000e+00) +[2]: (1.000e+01,0.000e+00) +DEAL:0::Tpetra second import add: +(8.000e+00,0.000e+00) (2.000e+02,0.000e+00) +IndexSet: {[0,2]} + +[0]: (2.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (2.000e+01,0.000e+00) +DEAL:0::ReadWrite import add: +IndexSet: {[0,2]} + +[0]: (1.000e+01,0.000e+00) +[1]: (4.000e+02,0.000e+00) +[2]: (5.000e+01,0.000e+00) +DEAL:0::ReadWrite import min: +IndexSet: {[0,2]} + +[0]: (4.000e+00,0.000e+00) +[1]: (1.000e+00,0.000e+00) +[2]: (3.000e+01,0.000e+00) +DEAL:0::ReadWrite import max: +IndexSet: {[0,2]} + +[0]: (8.000e+00,0.000e+00) +[1]: (2.000e+02,0.000e+00) +[2]: (1.000e+02,0.000e+00) DEAL:1::Tpetra first import add: 1.000e+01 1.010e+02 @@ -128,6 +192,70 @@ IndexSet: {0, [3,4]} [0]: 8.000e+00 [3]: 2.010e+02 [4]: 1.010e+02 +DEAL:1::Tpetra first import add: +(1.000e+01,0.000e+00) (1.010e+02,0.000e+00) +IndexSet: {0, [3,4]} + +[0]: (1.000e+00,0.000e+00) +[3]: (1.010e+02,0.000e+00) +[4]: (1.100e+01,0.000e+00) +DEAL:1::Tpetra second import add: +(3.000e+01,0.000e+00) (2.010e+02,0.000e+00) +IndexSet: {0, [3,4]} + +[0]: (2.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +[4]: (2.100e+01,0.000e+00) +DEAL:1::ReadWrite import add: +IndexSet: {0, [3,4]} + +[0]: (1.000e+01,0.000e+00) +[3]: (4.020e+02,0.000e+00) +[4]: (5.300e+01,0.000e+00) +DEAL:1::ReadWrite import min: +IndexSet: {0, [3,4]} + +[0]: (4.000e+00,0.000e+00) +[3]: (1.000e+00,0.000e+00) +[4]: (3.200e+01,0.000e+00) +DEAL:1::ReadWrite import max: +IndexSet: {0, [3,4]} + +[0]: (8.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +[4]: (1.010e+02,0.000e+00) +DEAL:1::Tpetra first import add: +(1.000e+01,0.000e+00) (1.010e+02,0.000e+00) +IndexSet: {0, [3,4]} + +[0]: (1.000e+00,0.000e+00) +[3]: (1.010e+02,0.000e+00) +[4]: (1.100e+01,0.000e+00) +DEAL:1::Tpetra second import add: +(3.000e+01,0.000e+00) (2.010e+02,0.000e+00) +IndexSet: {0, [3,4]} + +[0]: (2.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +[4]: (2.100e+01,0.000e+00) +DEAL:1::ReadWrite import add: +IndexSet: {0, [3,4]} + +[0]: (1.000e+01,0.000e+00) +[3]: (4.020e+02,0.000e+00) +[4]: (5.300e+01,0.000e+00) +DEAL:1::ReadWrite import min: +IndexSet: {0, [3,4]} + +[0]: (4.000e+00,0.000e+00) +[3]: (1.000e+00,0.000e+00) +[4]: (3.200e+01,0.000e+00) +DEAL:1::ReadWrite import max: +IndexSet: {0, [3,4]} + +[0]: (8.000e+00,0.000e+00) +[3]: (2.010e+02,0.000e+00) +[4]: (1.010e+02,0.000e+00) DEAL:2::Tpetra first import add: @@ -194,6 +322,70 @@ IndexSet: {0, [5,6]} [0]: 8.000e+00 [5]: 2.020e+02 [6]: 1.020e+02 +DEAL:2::Tpetra first import add: +(1.100e+01,0.000e+00) (1.020e+02,0.000e+00) +IndexSet: {0, [5,6]} + +[0]: (1.000e+00,0.000e+00) +[5]: (1.020e+02,0.000e+00) +[6]: (1.200e+01,0.000e+00) +DEAL:2::Tpetra second import add: +(3.200e+01,0.000e+00) (2.020e+02,0.000e+00) +IndexSet: {0, [5,6]} + +[0]: (2.000e+00,0.000e+00) +[5]: (2.020e+02,0.000e+00) +[6]: (2.200e+01,0.000e+00) +DEAL:2::ReadWrite import add: +IndexSet: {0, [5,6]} + +[0]: (1.000e+01,0.000e+00) +[5]: (4.040e+02,0.000e+00) +[6]: (5.600e+01,0.000e+00) +DEAL:2::ReadWrite import min: +IndexSet: {0, [5,6]} + +[0]: (4.000e+00,0.000e+00) +[5]: (1.000e+00,0.000e+00) +[6]: (3.400e+01,0.000e+00) +DEAL:2::ReadWrite import max: +IndexSet: {0, [5,6]} + +[0]: (8.000e+00,0.000e+00) +[5]: (2.020e+02,0.000e+00) +[6]: (1.020e+02,0.000e+00) +DEAL:2::Tpetra first import add: +(1.100e+01,0.000e+00) (1.020e+02,0.000e+00) +IndexSet: {0, [5,6]} + +[0]: (1.000e+00,0.000e+00) +[5]: (1.020e+02,0.000e+00) +[6]: (1.200e+01,0.000e+00) +DEAL:2::Tpetra second import add: +(3.200e+01,0.000e+00) (2.020e+02,0.000e+00) +IndexSet: {0, [5,6]} + +[0]: (2.000e+00,0.000e+00) +[5]: (2.020e+02,0.000e+00) +[6]: (2.200e+01,0.000e+00) +DEAL:2::ReadWrite import add: +IndexSet: {0, [5,6]} + +[0]: (1.000e+01,0.000e+00) +[5]: (4.040e+02,0.000e+00) +[6]: (5.600e+01,0.000e+00) +DEAL:2::ReadWrite import min: +IndexSet: {0, [5,6]} + +[0]: (4.000e+00,0.000e+00) +[5]: (1.000e+00,0.000e+00) +[6]: (3.400e+01,0.000e+00) +DEAL:2::ReadWrite import max: +IndexSet: {0, [5,6]} + +[0]: (8.000e+00,0.000e+00) +[5]: (2.020e+02,0.000e+00) +[6]: (1.020e+02,0.000e+00) DEAL:3::Tpetra first import add: @@ -250,4 +442,58 @@ IndexSet: {0, 7} [0]: 8.000e+00 [7]: 2.030e+02 +DEAL:3::Tpetra first import add: +(1.200e+01,0.000e+00) (1.030e+02,0.000e+00) +IndexSet: {0, 7} + +[0]: (1.000e+00,0.000e+00) +[7]: (1.030e+02,0.000e+00) +DEAL:3::Tpetra second import add: +(3.400e+01,0.000e+00) (2.030e+02,0.000e+00) +IndexSet: {0, 7} + +[0]: (2.000e+00,0.000e+00) +[7]: (2.030e+02,0.000e+00) +DEAL:3::ReadWrite import add: +IndexSet: {0, 7} + +[0]: (1.000e+01,0.000e+00) +[7]: (4.060e+02,0.000e+00) +DEAL:3::ReadWrite import min: +IndexSet: {0, 7} + +[0]: (4.000e+00,0.000e+00) +[7]: (1.000e+00,0.000e+00) +DEAL:3::ReadWrite import max: +IndexSet: {0, 7} + +[0]: (8.000e+00,0.000e+00) +[7]: (2.030e+02,0.000e+00) +DEAL:3::Tpetra first import add: +(1.200e+01,0.000e+00) (1.030e+02,0.000e+00) +IndexSet: {0, 7} + +[0]: (1.000e+00,0.000e+00) +[7]: (1.030e+02,0.000e+00) +DEAL:3::Tpetra second import add: +(3.400e+01,0.000e+00) (2.030e+02,0.000e+00) +IndexSet: {0, 7} + +[0]: (2.000e+00,0.000e+00) +[7]: (2.030e+02,0.000e+00) +DEAL:3::ReadWrite import add: +IndexSet: {0, 7} + +[0]: (1.000e+01,0.000e+00) +[7]: (4.060e+02,0.000e+00) +DEAL:3::ReadWrite import min: +IndexSet: {0, 7} + +[0]: (4.000e+00,0.000e+00) +[7]: (1.000e+00,0.000e+00) +DEAL:3::ReadWrite import max: +IndexSet: {0, 7} + +[0]: (8.000e+00,0.000e+00) +[7]: (2.030e+02,0.000e+00) -- 2.39.5