]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Example update.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 6 Apr 1998 09:06:58 +0000 (09:06 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 6 Apr 1998 09:06:58 +0000 (09:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@144 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/Attic/examples/Makefile
deal.II/deal.II/Attic/examples/poisson/Makefile
deal.II/deal.II/Attic/examples/poisson/poisson.prm
deal.II/deal.II/Attic/examples/poisson/problem.cc
tests/big-tests/Makefile
tests/big-tests/poisson/Makefile
tests/big-tests/poisson/make_ps
tests/big-tests/poisson/poisson.prm
tests/big-tests/poisson/problem.cc

index 3bfb65efb92e2ca40802c478b35438e155b38530..a8c6a1a1072efb802a68157b7e8b6783f6114873 100644 (file)
@@ -1,9 +1,13 @@
 # $Id$
 
 CXX=c++
-INCPATH   = -I../include -I../../lac/include -I../../base/include
-CXXFLAGS.g= -DDEBUG -g -Wall $(INCPATH)
-CXXFLAGS  = -O3 $(INCPATH)
+INCLUDE   = -I../include -I../../lac/include -I../../base/include
+CXXFLAGS.g= -DDEBUG -g -Wall -W -pedantic -Wconversion \
+            -Winline -Woverloaded-virtual -fno-rtti -fno-exceptions \
+            $(INCLUDE)
+CXXFLAGS  =-O3 -Wuninitialized -finline-functions -ffast-math \
+           -funroll-loops -felide-constructors -fnonnull-objects \
+           -fno-rtti -fno-exceptions $(INCLUDE)
 
 LIBPATH   = -L../lib -L../../lac/lib
 LIBFILES.g= ../lib/libbasic.g.a ../lib/libgrid.g.a \
@@ -13,14 +17,18 @@ LIBFILES  = $(LIBFILES.g:.g.a=.a)
 LIBS.g    = $(LIBPATH) -lbasic.g -lgrid.g -lfe.g -lnumerics.g -llac.g
 LIBS      = $(LIBS.g:.g=)
 
+
+ifeq ($(shell uname),Linux)
+CXX       = /home/wolf/bin/gcc-2.8.1/bin/c++
+endif
+
+
 ifeq ($(shell uname),SunOS)
-#CXXFLAGS  := -V2.7.2.3 $(CXXFLAGS)
-#CXXFLAGS.g:= -V2.7.2.3 $(CXXFLAGS.g)
 INCLUDE2.8  =  -I/usr/local/source/libstdc++-2.8.0/libstdc++ \
                -I/usr/local/source/libstdc++-2.8.0/libstdc++/stl \
                -I/usr/local/source/libstdc++-2.8.0/libio
-CXXFLAGS  := $(CXXFLAGS) -fno-rtti -fno-exceptions $(INCLUDE2.8)
-CXXFLAGS.g:= $(CXXFLAGS.g) -W -fno-rtti -fno-exceptions $(INCLUDE2.8)
+CXXFLAGS  := $(CXXFLAGS) $(INCLUDE2.8)
+CXXFLAGS.g:= $(CXXFLAGS.g) $(INCLUDE2.8)
 endif
 
 
@@ -78,6 +86,6 @@ clean:
 #of this file.
 Makefile.dep: $(cc-files) $(h-files)
        @echo ================= Making $@
-       @$(CXX) $(INCPATH) -M $(cc-files) > Makefile.dep
+       @$(CXX) $(INCLUDE) -M $(cc-files) > Makefile.dep
 
 include Makefile.dep
index 3e2c9bc71a8d900a1f19f7541db1c5944677b20f..9e55405fbe3d3f74fdd4cdc6070905de67fc515f 100644 (file)
@@ -3,19 +3,23 @@
 CXX       = c++
 INCLUDE   = -I../../include -I../../../lac/include \
             -I../../../base/include -I../../../mia/include
-CXXFLAGS.g= -DDEBUG -g -Wall -pedantic -Wconversion \
-            -Winline -Woverloaded-virtual $(INCLUDE)
+CXXFLAGS.g= -DDEBUG -g -Wall -W -pedantic -Wconversion \
+            -Winline -Woverloaded-virtual -fno-rtti -fno-exceptions \
+            $(INCLUDE)
 CXXFLAGS  =-O3 -Wuninitialized -finline-functions -ffast-math \
-           -funroll-loops -felide-constructors -fnonnull-objects $(INCLUDE)
+           -funroll-loops -felide-constructors -fnonnull-objects \
+           -fno-rtti -fno-exceptions $(INCLUDE)
+
+ifeq ($(shell uname),Linux)
+CXX       = /home/wolf/bin/gcc-2.8.1/bin/c++
+endif
 
 ifeq ($(shell uname),SunOS)
-#CXXFLAGS  := -V2.7.2.3 $(CXXFLAGS)
-#CXXFLAGS.g:= -V2.7.2.3 $(CXXFLAGS.g)
 INCLUDE2.8  =  -I/usr/local/source/libstdc++-2.8.0/libstdc++ \
                -I/usr/local/source/libstdc++-2.8.0/libstdc++/stl \
                -I/usr/local/source/libstdc++-2.8.0/libio
-CXXFLAGS  := $(CXXFLAGS) -fno-rtti -fno-exceptions $(INCLUDE2.8)
-CXXFLAGS.g:= $(CXXFLAGS.g) -W -fno-rtti -fno-exceptions $(INCLUDE2.8)
+CXXFLAGS  := $(CXXFLAGS) $(INCLUDE2.8)
+CXXFLAGS.g:= $(CXXFLAGS.g) $(INCLUDE2.8)
 endif
 
 LIBPATH   = -L../../lib -L../../../lac/lib
index 2bebf9b6d429f0e7ba30d7a39614c7feebef0e03..9d94d10703c7af3465d111b4c2196930a3d25bf0 100644 (file)
@@ -1,5 +1,5 @@
-set Test run          = { zoom in | ball | curved line | random }
-set Global refinement = {{ 2 | 5 | 6 | 0 }}
-set Right hand side   = {{ zero | zero | trigpoly | constant }}
-set Boundary values   = {{ sine | sine | zero | zero }}
-set Output file       = gnuplot.{{ zoom_in | ball | curved_line | random }}
+set Test run          = { zoom in | ball | curved line | random | jump | L-region}
+set Global refinement = {{ 2 | 5 | 6 | 0 | 2 | 5 }}
+set Right hand side   = {{ zero | zero | trigpoly | constant | zero | zero }}
+set Boundary values   = {{ sine | sine | zero | zero | jump | sine }}
+set Output file       = gnuplot.{{ zoom_in | ball | curved_line | random | jump | L-region }}
index fcc3a74ee3e3fea22e003cfb9530da0c23617211..b33cf6f708df50b3c6e9b16e9dc2409528f7e72c 100644 (file)
@@ -33,6 +33,29 @@ class BoundaryValuesSine : public Function<dim> {
 
 
 
+template <int dim>
+class BoundaryValuesJump : public Function<dim> {
+  public:
+                                    /**
+                                     * Return the value of the function
+                                     * at the given point.
+                                     */
+    virtual double operator () (const Point<dim> &p) const {
+      switch (dim) 
+       {
+         case 1:
+               return 0;
+         default:
+               if (p(0) == p(1))
+                 return 0.5;
+               else
+                 return (p(0)>p(1) ? 0. : 1.);
+       };
+    };
+};
+
+
+
 
 template <int dim>
 class RHSTrigPoly : public Function<dim> {
@@ -46,6 +69,34 @@ class RHSTrigPoly : public Function<dim> {
 
 
 
+/**
+  Right hand side constructed such that the exact solution is
+  $x(1-x)$ in 1d, $x(1-x)*y(1-y)$ in 2d, etc.
+  */
+template <int dim>
+class RHSPoly : public Function<dim> {
+  public:
+                                    /**
+                                     * Return the value of the function
+                                     * at the given point.
+                                     */
+    virtual double operator () (const Point<dim> &p) const;
+};
+
+
+
+template <int dim>
+class Solution : public Function<dim> {
+  public:
+                                    /**
+                                     * Return the value of the function
+                                     * at the given point.
+                                     */
+    virtual double operator () (const Point<dim> &p) const;
+};
+
+
+
 
 
 
@@ -99,6 +150,25 @@ double RHSTrigPoly<dim>::operator () (const Point<dim> &p) const {
 
 
 
+template <int dim>
+double RHSPoly<dim>::operator () (const Point<dim> &p) const {
+  double ret_val = 0;
+  for (unsigned int i=0; i<dim; ++i)
+    ret_val += 2*p(i)*(1.-p(i));
+  return ret_val;
+};
+
+
+template <int dim>
+double Solution<dim>::operator () (const Point<dim> &p) const {
+  double ret_val = 0;
+  for (unsigned int i=0; i<dim; ++i)
+    ret_val *= p(i)*(1.-p(i));
+  return ret_val;
+};
+
+
+
 
 
 template <int dim>
@@ -154,16 +224,16 @@ template <int dim>
 void PoissonProblem<dim>::declare_parameters (ParameterHandler &prm) {
   if (dim>=2)
     prm.declare_entry ("Test run", "zoom in",
-                      "tensor\\|zoom in\\|ball\\|curved line\\|random");
+                      "tensor\\|zoom in\\|ball\\|curved line\\|random\\|jump\\|L-region");
   else
     prm.declare_entry ("Test run", "zoom in", "tensor\\|zoom in\\|random");
 
   prm.declare_entry ("Global refinement", "0",
                     ParameterHandler::RegularExpressions::Integer);
   prm.declare_entry ("Right hand side", "zero",
-                    "zero\\|constant\\|trigpoly");
+                    "zero\\|constant\\|trigpoly\\|poly");
   prm.declare_entry ("Boundary values", "zero",
-                    "zero\\|sine");
+                    "zero\\|sine\\|jump");
   prm.declare_entry ("Output file", "gnuplot.1");
 };
 
@@ -184,10 +254,14 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
        else
          if (test=="tensor") test_case = 5;
          else
-           {
-             cerr << "This test seems not to be implemented!" << endl;
-             return false;
-           };
+           if (test=="jump") test_case = 6;
+           else
+             if (test=="L-region") test_case = 7;
+             else
+               {
+                 cerr << "This test seems not to be implemented!" << endl;
+                 return false;
+               };
 
   switch (test_case) 
     {
@@ -218,6 +292,19 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       case 5:
            tria->create_hypercube ();
            break;
+      case 6:
+           tria->create_hypercube ();
+           tria->refine_global (1);
+           for (unsigned int i=0; i<5; ++i)
+             {
+               tria->begin_active(tria->n_levels()-1)->set_refine_flag();
+               (--(tria->last_active()))->set_refine_flag();
+               tria->execute_refinement ();
+             };
+           break;
+      case 7:
+           tria->create_hyper_L ();
+           break;
       default:
            return false;
     };
@@ -304,7 +391,10 @@ bool PoissonProblem<dim>::set_right_hand_side (ParameterHandler &prm) {
       if (rhs_name == "trigpoly")
        rhs = new RHSTrigPoly<dim>();
       else
-       return false;
+       if (rhs_name == "poly")
+         rhs = new RHSPoly<dim> ();
+       else
+         return false;
 
   if (rhs != 0)
     return true;
@@ -324,7 +414,10 @@ bool PoissonProblem<dim>::set_boundary_values (ParameterHandler &prm) {
     if (bv_name == "sine")
       boundary_values = new BoundaryValuesSine<dim> ();
     else
-      return false;
+      if (bv_name == "jump")
+       boundary_values = new BoundaryValuesJump<dim> ();
+      else
+       return false;
 
   if (boundary_values != 0)
     return true;
@@ -340,9 +433,10 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   cout << "Test case = " << prm.get ("Test run")
        << endl;
   
-  cout << "    Making grid..." << endl;
+  cout << "    Making grid... ";
   if (!make_grid (prm))
     return;
+  cout << tria->n_active_cells() << " active cells." << endl;
   
   if (!set_right_hand_side (prm))
     return;
@@ -352,7 +446,7 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   
   FELinear<dim>                   fe;
   PoissonEquation<dim>            equation (*rhs);
-  QGauss4<dim>                    quadrature;
+  QGauss3<dim>                    quadrature;
   
   cout << "    Distributing dofs... "; 
   dof->distribute_dofs (fe);
@@ -371,14 +465,26 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   solve ();
 
   cout << "    Writing to file <" << prm.get("Output file") << ">..."
-       << endl
        << endl;
   
   DataOut<dim> out;
-  ofstream gnuplot(prm.get("Output file"));
+  String o_filename = prm.get ("Output file");
+  ofstream gnuplot(o_filename);
   fill_data (out); 
   out.write_gnuplot (gnuplot);
   gnuplot.close ();
+
+  cout << "    Calculation L2 error... ";
+  Solution<dim> sol;
+  vector<double> difference;
+  QGauss3<dim> q;
+  integrate_difference (sol, difference, q, fe, L2_norm);
+  double error = 0;
+  for (unsigned int i=0; i<difference.size(); ++i)
+    error += difference[i]*difference[i];
+  cout << sqrt(error) << endl;
+
+  cout << endl;
 };
 
 
index 3bfb65efb92e2ca40802c478b35438e155b38530..a8c6a1a1072efb802a68157b7e8b6783f6114873 100644 (file)
@@ -1,9 +1,13 @@
 # $Id$
 
 CXX=c++
-INCPATH   = -I../include -I../../lac/include -I../../base/include
-CXXFLAGS.g= -DDEBUG -g -Wall $(INCPATH)
-CXXFLAGS  = -O3 $(INCPATH)
+INCLUDE   = -I../include -I../../lac/include -I../../base/include
+CXXFLAGS.g= -DDEBUG -g -Wall -W -pedantic -Wconversion \
+            -Winline -Woverloaded-virtual -fno-rtti -fno-exceptions \
+            $(INCLUDE)
+CXXFLAGS  =-O3 -Wuninitialized -finline-functions -ffast-math \
+           -funroll-loops -felide-constructors -fnonnull-objects \
+           -fno-rtti -fno-exceptions $(INCLUDE)
 
 LIBPATH   = -L../lib -L../../lac/lib
 LIBFILES.g= ../lib/libbasic.g.a ../lib/libgrid.g.a \
@@ -13,14 +17,18 @@ LIBFILES  = $(LIBFILES.g:.g.a=.a)
 LIBS.g    = $(LIBPATH) -lbasic.g -lgrid.g -lfe.g -lnumerics.g -llac.g
 LIBS      = $(LIBS.g:.g=)
 
+
+ifeq ($(shell uname),Linux)
+CXX       = /home/wolf/bin/gcc-2.8.1/bin/c++
+endif
+
+
 ifeq ($(shell uname),SunOS)
-#CXXFLAGS  := -V2.7.2.3 $(CXXFLAGS)
-#CXXFLAGS.g:= -V2.7.2.3 $(CXXFLAGS.g)
 INCLUDE2.8  =  -I/usr/local/source/libstdc++-2.8.0/libstdc++ \
                -I/usr/local/source/libstdc++-2.8.0/libstdc++/stl \
                -I/usr/local/source/libstdc++-2.8.0/libio
-CXXFLAGS  := $(CXXFLAGS) -fno-rtti -fno-exceptions $(INCLUDE2.8)
-CXXFLAGS.g:= $(CXXFLAGS.g) -W -fno-rtti -fno-exceptions $(INCLUDE2.8)
+CXXFLAGS  := $(CXXFLAGS) $(INCLUDE2.8)
+CXXFLAGS.g:= $(CXXFLAGS.g) $(INCLUDE2.8)
 endif
 
 
@@ -78,6 +86,6 @@ clean:
 #of this file.
 Makefile.dep: $(cc-files) $(h-files)
        @echo ================= Making $@
-       @$(CXX) $(INCPATH) -M $(cc-files) > Makefile.dep
+       @$(CXX) $(INCLUDE) -M $(cc-files) > Makefile.dep
 
 include Makefile.dep
index 3e2c9bc71a8d900a1f19f7541db1c5944677b20f..9e55405fbe3d3f74fdd4cdc6070905de67fc515f 100644 (file)
@@ -3,19 +3,23 @@
 CXX       = c++
 INCLUDE   = -I../../include -I../../../lac/include \
             -I../../../base/include -I../../../mia/include
-CXXFLAGS.g= -DDEBUG -g -Wall -pedantic -Wconversion \
-            -Winline -Woverloaded-virtual $(INCLUDE)
+CXXFLAGS.g= -DDEBUG -g -Wall -W -pedantic -Wconversion \
+            -Winline -Woverloaded-virtual -fno-rtti -fno-exceptions \
+            $(INCLUDE)
 CXXFLAGS  =-O3 -Wuninitialized -finline-functions -ffast-math \
-           -funroll-loops -felide-constructors -fnonnull-objects $(INCLUDE)
+           -funroll-loops -felide-constructors -fnonnull-objects \
+           -fno-rtti -fno-exceptions $(INCLUDE)
+
+ifeq ($(shell uname),Linux)
+CXX       = /home/wolf/bin/gcc-2.8.1/bin/c++
+endif
 
 ifeq ($(shell uname),SunOS)
-#CXXFLAGS  := -V2.7.2.3 $(CXXFLAGS)
-#CXXFLAGS.g:= -V2.7.2.3 $(CXXFLAGS.g)
 INCLUDE2.8  =  -I/usr/local/source/libstdc++-2.8.0/libstdc++ \
                -I/usr/local/source/libstdc++-2.8.0/libstdc++/stl \
                -I/usr/local/source/libstdc++-2.8.0/libio
-CXXFLAGS  := $(CXXFLAGS) -fno-rtti -fno-exceptions $(INCLUDE2.8)
-CXXFLAGS.g:= $(CXXFLAGS.g) -W -fno-rtti -fno-exceptions $(INCLUDE2.8)
+CXXFLAGS  := $(CXXFLAGS) $(INCLUDE2.8)
+CXXFLAGS.g:= $(CXXFLAGS.g) $(INCLUDE2.8)
 endif
 
 LIBPATH   = -L../../lib -L../../../lac/lib
index ebe72be4af357dcbea2b3cfab5b388ec05f85101..3d202fe4844f6e645447495790a5e5d0ec4b583c 100644 (file)
@@ -22,4 +22,11 @@ splot "gnuplot.curved_line"
 set output "fig.random.eps"
 splot "gnuplot.random"
 
+!echo "  Making <fig.jump.eps>"
+set output "fig.jump.eps"
+splot "gnuplot.jump"
 
+!echo "  Making <fig.L-region.eps>"
+set view 52,115
+set output "fig.L-region.eps"
+splot "gnuplot.L-region"
index 2bebf9b6d429f0e7ba30d7a39614c7feebef0e03..9d94d10703c7af3465d111b4c2196930a3d25bf0 100644 (file)
@@ -1,5 +1,5 @@
-set Test run          = { zoom in | ball | curved line | random }
-set Global refinement = {{ 2 | 5 | 6 | 0 }}
-set Right hand side   = {{ zero | zero | trigpoly | constant }}
-set Boundary values   = {{ sine | sine | zero | zero }}
-set Output file       = gnuplot.{{ zoom_in | ball | curved_line | random }}
+set Test run          = { zoom in | ball | curved line | random | jump | L-region}
+set Global refinement = {{ 2 | 5 | 6 | 0 | 2 | 5 }}
+set Right hand side   = {{ zero | zero | trigpoly | constant | zero | zero }}
+set Boundary values   = {{ sine | sine | zero | zero | jump | sine }}
+set Output file       = gnuplot.{{ zoom_in | ball | curved_line | random | jump | L-region }}
index fcc3a74ee3e3fea22e003cfb9530da0c23617211..b33cf6f708df50b3c6e9b16e9dc2409528f7e72c 100644 (file)
@@ -33,6 +33,29 @@ class BoundaryValuesSine : public Function<dim> {
 
 
 
+template <int dim>
+class BoundaryValuesJump : public Function<dim> {
+  public:
+                                    /**
+                                     * Return the value of the function
+                                     * at the given point.
+                                     */
+    virtual double operator () (const Point<dim> &p) const {
+      switch (dim) 
+       {
+         case 1:
+               return 0;
+         default:
+               if (p(0) == p(1))
+                 return 0.5;
+               else
+                 return (p(0)>p(1) ? 0. : 1.);
+       };
+    };
+};
+
+
+
 
 template <int dim>
 class RHSTrigPoly : public Function<dim> {
@@ -46,6 +69,34 @@ class RHSTrigPoly : public Function<dim> {
 
 
 
+/**
+  Right hand side constructed such that the exact solution is
+  $x(1-x)$ in 1d, $x(1-x)*y(1-y)$ in 2d, etc.
+  */
+template <int dim>
+class RHSPoly : public Function<dim> {
+  public:
+                                    /**
+                                     * Return the value of the function
+                                     * at the given point.
+                                     */
+    virtual double operator () (const Point<dim> &p) const;
+};
+
+
+
+template <int dim>
+class Solution : public Function<dim> {
+  public:
+                                    /**
+                                     * Return the value of the function
+                                     * at the given point.
+                                     */
+    virtual double operator () (const Point<dim> &p) const;
+};
+
+
+
 
 
 
@@ -99,6 +150,25 @@ double RHSTrigPoly<dim>::operator () (const Point<dim> &p) const {
 
 
 
+template <int dim>
+double RHSPoly<dim>::operator () (const Point<dim> &p) const {
+  double ret_val = 0;
+  for (unsigned int i=0; i<dim; ++i)
+    ret_val += 2*p(i)*(1.-p(i));
+  return ret_val;
+};
+
+
+template <int dim>
+double Solution<dim>::operator () (const Point<dim> &p) const {
+  double ret_val = 0;
+  for (unsigned int i=0; i<dim; ++i)
+    ret_val *= p(i)*(1.-p(i));
+  return ret_val;
+};
+
+
+
 
 
 template <int dim>
@@ -154,16 +224,16 @@ template <int dim>
 void PoissonProblem<dim>::declare_parameters (ParameterHandler &prm) {
   if (dim>=2)
     prm.declare_entry ("Test run", "zoom in",
-                      "tensor\\|zoom in\\|ball\\|curved line\\|random");
+                      "tensor\\|zoom in\\|ball\\|curved line\\|random\\|jump\\|L-region");
   else
     prm.declare_entry ("Test run", "zoom in", "tensor\\|zoom in\\|random");
 
   prm.declare_entry ("Global refinement", "0",
                     ParameterHandler::RegularExpressions::Integer);
   prm.declare_entry ("Right hand side", "zero",
-                    "zero\\|constant\\|trigpoly");
+                    "zero\\|constant\\|trigpoly\\|poly");
   prm.declare_entry ("Boundary values", "zero",
-                    "zero\\|sine");
+                    "zero\\|sine\\|jump");
   prm.declare_entry ("Output file", "gnuplot.1");
 };
 
@@ -184,10 +254,14 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
        else
          if (test=="tensor") test_case = 5;
          else
-           {
-             cerr << "This test seems not to be implemented!" << endl;
-             return false;
-           };
+           if (test=="jump") test_case = 6;
+           else
+             if (test=="L-region") test_case = 7;
+             else
+               {
+                 cerr << "This test seems not to be implemented!" << endl;
+                 return false;
+               };
 
   switch (test_case) 
     {
@@ -218,6 +292,19 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       case 5:
            tria->create_hypercube ();
            break;
+      case 6:
+           tria->create_hypercube ();
+           tria->refine_global (1);
+           for (unsigned int i=0; i<5; ++i)
+             {
+               tria->begin_active(tria->n_levels()-1)->set_refine_flag();
+               (--(tria->last_active()))->set_refine_flag();
+               tria->execute_refinement ();
+             };
+           break;
+      case 7:
+           tria->create_hyper_L ();
+           break;
       default:
            return false;
     };
@@ -304,7 +391,10 @@ bool PoissonProblem<dim>::set_right_hand_side (ParameterHandler &prm) {
       if (rhs_name == "trigpoly")
        rhs = new RHSTrigPoly<dim>();
       else
-       return false;
+       if (rhs_name == "poly")
+         rhs = new RHSPoly<dim> ();
+       else
+         return false;
 
   if (rhs != 0)
     return true;
@@ -324,7 +414,10 @@ bool PoissonProblem<dim>::set_boundary_values (ParameterHandler &prm) {
     if (bv_name == "sine")
       boundary_values = new BoundaryValuesSine<dim> ();
     else
-      return false;
+      if (bv_name == "jump")
+       boundary_values = new BoundaryValuesJump<dim> ();
+      else
+       return false;
 
   if (boundary_values != 0)
     return true;
@@ -340,9 +433,10 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   cout << "Test case = " << prm.get ("Test run")
        << endl;
   
-  cout << "    Making grid..." << endl;
+  cout << "    Making grid... ";
   if (!make_grid (prm))
     return;
+  cout << tria->n_active_cells() << " active cells." << endl;
   
   if (!set_right_hand_side (prm))
     return;
@@ -352,7 +446,7 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   
   FELinear<dim>                   fe;
   PoissonEquation<dim>            equation (*rhs);
-  QGauss4<dim>                    quadrature;
+  QGauss3<dim>                    quadrature;
   
   cout << "    Distributing dofs... "; 
   dof->distribute_dofs (fe);
@@ -371,14 +465,26 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   solve ();
 
   cout << "    Writing to file <" << prm.get("Output file") << ">..."
-       << endl
        << endl;
   
   DataOut<dim> out;
-  ofstream gnuplot(prm.get("Output file"));
+  String o_filename = prm.get ("Output file");
+  ofstream gnuplot(o_filename);
   fill_data (out); 
   out.write_gnuplot (gnuplot);
   gnuplot.close ();
+
+  cout << "    Calculation L2 error... ";
+  Solution<dim> sol;
+  vector<double> difference;
+  QGauss3<dim> q;
+  integrate_difference (sol, difference, q, fe, L2_norm);
+  double error = 0;
+  for (unsigned int i=0; i<difference.size(); ++i)
+    error += difference[i]*difference[i];
+  cout << sqrt(error) << endl;
+
+  cout << endl;
 };
 
 

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.