/usr/include/deal.II/algorithms/operator.h is in libdeal.ii-dev 8.4.2-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | // ---------------------------------------------------------------------
//
// Copyright (C) 2010 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef dealii__operator_h
#define dealii__operator_h
#include <deal.II/base/config.h>
#include <deal.II/algorithms/any_data.h>
#include <deal.II/base/event.h>
#include <fstream>
DEAL_II_NAMESPACE_OPEN
/**
* Namespace containing numerical algorithms in a unified form.
*
* All algorithmic classes in this namespace are derived from either Operator
* or OutputOperator, depending on whether they return a value or not. See the
* documentation of those classes for more detailed information on how to use
* them.
*
* @author Guido Kanschat
* @date 2012, 2013
*/
namespace Algorithms
{
/**
* @todo Update this documentation and the one of Operator
*
* The abstract base class of all algorithms in this library. An operator is
* an object with an operator(), which transforms a set of named vectors
* into another set of named vectors.
*
* Furthermore, an operator can be notified of parameter changes by the
* calling routine. The outer iteration can notify() the Operator of an
* Event, which could be for instance a change of mesh, a different time
* step size or too slow convergence of Newton's method, which would then
* trigger reassembling of a matrix or similar things.
*
* <h3>Usage for nested iterations</h3>
*
* This is probably the most prominent use for Operator, where an outer
* iterative method calls an inner solver and so on. Typically, the
* innermost method in such a nested system will have to compute a residual
* using values from all outer iterations. Since the depth and order of such
* a nesting is hardly predictable when designing a general tool, we use
* AnyData to access these vectors. Typically, the first vector in
* <tt>out</tt> contains the start vector when operator()() is called, and
* the solution when the function returns. The object <tt>in</tt> is
* providing additional information and forwarded to the inner Operator
* objects of the nested iteration.
*
* @author Guido Kanschat
* @date 2014
*/
class OperatorBase : public Subscriptor
{
public:
/**
* The virtual destructor.
*/
~OperatorBase();
/**
* The actual operation, which is implemented in a derived class.
*/
virtual void operator() (AnyData &out, const AnyData &in) = 0;
/**
* Register an event triggered by an outer iteration.
*/
virtual void notify(const Event &);
/**
* Clear all #notifications.
*/
void clear_events();
protected:
/**
* Accumulate events here. If any of those is set, the function solve() of
* a terminal application must take care of reassembling the matrix.
*/
Event notifications;
};
/**
* An unary operator base class, intended to output the vectors in AnyData
* in each step of an iteration.
*
* @author Guido Kanschat, 2010
*/
template <typename VectorType>
class OutputOperator : public Subscriptor
{
OutputOperator(const OutputOperator<VectorType> &);
public:
OutputOperator ();
/**
* Empty virtual destructor.
*/
virtual ~OutputOperator();
/**
* Set the stream @p os to which data is written. If no stream is selected
* with this function, data goes to @p deallog.
*/
void initialize_stream(std::ostream &stream);
/**
* Set the current step.
*/
void set_step(const unsigned int step);
/**
* Output all the vectors in AnyData.
*/
virtual OutputOperator<VectorType> &operator<< (const AnyData &vectors);
protected:
unsigned int step;
private:
std::ostream *os;
};
template <typename VectorType>
inline
void
OutputOperator<VectorType>::set_step (const unsigned int s)
{
step = s;
}
/**
* Set the step number in OutputOperator by shifting an integer value.
*
* @relates OutputOperator
*/
template <typename VectorType>
inline
OutputOperator<VectorType> &
operator<< (OutputOperator<VectorType> &out, unsigned int step)
{
out.set_step(step);
return out;
}
}
DEAL_II_NAMESPACE_CLOSE
#endif
|