This file is indexed.

/usr/include/dolfin/multistage/PointIntegralSolver.h is in libdolfin-dev 1.4.0+dfsg-4.

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
// Copyright (C) 2013 Johan Hake
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can 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 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added:  2013-02-15
// Last changed: 2014-03-10

#ifndef __POINTINTEGRALSOLVER_H
#define __POINTINTEGRALSOLVER_H

#include <vector>
#include <set>
#include <memory>

#include <dolfin/common/Variable.h>
#include <dolfin/fem/Assembler.h>

namespace dolfin
{

  /// This class is a time integrator for general Runge Kutta forms,
  /// which only includes Point integrals with piecewise linear test
  /// functions. Such problems are disconnected at the vertices and
  /// can therefore be solved locally.

  // Forward declarations
  class MultiStageScheme;
  class UFC;

  class PointIntegralSolver : public Variable
  {
  public:

    /// Constructor
    /// FIXME: Include version where one can pass a Solver and/or Parameters
    PointIntegralSolver(std::shared_ptr<MultiStageScheme> scheme);

    /// Destructor
    ~PointIntegralSolver();

    /// Step solver with time step dt
    void step(double dt);

    /// Step solver an interval using dt as time step
    void step_interval(double t0, double t1, double dt);

    /// Return the MultiStageScheme
    std::shared_ptr<MultiStageScheme> scheme() const
    { return _scheme; }

    /// Default parameter values
    static Parameters default_parameters()
    {
      Parameters p("point_integral_solver");

      p.add("reset_stage_solutions", true);

      // Set parameters for NewtonSolver
      Parameters pn("newton_solver");
      pn.add("maximum_iterations", 40);
      pn.add("recompute_jacobian_for_linear_problems", false);
      pn.add("always_recompute_jacobian", false);
      pn.add("recompute_jacobian_each_solve", false);
      pn.add("relaxation_parameter", 1., 0., 1.);
      pn.add("relative_tolerance", 1e-10, 1e-20, 1e-3);

      pn.add("kappa", 0.1, 0.05, 1.0);
      pn.add("eta_0", 1., 1e-15, 1.0);
      pn.add("max_relative_previous_residual", 1e-1, 1e-5, 1.0);
      pn.add("reset_each_step", true);
      pn.add("report", false);
      pn.add("report_vertex", 0, 0, 32767);
      pn.add("verbose_report", false);

      p.add(pn);

      return p;
    }

    // Reset newton solver
    void reset_newton_solver();

    // Reset stage solutions
    void reset_stage_solutions();

    // Return number of computations of jacobian
    std::size_t num_jacobian_computations() const
    {
      return _num_jacobian_computations;
    }

  private:

    // Convergence critera for simplified Newton solver
    enum convergence_criteria_t
    {

      converged,
      too_slow,
      exceeds_max_iter,
      diverge

    };

    // In-place LU factorization of jacobian matrix
    void _lu_factorize(std::vector<double>& A);

    // Forward backward substitution, assume that mat is already
    // inplace LU factorized
    void _forward_backward_subst(const std::vector<double>& A,
				 const std::vector<double>& b,
				 std::vector<double>& x) const;

    // Compute jacobian using passed UFC form
    void _compute_jacobian(std::vector<double>& jac, const std::vector<double>& u,
			   unsigned int local_vert, UFC& loc_ufc,
			   const Cell& cell, const ufc::cell& ufc_cell,
			   int coefficient_index,
			   const std::vector<double>& vertex_coordinates);

    // Compute the norm of a vector
    double _norm(const std::vector<double>& vec) const;

    // Check the forms making sure they only include piecewise linear
    // test functions
    void _check_forms();

    // Build map between vertices, cells and the correspondning local vertex
    // and initialize UFC data for each form
    void _init();

    // Solve an explicit stage
    void _solve_explicit_stage(std::size_t vert_ind, unsigned int stage,
                               const ufc::cell& ufc_cell,
			       const std::vector<double>& vertex_coordinates);

    // Solve an implicit stage
    void _solve_implicit_stage(std::size_t vert_ind, unsigned int stage,
			       const Cell& cell, const ufc::cell& ufc_cell,
			       const std::vector<double>& vertex_coordinates);

    void _simplified_newton_solve(std::size_t vert_ind, unsigned int stage,
				  const Cell& cell, const ufc::cell& ufc_cell,
				  const std::vector<double>& vertex_coordinates);

    // The MultiStageScheme
    std::shared_ptr<MultiStageScheme> _scheme;

    // Reference to mesh
    const Mesh& _mesh;

    // The dofmap (Same for all stages and forms)
    const GenericDofMap& _dofmap;

    // Size of ODE system
    const std::size_t _system_size;

    // Offset into local dofmap
    // FIXME: Consider put in local loop
    const unsigned int _dof_offset;

    // Number of stages
    const unsigned int _num_stages;

    // Local to local dofs to be used in tabulate entity dofs
    std::vector<std::size_t> _local_to_local_dofs;

    // Vertex map between vertices, cells and corresponding local vertex
    std::vector<std::pair<std::size_t, unsigned int> > _vertex_map;

    // Local to global dofs used when solution is fanned out to global vector
    std::vector<dolfin::la_index> _local_to_global_dofs;

    // Local stage solutions
    std::vector<std::vector<double> > _local_stage_solutions;

    // Local solutions
    std::vector<double> _u0;
    std::vector<double> _residual;
    std::vector<double> _y;
    std::vector<double> _dx;

    // UFC objects, one for each form
    std::vector<std::vector<std::shared_ptr<UFC> > > _ufcs;

    // UFC objects for the last form
    std::shared_ptr<UFC> _last_stage_ufc;

    // Solution coefficient index in form
    std::vector<std::vector<int> > _coefficient_index;

    // Flag which is set to false once the jacobian has been computed
    std::vector<bool> _recompute_jacobian;

    // Jacobians/LU factorized jacobians matrices
    std::vector<std::vector<double> > _jacobians;

    // Variable used in the estimation of the error of the newton
    // iteration for the first iteration (Important for linear problems!)
    double _eta;

    // Number of computations of Jacobian
    std::size_t _num_jacobian_computations;

  };

}

#endif