Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dof_output_operator.templates.h
1 // ---------------------------------------------------------------------
2 // @f$Id: dof_output_operator.templates.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2006 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 
18 #include <deal.II/numerics/dof_output_operator.h>
19 #include <deal.II/numerics/data_out.h>
20 
21 DEAL_II_NAMESPACE_OPEN
22 
23 namespace Algorithms
24 {
25  template <class VECTOR, int dim, int spacedim>
26  OutputOperator<VECTOR> &
28  const NamedData<VECTOR *> &vectors)
29  {
30  Assert ((dof!=0), ExcNotInitialized());
31  DataOut<dim> out;
32  out.attach_dof_handler (*dof);
33  out.add_data_vector (*vectors(vectors.find("solution")), "solution");
34  out.add_data_vector (*vectors(vectors.find("update")), "update");
35  out.add_data_vector (*vectors(vectors.find("residual")), "residual");
36  std::ostringstream streamOut;
37  streamOut << "Newton_" << std::setw(3) << std::setfill('0') << this->step;
38  std::ofstream out_filename (streamOut.str().c_str());
39  out.build_patches (2);
40  out.write_gnuplot (out_filename);
41  return *this;
42  }
43 }
44 
45 DEAL_II_NAMESPACE_CLOSE
virtual OutputOperator< VECTOR > & operator<<(const NamedData< VECTOR * > &vectors)
virtual void build_patches(const unsigned int n_subdivisions=0)
#define Assert(cond, exc)
Definition: exceptions.h:299
void add_data_vector(const VECTOR &data, const std::vector< std::string > &names, const DataVectorType type=type_automatic, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation=std::vector< DataComponentInterpretation::DataComponentInterpretation >())
unsigned int find(const std::string &name) const
Find index of a named object.
Definition: named_data.h:384
void write_gnuplot(std::ostream &out) const
::ExceptionBase & ExcNotInitialized()
void attach_dof_handler(const DH &)