]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Write the output_results() function.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Jun 2009 14:49:49 +0000 (14:49 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Jun 2009 14:49:49 +0000 (14:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@18948 0785d39b-7218-0410-832d-ea1e28bc413d

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

index f9f6d047bbafc444f271a810f2a98addad2bd1db..a82f8b7d21cb21ca57df4d947b37aced8454264f 100644 (file)
@@ -17,6 +17,7 @@
 #include <base/function.h>
 #include <base/function_parser.h>
 #include <base/parameter_handler.h>
+#include <base/utilities.h>
 #include <lac/full_matrix.h>
 #include <lac/petsc_sparse_matrix.h>
 #include <lac/petsc_vector.h>
@@ -184,7 +185,7 @@ void EigenvalueProblem<dim>::assemble_system ()
 template <int dim>
 void EigenvalueProblem<dim>::solve () 
 {
-// do whatever is necessary here  
+// do whatever is necessary here
 }
 
 
@@ -193,7 +194,19 @@ void EigenvalueProblem<dim>::solve ()
 template <int dim>
 void EigenvalueProblem<dim>::output_results () const
 {
-// do whatever is necessary here  
+  DataOut<dim> data_out;
+
+  data_out.attach_dof_handler (dof_handler);
+
+  for (unsigned int i=0; i<eigenfunctions.size(); ++i)
+    data_out.add_data_vector (eigenfunctions[i],
+                             std::string("solution") +
+                             Utilities::int_to_string(i));
+
+  data_out.build_patches ();
+
+  std::ofstream output ("eigenvectors.vtk");
+  data_out.write_vtk (output);
 }
 
 

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.