Reference documentation for deal.II version 9.1.0-pre
operator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2018 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_operator_h
18 #define dealii_operator_h
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/algorithms/any_data.h>
23 
24 #include <deal.II/base/event.h>
25 
26 #include <fstream>
27 
28 DEAL_II_NAMESPACE_OPEN
29 
41 namespace Algorithms
42 {
72  class OperatorBase : public Subscriptor
73  {
74  public:
78  virtual ~OperatorBase() override = default;
79 
83  virtual void
84  operator()(AnyData &out, const AnyData &in) = 0;
85 
89  virtual void
90  notify(const Event &);
94  void
95  clear_events();
96 
97  protected:
103  };
104 
111  template <typename VectorType>
113  {
114  public:
118  OutputOperator();
119 
124  OutputOperator(const OutputOperator<VectorType> &) = delete;
125 
129  virtual ~OutputOperator() override = default;
130 
135  void
136  initialize_stream(std::ostream &stream);
140  void
141  set_step(const unsigned int step);
146  operator<<(const AnyData &vectors);
147 
148  protected:
149  unsigned int step;
150 
151  private:
152  std::ostream *os;
153  };
154 
155  template <typename VectorType>
156  inline void
158  {
159  step = s;
160  }
161 
162 
168  template <typename VectorType>
170  operator<<(OutputOperator<VectorType> &out, unsigned int step)
171  {
172  out.set_step(step);
173  return out;
174  }
175 } // namespace Algorithms
176 
177 DEAL_II_NAMESPACE_CLOSE
178 
179 #endif
virtual void operator()(AnyData &out, const AnyData &in)=0
virtual void notify(const Event &)
Definition: operator.cc:41
virtual ~OperatorBase() override=default
OutputOperator< VectorType > & operator<<(OutputOperator< VectorType > &out, unsigned int step)
Definition: operator.h:170
void set_step(const unsigned int step)
Definition: operator.h:157