From: Wolfgang Bangerth Date: Thu, 4 Jul 2013 03:00:42 +0000 (+0000) Subject: Further simplify. X-Git-Tag: v8.0.0~185 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83f4bac4d4462de98c7a063ff8f30e070c623799;p=dealii.git Further simplify. git-svn-id: https://svn.dealii.org/trunk@29935 0785d39b-7218-0410-832d-ea1e28bc413d --- 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)