From b32e7920f652c9357ffffdf58511ceb6ca8724b8 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 4 Jul 2013 03:00:42 +0000 Subject: [PATCH] Further simplify. git-svn-id: https://svn.dealii.org/trunk@29935 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/work_stream_03.cc | 48 ++++++++++++++---------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/tests/base/work_stream_03.cc b/tests/base/work_stream_03.cc index eb6dc88d5c..954c4b4ef3 100644 --- a/tests/base/work_stream_03.cc +++ b/tests/base/work_stream_03.cc @@ -49,6 +49,7 @@ #include #include +#include using namespace dealii; @@ -61,9 +62,9 @@ template class F : public Function { public: - F (const unsigned int q) + F () : - q(q) + q(1) {} virtual double value (const Point &p, @@ -83,45 +84,35 @@ class F : public Function template -void do_project (const Triangulation &triangulation, - const unsigned int p) +void do_project (const unsigned int p) { + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation); + triangulation.refine_global (3); + std::cout << "Start: " << __PRETTY_FUNCTION__ << ' ' << p << std::endl; FE_Q fe(p); DoFHandler dof_handler(triangulation); dof_handler.distribute_dofs (fe); ConstraintMatrix constraints; - DoFTools::make_hanging_node_constraints (dof_handler, - constraints); constraints.close (); Vector projection (dof_handler.n_dofs()); Vector error (triangulation.n_active_cells()); - for (unsigned int q=0; q<=p; ++q) + for (unsigned int q=0; q<4; ++q) { // project the function VectorTools::project (dof_handler, constraints, QGauss(p+2), - F (q), + F (), projection); - // just to make sure it doesn't get - // forgotten: handle hanging node - // constraints - constraints.distribute (projection); - - // then compute the interpolation error - VectorTools::integrate_difference (dof_handler, - projection, - F (q), - error, - QGauss(std::max(p,q)+1), - VectorTools::L2_norm); - Assert (error.l2_norm() <= 1e-12*projection.l2_norm(), - ExcInternalError()); + Assert (std::fabs(projection.l1_norm() - 3750.000000000079) < 1e-10, + ExcInternalError()); } - std::cout << "Done: " << __PRETTY_FUNCTION__ << ' ' << p << std::endl; + std::cout << "Done: " << __PRETTY_FUNCTION__ << ' ' << p + << std::endl; } @@ -130,13 +121,11 @@ void do_project (const Triangulation &triangulation, template void test () { - Triangulation triangulation; - GridGenerator::hyper_cube (triangulation); - triangulation.refine_global (2); - + std::cout.precision(16); + Threads::TaskGroup<> g; - for (unsigned int p=1; p<4; ++p) - g += Threads::new_task (&do_project, triangulation, p); + for (unsigned int p=1; p<12; ++p) + g += Threads::new_task (&do_project, 3); g.join_all (); } @@ -150,6 +139,7 @@ int main () deallog.depth_console(0); deallog.threshold_double(1.e-10); + test<2>(); Threads::TaskGroup<> g; for (unsigned int i=0; i<2; ++i) -- 2.39.5