From 53d5be1ffdf70887813cafd7c3bfde676acf312f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 16 Jul 2013 16:41:19 +0000 Subject: [PATCH] Final version of the test. git-svn-id: https://svn.dealii.org/trunk@30012 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/work_stream_03.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/base/work_stream_03.cc b/tests/base/work_stream_03.cc index eec7d02992..0acc74a6ab 100644 --- a/tests/base/work_stream_03.cc +++ b/tests/base/work_stream_03.cc @@ -89,8 +89,17 @@ zero_subrange(const unsigned int begin, const unsigned int end, dst[i] = 0; } + +void +zero_element(std::vector &dst, + const unsigned int i) +{ + dst[i] = 0; +} + + template - void +void mass_assembler(const typename Triangulation::active_cell_iterator &cell, Scratch &data, CopyData ©_data) { @@ -98,25 +107,26 @@ template const Point q = data.x_fe_values.quadrature_point(0); - // this appears to be the key: the following line overwrites some of the memory - // in which we store the quadrature point location. if the line is moved down, - // the comparison in the if() always succeeds... + // this appears to be the key: the following two ways both overwrite some + // of the memory in which we store the quadrature point location. parallel::apply_to_subranges(0U, copy_data.cell_rhs.size(), std_cxx1x::bind(&zero_subrange, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::ref(copy_data.cell_rhs)), 1); - std::cout << (q != data.x_fe_values.quadrature_point(0) ? '.' : '*') - << std::flush; + Assert(q == data.x_fe_values.quadrature_point(0), + ExcInternalError()); copy_data.cell_rhs[0] = value(data.x_fe_values.quadrature_point(0)); } + void copy_local_to_global(const CopyData &data, double *sum) { *sum += data.cell_rhs[0]; } + void do_project() { @@ -141,7 +151,8 @@ do_project() &mass_assembler, std_cxx1x::bind(©_local_to_global, std_cxx1x::_1, &sum), assembler_data, copy_data, 8, 1); - printf("\nCheck: %5.3f\n", sum); + + Assert (std::fabs(sum-288.) < 1e-12, ExcInternalError()); deallog << sum << std::endl; } } -- 2.39.5