From 1f5285847323f887e29d4a3de400a76fa241ee99 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 7 Sep 2011 21:42:21 +0000 Subject: [PATCH] Add comment on what the test actually does. git-svn-id: https://svn.dealii.org/trunk@24278 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/fe_field_function.cc | 53 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/tests/bits/fe_field_function.cc b/tests/bits/fe_field_function.cc index 8e16cd7a1e..bc25ad47fc 100644 --- a/tests/bits/fe_field_function.cc +++ b/tests/bits/fe_field_function.cc @@ -1,8 +1,8 @@ //---------------------------- template.cc --------------------------- // $Id$ -// Version: $Name$ +// Version: $Name$ // -// Copyright (C) 2005 by the deal.II authors +// Copyright (C) 2005, 2011 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -12,7 +12,7 @@ //---------------------------- template.cc --------------------------- -// a short (a few lines) description of what the program does +// Test the FEFieldFunction class #include "../tests.h" #include @@ -28,14 +28,15 @@ #include #include -double abs_zero(double a) { - if( std::abs(a) < 1e-10) - return 0; - else - return a; +double abs_zero(double a) +{ + if( std::abs(a) < 1e-10) + return 0; + else + return a; } -template +template void test() { Triangulation tria; GridGenerator::hyper_cube(tria); @@ -43,52 +44,52 @@ void test() { FE_Q fe(1); DoFHandler dh(tria); - + dh.distribute_dofs(fe); deallog << "Ndofs :" << dh.n_dofs() << std::endl; Functions::CosineFunction ff; - + Vector v1(dh.n_dofs()), v2(dh.n_dofs()); - + VectorTools::interpolate(dh, ff, v1); deallog << "V norm: " << v1.l2_norm() << std::endl; - - Functions::FEFieldFunction, Vector > + + Functions::FEFieldFunction, Vector > fef(dh, v1); - + VectorTools::interpolate(dh, fef, v2); - + v2.add(-1, v1); deallog << "Interpolation error: " << abs_zero(v2.l2_norm()) << std::endl; - + Vector error(tria.n_active_cells()); QGauss quad(2); - VectorTools::integrate_difference(dh, v1, ff, + VectorTools::integrate_difference(dh, v1, ff, error, quad, VectorTools::H1_norm); - deallog << "H1 Interpolation error: " + deallog << "H1 Interpolation error: " << abs_zero(error.l2_norm()) << std::endl; error = 0; - VectorTools::integrate_difference(dh, v1, fef, + VectorTools::integrate_difference(dh, v1, fef, error, quad, VectorTools::H1_norm); - deallog << "H1 Interpolation error with fef: " + deallog << "H1 Interpolation error with fef: " << abs_zero(error.l2_norm()) << std::endl; - + } -int main () +int main () { std::ofstream logfile("fe_field_function/output"); deallog.attach(logfile); deallog.depth_console(0); - + test<1>(); test<2>(); test<3>(); - + return 0; } - + -- 2.39.5