From fabb8e577e6297f215227b45f64482304af61e4f Mon Sep 17 00:00:00 2001 From: kronbichler Date: Thu, 5 Dec 2013 10:21:17 +0000 Subject: [PATCH] Better test output to avoid log(0). git-svn-id: https://svn.dealii.org/trunk@31895 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/assemble_matrix_parallel_01.cc | 11 ++++----- .../assemble_matrix_parallel_01.output | 24 +++++++++---------- tests/deal.II/assemble_matrix_parallel_02.cc | 17 +++++++------ .../assemble_matrix_parallel_02.output | 12 +++++----- tests/deal.II/assemble_matrix_parallel_03.cc | 7 +++--- .../assemble_matrix_parallel_03.output | 24 +++++++++---------- tests/deal.II/assemble_matrix_parallel_04.cc | 11 ++++----- 7 files changed, 51 insertions(+), 55 deletions(-) diff --git a/tests/deal.II/assemble_matrix_parallel_01.cc b/tests/deal.II/assemble_matrix_parallel_01.cc index e0c511089f..4cd2b17697 100644 --- a/tests/deal.II/assemble_matrix_parallel_01.cc +++ b/tests/deal.II/assemble_matrix_parallel_01.cc @@ -379,14 +379,12 @@ void LaplaceProblem::assemble_test () Assembly::Copy::Data ()); test_matrix.add(-1, reference_matrix); - const double frobenius_norm = test_matrix.frobenius_norm(); - // the data should add up exactly (unfortunately, there is some roundoff due - // to the cell similarity detection, but there should not be any similarity - // for the hypershell geometry) - deallog << "log error in matrix norm: " << std::log(frobenius_norm) << std::endl; + // there should not even be roundoff difference between matrices + deallog.threshold_double(1.e-30); + deallog << "error in matrix: " << test_matrix.frobenius_norm() << std::endl; test_rhs.add(-1., reference_rhs); - deallog << "log error in vector norm: " << std::log(test_rhs.l2_norm()) << std::endl; + deallog << "error in vector: " << test_rhs.l2_norm() << std::endl; } @@ -441,7 +439,6 @@ int main () logfile << std::setprecision (2); deallog.attach(logfile); deallog.depth_console(0); - deallog.threshold_double(1.e-8); { deallog.push("2d"); diff --git a/tests/deal.II/assemble_matrix_parallel_01.output b/tests/deal.II/assemble_matrix_parallel_01.output index 9d2e50eecf..433d3f0316 100644 --- a/tests/deal.II/assemble_matrix_parallel_01.output +++ b/tests/deal.II/assemble_matrix_parallel_01.output @@ -1,13 +1,13 @@ -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf -DEAL:3d::log error in matrix norm: -inf -DEAL:3d::log error in vector norm: -inf -DEAL:3d::log error in matrix norm: -inf -DEAL:3d::log error in vector norm: -inf -DEAL:3d::log error in matrix norm: -inf -DEAL:3d::log error in vector norm: -inf +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 +DEAL:3d::error in matrix norm: 0 +DEAL:3d::error in vector norm: 0 +DEAL:3d::error in matrix norm: 0 +DEAL:3d::error in vector norm: 0 +DEAL:3d::error in matrix norm: 0 +DEAL:3d::error in vector norm: 0 diff --git a/tests/deal.II/assemble_matrix_parallel_02.cc b/tests/deal.II/assemble_matrix_parallel_02.cc index a2cd47d8dc..5f31e94221 100644 --- a/tests/deal.II/assemble_matrix_parallel_02.cc +++ b/tests/deal.II/assemble_matrix_parallel_02.cc @@ -440,19 +440,19 @@ void LaplaceProblem::assemble_test() tasks.join_all(); test_matrix.add(-1, reference_matrix); - const double frobenius_norm = test_matrix.frobenius_norm(); - // the data should add up exactly (unfortunately, there is some roundoff due - // to the cell similarity detection, but there should not be any similarity - // for the hypershell geometry) - deallog << "log error in matrix norm: " << std::log(frobenius_norm) << std::endl; + // there should not even be roundoff difference between matrices + deallog.threshold_double(1.e-30); + deallog << "error in matrix 1: " << test_matrix.frobenius_norm() << std::endl; test_rhs.add(-1., reference_rhs); - deallog << "log error in vector norm: " << std::log(test_rhs.l2_norm()) << std::endl; + deallog << "error in vector 1: " << test_rhs.l2_norm() << std::endl; + // multiplied by PI there can be roundoff differences + deallog.threshold_double(1.e-10); test_matrix_2.add(-numbers::PI, reference_matrix); - deallog << "absolute error matrix assembly 2: " << test_matrix_2.frobenius_norm() << std::endl; + deallog << "error in matrix 2: " << test_matrix_2.frobenius_norm() << std::endl; test_rhs_2.add(-numbers::PI, reference_rhs); - deallog << "absolute error vector assembly 2: " << test_rhs_2.l2_norm() << std::endl; + deallog << "error in vector 2: " << test_rhs_2.l2_norm() << std::endl; } @@ -508,7 +508,6 @@ int main () logfile << std::setprecision (2); deallog.attach(logfile); deallog.depth_console(0); - deallog.threshold_double(1.e-8); { deallog.push("2d"); diff --git a/tests/deal.II/assemble_matrix_parallel_02.output b/tests/deal.II/assemble_matrix_parallel_02.output index 627a39f770..b5bfd0359e 100644 --- a/tests/deal.II/assemble_matrix_parallel_02.output +++ b/tests/deal.II/assemble_matrix_parallel_02.output @@ -1,13 +1,13 @@ -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 DEAL:2d::absolute error matrix assembly 2: 0 DEAL:2d::absolute error vector assembly 2: 0 -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 DEAL:2d::absolute error matrix assembly 2: 0 DEAL:2d::absolute error vector assembly 2: 0 -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 DEAL:2d::absolute error matrix assembly 2: 0 DEAL:2d::absolute error vector assembly 2: 0 diff --git a/tests/deal.II/assemble_matrix_parallel_03.cc b/tests/deal.II/assemble_matrix_parallel_03.cc index a0e1c59be0..158aec8ba7 100644 --- a/tests/deal.II/assemble_matrix_parallel_03.cc +++ b/tests/deal.II/assemble_matrix_parallel_03.cc @@ -387,9 +387,11 @@ void LaplaceProblem::assemble_test () for (unsigned int j=0; j<2; ++j) frobenius_norm += test_matrix.block(i,j).frobenius_norm(); - deallog << "log error in matrix norm: " << std::log(frobenius_norm) << std::endl; + // there should not even be roundoff difference between matrices + deallog.threshold_double(1e-30); + deallog << "error in matrix: " << frobenius_norm << std::endl; test_rhs.add(-1., reference_rhs); - deallog << "log error in vector norm: " << std::log(test_rhs.l2_norm()) << std::endl; + deallog << "error in vector: " << test_rhs.l2_norm() << std::endl; } @@ -444,7 +446,6 @@ int main () logfile << std::setprecision (2); deallog.attach(logfile); deallog.depth_console(0); - deallog.threshold_double(1.e-8); { deallog.push("2d"); diff --git a/tests/deal.II/assemble_matrix_parallel_03.output b/tests/deal.II/assemble_matrix_parallel_03.output index 9d2e50eecf..433d3f0316 100644 --- a/tests/deal.II/assemble_matrix_parallel_03.output +++ b/tests/deal.II/assemble_matrix_parallel_03.output @@ -1,13 +1,13 @@ -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf -DEAL:2d::log error in matrix norm: -inf -DEAL:2d::log error in vector norm: -inf -DEAL:3d::log error in matrix norm: -inf -DEAL:3d::log error in vector norm: -inf -DEAL:3d::log error in matrix norm: -inf -DEAL:3d::log error in vector norm: -inf -DEAL:3d::log error in matrix norm: -inf -DEAL:3d::log error in vector norm: -inf +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 +DEAL:2d::error in matrix norm: 0 +DEAL:2d::error in vector norm: 0 +DEAL:3d::error in matrix norm: 0 +DEAL:3d::error in vector norm: 0 +DEAL:3d::error in matrix norm: 0 +DEAL:3d::error in vector norm: 0 +DEAL:3d::error in matrix norm: 0 +DEAL:3d::error in vector norm: 0 diff --git a/tests/deal.II/assemble_matrix_parallel_04.cc b/tests/deal.II/assemble_matrix_parallel_04.cc index f3f13286ee..9c4d594fbd 100644 --- a/tests/deal.II/assemble_matrix_parallel_04.cc +++ b/tests/deal.II/assemble_matrix_parallel_04.cc @@ -473,15 +473,14 @@ void LaplaceProblem::assemble_test() tasks.join_all(); test_matrix.add(-1, reference_matrix); - const double frobenius_norm = test_matrix.frobenius_norm(); - deallog << "absolute error in matrix norm: " << frobenius_norm << std::endl; + deallog << "error in matrix 1: " << test_matrix.frobenius_norm() << std::endl; test_rhs.add(-1., reference_rhs); - deallog << "absolute error in vector norm: " << test_rhs.l2_norm() << std::endl; + deallog << "error in vector 1: " << test_rhs.l2_norm() << std::endl; test_matrix_2.add(-numbers::PI, reference_matrix); - deallog << "absolute error matrix assembly 2: " << test_matrix_2.frobenius_norm() << std::endl; + deallog << "error in matrix 2: " << test_matrix_2.frobenius_norm() << std::endl; test_rhs_2.add(-numbers::PI, reference_rhs); - deallog << "absolute error vector assembly 2: " << test_rhs_2.l2_norm() << std::endl; + deallog << "error in vector 2: " << test_rhs_2.l2_norm() << std::endl; } @@ -537,7 +536,7 @@ int main () logfile << std::setprecision (2); deallog.attach(logfile); deallog.depth_console(0); - deallog.threshold_double(1.e-8); + deallog.threshold_double(1.e-10); { deallog.push("2d"); -- 2.39.5