From ffa54f89d24e27d3d3c9a31eae26149f4992042e Mon Sep 17 00:00:00 2001 From: frohne Date: Fri, 21 Oct 2011 01:44:05 +0000 Subject: [PATCH] Changing output_result git-svn-id: https://svn.dealii.org/trunk@24649 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-41/step-41.cc | 42 ++++++++++++----------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/deal.II/examples/step-41/step-41.cc b/deal.II/examples/step-41/step-41.cc index a790098d59..88650a1a14 100644 --- a/deal.II/examples/step-41/step-41.cc +++ b/deal.II/examples/step-41/step-41.cc @@ -94,7 +94,7 @@ class Step4 void assemble_system (); void projection_active_set (); void solve (); - void output_results (TrilinosWrappers::Vector vector_to_plot, const std::string& title) const; + void output_results (const std::string& title) const; Triangulation triangulation; FE_Q fe; @@ -366,7 +366,7 @@ template void Step4::make_grid () { GridGenerator::hyper_cube (triangulation, -1, 1); - triangulation.refine_global (7); + triangulation.refine_global (4); std::cout << " Number of active cells: " << triangulation.n_active_cells() @@ -673,7 +673,7 @@ void Step4::projection_active_set () endc = dof_handler.end(); constraints.clear(); - active_set = 0; + active_set = 0.0; for (; cell!=endc; ++cell) for (unsigned int v=0; v::vertices_per_cell; ++v) { @@ -686,7 +686,7 @@ void Step4::projection_active_set () constraints.add_line (index_x); constraints.set_inhomogeneity (index_x, obstacle_value); solution (index_x) = 0; - active_set (index_x) = 1; + active_set (index_x) = 1.0; } } @@ -753,12 +753,14 @@ void Step4::solve () // than 2 or 3, but we neglect this here for // the sake of brevity). template -void Step4::output_results (TrilinosWrappers::Vector vector_to_plot, const std::string& title) const +void Step4::output_results (const std::string& title) const { DataOut data_out; - + data_out.attach_dof_handler (dof_handler); - data_out.add_data_vector (vector_to_plot, "vector_to_plot"); + data_out.add_data_vector (solution, "Displacement"); + data_out.add_data_vector (resid_vector, "Residual"); + data_out.add_data_vector (active_set, "ActiveSet"); data_out.build_patches (); @@ -767,10 +769,10 @@ void Step4::output_results (TrilinosWrappers::Vector vector_to_plot, const (title + ".vtk").c_str ()); data_out.write_vtk (output_vtk); -// std::ofstream output_gnuplot (dim == 2 ? -// (title + ".gp").c_str () : -// (title + ".gp").c_str ()); -// data_out.write_gnuplot (output_gnuplot); + std::ofstream output_gnuplot (dim == 2 ? + (title + ".gp").c_str () : + (title + ".gp").c_str ()); + data_out.write_gnuplot (output_gnuplot); } @@ -838,20 +840,10 @@ void Step4::run () resid_vector (k) = 0; std::cout<< "Create Output:" <