]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add comment on what the test actually does.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 7 Sep 2011 21:42:21 +0000 (21:42 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 7 Sep 2011 21:42:21 +0000 (21:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@24278 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/fe_field_function.cc

index 8e16cd7a1ef5dbd99733f6f637b174f93d8a83df..bc25ad47fca89171fe8e270ef0815bff24d97e5f 100644 (file)
@@ -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 <fstream>
 #include <deal.II/base/quadrature_lib.h>
 #include <deal.II/numerics/vectors.h>
 
-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 <int dim> 
+template <int dim>
 void test() {
   Triangulation<dim> tria;
   GridGenerator::hyper_cube(tria);
@@ -43,52 +44,52 @@ void test() {
 
   FE_Q<dim> fe(1);
   DoFHandler<dim> dh(tria);
-  
+
   dh.distribute_dofs(fe);
   deallog << "Ndofs :" << dh.n_dofs() << std::endl;
 
   Functions::CosineFunction<dim> ff;
-  
+
   Vector<double> v1(dh.n_dofs()), v2(dh.n_dofs());
-  
+
   VectorTools::interpolate(dh, ff, v1);
   deallog << "V norm: " << v1.l2_norm() << std::endl;
-  
-  Functions::FEFieldFunction<dim, DoFHandler<dim>, Vector<double> > 
+
+  Functions::FEFieldFunction<dim, DoFHandler<dim>, Vector<double> >
     fef(dh, v1);
-  
+
   VectorTools::interpolate(dh, fef, v2);
-  
+
   v2.add(-1, v1);
   deallog << "Interpolation error: " << abs_zero(v2.l2_norm())
          << std::endl;
-  
+
   Vector<double> error(tria.n_active_cells());
   QGauss<dim> 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;
 }
-                  
+

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.