This file is indexed.

/usr/include/deal.II/multigrid/mg_block_smoother.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
// ---------------------------------------------------------------------
//
// Copyright (C) 2005 - 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__mg_block_smoother_h
#define dealii__mg_block_smoother_h


#include <deal.II/base/config.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/lac/pointer_matrix.h>
#include <deal.II/lac/vector_memory.h>
#include <deal.II/lac/block_vector.h>
#include <deal.II/multigrid/mg_base.h>
#include <deal.II/base/mg_level_object.h>
#include <vector>

DEAL_II_NAMESPACE_OPEN

/*
 * MGSmootherBase is defined in mg_base.h
 */

/*!@addtogroup mg */
/*@{*/

/**
 * General smoother class for block vectors. This class gives complete freedom
 * to the choice of a block smoother by being initialized with a matrix and a
 * smoother object. Therefore, the smoother object for each level must be
 * constructed by hand.
 *
 * @author Guido Kanschat, 2005
 */
template <typename MatrixType, class RelaxationType, typename number>
class MGSmootherBlock
  : public MGSmootherBase<BlockVector<number> >
{
public:
  /**
   * Constructor. Sets memory and smoothing parameters.
   */
  MGSmootherBlock (VectorMemory<BlockVector<number> > &mem,
                   const unsigned int                   steps     = 1,
                   const bool                           variable  = false,
                   const bool                           symmetric = false,
                   const bool                           transpose = false,
                   const bool                           reverse   = false);

  /**
   * Initialize for matrices. The parameter <tt>matrices</tt> can be any
   * object having functions <tt>get_minlevel()</tt> and
   * <tt>get_maxlevel()</tt> as well as an <tt>operator[]</tt> returning a
   * reference to @p MatrixType.
   *
   * The same convention is used for the parameter <tt>smoothers</tt>, such
   * that <tt>operator[]</tt> returns the object doing the block-smoothing on
   * a single level.
   *
   * This function stores pointers to the level matrices and smoothing
   * operator for each level.
   */
  template <class MGMatrixType, class MGRelaxationType>
  void initialize (const MGMatrixType     &matrices,
                   const MGRelaxationType &smoothers);

  /**
   * Empty all vectors.
   */
  void clear ();

  /**
   * Modify the number of smoothing steps on finest level.
   */
  void set_steps (const unsigned int);

  /**
   * Switch on/off variable smoothing.
   */
  void set_variable (const bool);

  /**
   * Switch on/off symmetric smoothing.
   */
  void set_symmetric (const bool);

  /**
   * Switch on/off transposed. This is mutually exclusive with reverse().
   */
  void set_transpose (const bool);

  /**
   * Switch on/off reversed. This is mutually exclusive with transpose().
   */
  void set_reverse (const bool);

  /**
   * Implementation of the interface for @p Multigrid. This function does
   * nothing, which by comparison with the definition of this function means
   * that the the smoothing operator equals the null operator.
   */
  virtual void smooth (const unsigned int         level,
                       BlockVector<number>       &u,
                       const BlockVector<number> &rhs) const;
private:
  /**
   * Pointer to the matrices.
   */
  MGLevelObject<PointerMatrix<MatrixType, BlockVector<number> > > matrices;

  /**
   * Pointer to the matrices.
   */
  MGLevelObject<PointerMatrix<RelaxationType, BlockVector<number> > > smoothers;

  /**
   * Number of smoothing steps.
   */
  unsigned int steps;

  /**
   * Variable smoothing?
   */
  bool variable;

  /**
   * Symmetric smoothing?
   */
  bool symmetric;

  /*
   * Transposed?
   */
  bool transpose;

  /**
   * Reverse?
   */
  bool reverse;

  /**
   * Memory for auxiliary vectors.
   */
  VectorMemory<BlockVector<number> > &mem;

};

/**@}*/

//---------------------------------------------------------------------------

#ifndef DOXYGEN

template <typename MatrixType, class RelaxationType, typename number>
inline
MGSmootherBlock<MatrixType, RelaxationType, number>::MGSmootherBlock
(VectorMemory<BlockVector<number> > &mem,
 const unsigned int                  steps,
 const bool                          variable,
 const bool                          symmetric,
 const bool                          transpose,
 const bool                          reverse)
  :
  steps(steps),
  variable(variable),
  symmetric(symmetric),
  transpose(transpose),
  reverse(reverse),
  mem(mem)
{}


template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::clear ()
{
  unsigned int i=matrices.min_level(),
               max_level=matrices.max_level();
  for (; i<=max_level; ++i)
    {
      smoothers[i] = 0;
      matrices[i] = 0;
    }
}


template <typename MatrixType, class RelaxationType, typename number>
template <class MGMatrixType, class MGRelaxationType>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::initialize (const MGMatrixType &m,
    const MGRelaxationType &s)
{
  const unsigned int min = m.min_level();
  const unsigned int max = m.max_level();

  matrices.resize(min, max);
  smoothers.resize(min, max);

  for (unsigned int i=min; i<=max; ++i)
    {
      matrices[i] = &m[i];
      smoothers[i] = &s[i];
    }
}

template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::
set_steps (const unsigned int s)
{
  steps = s;
}


template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::
set_variable (const bool flag)
{
  variable = flag;
}


template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::
set_symmetric (const bool flag)
{
  symmetric = flag;
}


template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::
set_transpose (const bool flag)
{
  transpose = flag;
}


template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::
set_reverse (const bool flag)
{
  reverse = flag;
}


template <typename MatrixType, class RelaxationType, typename number>
inline void
MGSmootherBlock<MatrixType, RelaxationType, number>::smooth(const unsigned int         level,
                                                            BlockVector<number>       &u,
                                                            const BlockVector<number> &rhs) const
{
  deallog.push("Smooth");

  unsigned int maxlevel = matrices.max_level();
  unsigned int steps2 = steps;

  if (variable)
    steps2 *= (1<<(maxlevel-level));

  BlockVector<number> *r = mem.alloc();
  BlockVector<number> *d = mem.alloc();
  r->reinit(u);
  d->reinit(u);

  bool T = transpose;
  if (symmetric && (steps2 % 2 == 0))
    T = false;

  for (unsigned int i=0; i<steps2; ++i)
    {
      if (T)
        {
          matrices[level].vmult(*r,u);
          r->sadd(-1.,1.,rhs);
          smoothers[level].Tvmult(*d, *r);
        }
      else
        {
          matrices[level].vmult(*r,u);
          r->sadd(-1.,1.,rhs);
          smoothers[level].vmult(*d, *r);
        }
      u += *d;
      if (symmetric)
        T = !T;
    }

  mem.free(r);
  mem.free(d);
  deallog.pop();
}

#endif // DOXYGEN

DEAL_II_NAMESPACE_CLOSE

#endif