Reference documentation for deal.II version 9.1.0-pre
dof_output_operator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_dof_output_operator_h
18 #define dealii_dof_output_operator_h
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/algorithms/any_data.h>
23 #include <deal.II/algorithms/operator.h>
24 
25 #include <deal.II/base/event.h>
26 #include <deal.II/base/parameter_handler.h>
27 
28 #include <deal.II/dofs/dof_handler.h>
29 
30 #include <deal.II/numerics/data_out.h>
31 
32 #include <fstream>
33 
34 DEAL_II_NAMESPACE_OPEN
35 
36 namespace Algorithms
37 {
42  template <typename VectorType, int dim, int spacedim = dim>
43  class DoFOutputOperator : public OutputOperator<VectorType>
44  {
45  public:
46  /*
47  * Constructor. The <tt>filename</tt> is the common base name of
48  * all files and the argument <tt>digits</tt> should be the number
49  * of digits of the highest number in the sequence. File names by
50  * default have the form "outputNNN" with NNN the number set by the
51  * last step command. Numbers with less digits are filled with
52  * zeros from the left.
53  */
54  DoFOutputOperator(const std::string &filename_base = std::string("output"),
55  const unsigned int digits = 3);
56 
57  void
58  parse_parameters(ParameterHandler &param);
59  void
60  initialize(const DoFHandler<dim, spacedim> &dof_handler);
61 
63  operator<<(const AnyData &vectors) override;
64 
65  private:
68  dof;
69 
70  const std::string filename_base;
71  const unsigned int digits;
72 
73  DataOut<dim> out;
74  };
75 
76  template <typename VectorType, int dim, int spacedim>
77  inline void
79  const DoFHandler<dim, spacedim> &dof_handler)
80  {
81  dof = &dof_handler;
82  }
83 } // namespace Algorithms
84 
85 
86 DEAL_II_NAMESPACE_CLOSE
87 
88 #endif
virtual OutputOperator< VectorType > & operator<<(const AnyData &vectors) override