]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Don't stack output; the results are huge and not very illuminating.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 6 Nov 2006 04:27:57 +0000 (04:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 6 Nov 2006 04:27:57 +0000 (04:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@14156 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-25/step-25.cc

index 428ff70a7c25af4d0c8e9ec000921b9a07064429..c59d449278732a7dd00a1b834338aa43bebbeb08 100644 (file)
@@ -28,6 +28,7 @@
 #include <base/quadrature_lib.h>
 #include <base/function.h>
 #include <base/logstream.h>
+#include <base/utilities.h>
 #include <lac/vector.h>
 #include <lac/full_matrix.h>
 #include <lac/sparse_matrix.h>
 #include <numerics/vectors.h>
 #include <numerics/matrices.h>
 #include <numerics/data_out.h>
-#include <numerics/data_out_stack.h>
+
 #include <fstream>
 #include <iostream>
-#include <sstream>
+
 
                                 // The last step is as in all
                                 // previous programs:
@@ -107,8 +108,6 @@ class SineGordonProblem
     Vector<double>       massmatxvel;
     Vector<double>       system_rhs;
 
-    DataOutStack<dim>    data_out_stack;
-
     static const unsigned int output_timestep_skip = 1;
     static const int n_global_refinements = 6;
 };
@@ -661,45 +660,12 @@ void SineGordonProblem<dim>::output_results (const unsigned int timestep_number)
   data_out.add_data_vector (solution, "u");
   data_out.build_patches ();
 
-  std::ostringstream filename;
-  filename << "solution-" << dim << "d-";
-
-                                  // Pad the time step number in
-                                  // filename with zeros in the
-                                  // beginning so that the files are
-                                  // ordered correctly in the shell
-                                  // and we can generate a good
-                                  // animation using convert.
-  if (timestep_number<10) 
-    filename << "0000" << timestep_number;
-  else if (timestep_number<100)
-    filename << "000" << timestep_number;
-  else if (timestep_number<1000)
-    filename << "00" << timestep_number;
-  else if (timestep_number<10000)
-    filename << "0" << timestep_number;
-  else 
-    filename << timestep_number;
-  
-                                  // We output the solution at the
-                                  // desired times in
-                                  // <code>vtk</code> format, so that
-                                  // we can use VisIt to make plots
-                                  // and/or animations.
-  filename << ".vtk";
-  std::ofstream output (filename.str().c_str());
-  data_out.write_vtk (output);
+  const std::string filename =  "solution-" +
+                               Utilities::int_to_string (timestep_number, 3) +
+                               ".vtk";
 
-                                  // We also store the current
-                                  // solution in our instantiation of
-                                  // a <code>DataOutStack</code>
-                                  // object, so that we can make a
-                                  // space-time plot of the solution.
-  data_out_stack.new_parameter_value (time, time_step*output_timestep_skip);
-  data_out_stack.attach_dof_handler (dof_handler);
-  data_out_stack.add_data_vector (solution, "solution");
-  data_out_stack.build_patches (1);
-  data_out_stack.finish_parameter_value ();
+  std::ofstream output (filename.c_str());
+  data_out.write_vtk (output);
 }
 
                                 // @sect4{SineGordonProblem::run}
@@ -713,9 +679,6 @@ void SineGordonProblem<dim>::output_results (const unsigned int timestep_number)
 template <int dim>
 void SineGordonProblem<dim>::run () 
 {
-  data_out_stack.declare_data_vector ("solution",
-                                     DataOutStack<dim>::dof_vector);
-
   std::cout << "Solving problem in " << dim << " space dimensions." 
            << std::endl;
   
@@ -865,15 +828,6 @@ void SineGordonProblem<dim>::run ()
       compute_nl_term (old_solution, solution, tmp_vector);
       massmatxvel.add (-time_step, tmp_vector);
     }
-
-                                  // Finally, we output the sequence
-                                  // of solutions stored
-                                  // <code>data_out_stack</code> to a
-                                  // file of the appropriate format.
-  std::ostringstream filename;
-  filename << "solution-" << dim << "d-" << "stacked" << ".vtk";
-  std::ofstream output (filename.str().c_str());
-  data_out_stack.write_vtk (output);
 }
 
                                 // @sect3{The <code>main</code> function}

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.