This file is indexed.

/usr/include/deal.II/numerics/dof_print_solver_step.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
// ---------------------------------------------------------------------
//
// Copyright (C) 2000 - 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__dof_print_solver_step_h
#define dealii__dof_print_solver_step_h

#include <deal.II/base/config.h>
#include <deal.II/base/logstream.h>
#include <deal.II/lac/solver_control.h>
#include <deal.II/lac/vector_memory.h>
#include <deal.II/numerics/data_out.h>

#include <sstream>
#include <iomanip>
#include <fstream>

DEAL_II_NAMESPACE_OPEN


/**
 * Print intermediate solutions in solvers.  This is derived from a solver
 * class provided as template argument.  It implements the @p print_vector
 * function of the solver using a DoFHandler. This way, the intermediate
 * vectors can be viewed as finite element functions. This class might be used
 * first to understand how solvers work (for example to visualize the
 * smoothing properties of various solvers, e.g. in a multigrid context), and
 * second to investigate why and how a solver fails to solve certain classes
 * of problems.
 *
 * Objects of this class are provided with a solver class through a template
 * argument, and with a file name (as a string), with which a new file is
 * constructed in each iteration (named <tt>basename.[step].[suffix]</tt>) and
 * into which the solution is written as a finite element field using the
 * DataOut class. Please note that this class may produce enormous amounts of
 * data!
 *
 * @ingroup output
 * @author Guido Kanschat, 2000
 */
template<int dim, typename SolverType, class VectorType = Vector<double> >
class DoFPrintSolverStep : public SolverType
{
public:
  /**
   * Constructor.  First, we take the arguments needed for the solver. @p
   * data_out is the object doing the output as a finite element function.
   *
   * One output file with the name <tt>basename.[step].[suffix]</tt> will be
   * produced for each iteration step.
   */
  DoFPrintSolverStep (SolverControl &control,
                      VectorMemory<VectorType> &mem,
                      DataOut<dim>             &data_out,
                      const std::string        &basename);

  /**
   * Call-back function for the iterative method.
   */
  virtual void print_vectors (const unsigned int step,
                              const VectorType   &x,
                              const VectorType   &r,
                              const VectorType   &d) const;
private:
  /**
   * Output object.
   */
  DataOut<dim> &out;

  /**
   * Base of filenames.
   */
  const std::string basename;
};


/* ----------------------- template functions --------------- */

template<int dim, typename SolverType, class VectorType>
DoFPrintSolverStep<dim, SolverType, VectorType>::DoFPrintSolverStep
(SolverControl            &control,
 VectorMemory<VectorType> &mem,
 DataOut<dim>             &data_out,
 const std::string        &basename)
  : SolverType (control, mem),
    out (data_out),
    basename (basename)
{}


template<int dim, typename SolverType, class VectorType>
void
DoFPrintSolverStep<dim, SolverType, VectorType>::print_vectors
(const unsigned int  step,
 const VectorType   &x,
 const VectorType   &r,
 const VectorType   &d) const
{
  out.clear_data_vectors();
  out.add_data_vector(x, "solution");
  out.add_data_vector(r, "residual");
  out.add_data_vector(d, "update");

  std::ostringstream filename;
  filename << basename
           << std::setw(3) << std::setfill('0') << step
           << out.default_suffix();

  const std::string fname = filename.str();

  deallog << "Writing file:" << fname << std::endl;

  out.build_patches();
  std::ofstream of (fname.c_str());
  out.write (of);
}

DEAL_II_NAMESPACE_CLOSE

#endif