]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make example work finally.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 2 Apr 1998 17:19:34 +0000 (17:19 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 2 Apr 1998 17:19:34 +0000 (17:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@127 0785d39b-7218-0410-832d-ea1e28bc413d

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

index c974e9afb635727080f90038cd0a465af67f18bb..fb9f151be991efdf994f2e8e0bf3968ff585a7c2 100644 (file)
@@ -1,2 +1,3 @@
-set Test run          = random
-set Global refinement = 1
+set Test run          = { zoom in | ball | curved line | random }
+set Global refinement = {{ 2 | 4 | 6 | 0 }}
+set Output file       = gnuplot.{{ zoom_in | ball | curved_line | random }}
index acef23aa40fbb7c669da83e65ed9dcec931248c1..3d4a4ea1ecdf3dad72d4183b203963ef10f11202 100644 (file)
@@ -71,7 +71,9 @@ void PoissonProblem<dim>::declare_parameters (ParameterHandler &prm) {
   else
     prm.declare_entry ("Test run", "zoom in", "zoom in\\|random");
 
-  prm.declare_entry ("Global refinement", "0", ParameterHandler::RegularExpressions::Integer);
+  prm.declare_entry ("Global refinement", "0",
+                    ParameterHandler::RegularExpressions::Integer);
+  prm.declare_entry ("Output file", "gnuplot.1");
 };
 
 
@@ -89,22 +91,25 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       else
        if (test=="random") test_case = 4;
        else 
-         cerr << "This test seems not to be implemented!" << endl;
+         {
+           cerr << "This test seems not to be implemented!" << endl;
+           return false;
+         };
 
   switch (test_case) 
     {
       case 1:
            make_zoom_in_grid ();
-           return true;
+           break;
       case 2:
            make_ball_grid ();
-           return true;
+           break;
       case 3:
            make_curved_line_grid ();
-           return true;
+           break;
       case 4:
            make_random_grid ();
-           return true;
+           break;
       default:
            return false;
     };
@@ -114,6 +119,8 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
     return false;
   else
     tria->refine_global (refine_global);
+
+  return true;
 };
 
          
@@ -172,6 +179,7 @@ void PoissonProblem<dim>::make_curved_line_grid () {
 
 template <int dim>
 void PoissonProblem<dim>::make_random_grid () {
+  tria->create_hypercube ();
   tria->refine_global (1);
        
   Triangulation<dim>::active_cell_iterator cell, endc;
@@ -215,11 +223,11 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   PoissonEquation<dim>            equation (rhs);
   QGauss4<dim>                    quadrature;
   
-  cout << "Distributing dofs... "; 
+  cout << "    Distributing dofs... "; 
   dof->distribute_dofs (fe);
   cout << dof->n_dofs() << " degrees of freedom." << endl;
 
-  cout << "Assembling matrices..." << endl;
+  cout << "    Assembling matrices..." << endl;
   FEValues<dim>::UpdateStruct update_flags;
   update_flags.q_points  = update_flags.gradients  = true;
   update_flags.jacobians = update_flags.JxW_values = true;
@@ -229,12 +237,13 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   dirichlet_bc[0] = &zero;
   assemble (equation, quadrature, fe, update_flags, dirichlet_bc);
 
-  cout << "Solving..." << endl;
+  cout << "    Solving..." << endl;
   solve ();
 
-  cout << "Printing..." << endl;
+  cout << "    Writing to file <" << prm.get("Output file") << ">..." << endl;
   DataOut<dim> out;
-  ofstream gnuplot("gnuplot.out.5");
+
+  ofstream gnuplot(prm.get("Output file"));
   fill_data (out); 
   out.write_gnuplot (gnuplot);
   gnuplot.close ();
index c974e9afb635727080f90038cd0a465af67f18bb..fb9f151be991efdf994f2e8e0bf3968ff585a7c2 100644 (file)
@@ -1,2 +1,3 @@
-set Test run          = random
-set Global refinement = 1
+set Test run          = { zoom in | ball | curved line | random }
+set Global refinement = {{ 2 | 4 | 6 | 0 }}
+set Output file       = gnuplot.{{ zoom_in | ball | curved_line | random }}
index acef23aa40fbb7c669da83e65ed9dcec931248c1..3d4a4ea1ecdf3dad72d4183b203963ef10f11202 100644 (file)
@@ -71,7 +71,9 @@ void PoissonProblem<dim>::declare_parameters (ParameterHandler &prm) {
   else
     prm.declare_entry ("Test run", "zoom in", "zoom in\\|random");
 
-  prm.declare_entry ("Global refinement", "0", ParameterHandler::RegularExpressions::Integer);
+  prm.declare_entry ("Global refinement", "0",
+                    ParameterHandler::RegularExpressions::Integer);
+  prm.declare_entry ("Output file", "gnuplot.1");
 };
 
 
@@ -89,22 +91,25 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       else
        if (test=="random") test_case = 4;
        else 
-         cerr << "This test seems not to be implemented!" << endl;
+         {
+           cerr << "This test seems not to be implemented!" << endl;
+           return false;
+         };
 
   switch (test_case) 
     {
       case 1:
            make_zoom_in_grid ();
-           return true;
+           break;
       case 2:
            make_ball_grid ();
-           return true;
+           break;
       case 3:
            make_curved_line_grid ();
-           return true;
+           break;
       case 4:
            make_random_grid ();
-           return true;
+           break;
       default:
            return false;
     };
@@ -114,6 +119,8 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
     return false;
   else
     tria->refine_global (refine_global);
+
+  return true;
 };
 
          
@@ -172,6 +179,7 @@ void PoissonProblem<dim>::make_curved_line_grid () {
 
 template <int dim>
 void PoissonProblem<dim>::make_random_grid () {
+  tria->create_hypercube ();
   tria->refine_global (1);
        
   Triangulation<dim>::active_cell_iterator cell, endc;
@@ -215,11 +223,11 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   PoissonEquation<dim>            equation (rhs);
   QGauss4<dim>                    quadrature;
   
-  cout << "Distributing dofs... "; 
+  cout << "    Distributing dofs... "; 
   dof->distribute_dofs (fe);
   cout << dof->n_dofs() << " degrees of freedom." << endl;
 
-  cout << "Assembling matrices..." << endl;
+  cout << "    Assembling matrices..." << endl;
   FEValues<dim>::UpdateStruct update_flags;
   update_flags.q_points  = update_flags.gradients  = true;
   update_flags.jacobians = update_flags.JxW_values = true;
@@ -229,12 +237,13 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   dirichlet_bc[0] = &zero;
   assemble (equation, quadrature, fe, update_flags, dirichlet_bc);
 
-  cout << "Solving..." << endl;
+  cout << "    Solving..." << endl;
   solve ();
 
-  cout << "Printing..." << endl;
+  cout << "    Writing to file <" << prm.get("Output file") << ">..." << endl;
   DataOut<dim> out;
-  ofstream gnuplot("gnuplot.out.5");
+
+  ofstream gnuplot(prm.get("Output file"));
   fill_data (out); 
   out.write_gnuplot (gnuplot);
   gnuplot.close ();

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.