This file is indexed.

/usr/include/libmesh/newton_solver.h is in libmesh-dev 0.7.1-2ubuntu1.

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
// $Id: newton_solver.h 4009 2010-09-30 20:03:16Z roystgnr $

// The libMesh Finite Element Library.
// Copyright (C) 2002-2008 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
  
// This library 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 2.1 of the License, or (at your option) any later version.
  
// This library 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 this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef __newton_solver_h__
#define __newton_solver_h__

// C++ includes

// Local includes
#include "libmesh_common.h"
#include "linear_solver.h"
#include "reference_counted_object.h"
#include "diff_solver.h"

namespace libMesh
{

/**
 * This class defines a solver which uses the default
 * libMesh linear solver in a quasiNewton method to handle a 
 * DifferentiableSystem
 *
 * This class is part of the new DifferentiableSystem framework,
 * which is still experimental.  Users of this framework should
 * beware of bugs and future API changes.
 *
 * @author Roy H. Stogner 2006
 */

// ------------------------------------------------------------
// Solver class definition
class NewtonSolver : public DiffSolver
{
public:
  /**
   * Constructor. Requires a reference to the system
   * to be solved.
   */
  NewtonSolver (sys_type& system);
  
  /**
   * Destructor.
   */
  virtual ~NewtonSolver ();

  typedef DiffSolver Parent;

  /**
   * The reinitialization function.  This method is used after
   * changes in the mesh.
   */
  virtual void reinit ();

  /**
   * This method performs a solve, using an inexact Newton-Krylov
   * method with line search.
   */
  virtual unsigned int solve ();

  /**
   * If this is set to true, the solver is forced to test the residual
   * after each Newton step, and to reduce the length of its steps
   * whenever necessary to avoid a residual increase.
   * It is currently set to true by default; set it to false to
   * avoid unnecessary residual assembly on well-behaved systems.
   */
  bool require_residual_reduction;

  /**
   * If this is set to true, the solver is forced to test the residual
   * after each Newton step, and to reduce the length of its steps
   * whenever necessary to avoid an infinite or NaN residual.
   * It is currently set to true by default; set it to false to
   * avoid unnecessary residual assembly on well-behaved systems.
   */
  bool require_finite_residual;

  /**
   * If require_residual_reduction is true, the solver may reduce step
   * lengths when required.  If so, brent_line_search is an option.
   * If brent_line_search is set to false, the solver reduces the
   * length of its steps by 1/2 iteratively until it finds residual
   * reduction.  If true, step lengths are first reduced by 1/2 or
   * more to find some residual reduction, then Brent's method is used
   * to find as much residual reduction as possible.
   *
   * brent_line_search is currently set to true by default.
   */
  bool brent_line_search;

  /**
   * If the quasi-Newton step length must be reduced to below this
   * factor to give a residual reduction, then the Newton solver
   * dies with a libmesh_error()
   * It is currently set to 1e-5 by default.
   */
  Real minsteplength;

  /**
   * The tolerance for linear solves is kept below this multiplier (which
   * defaults to 1e-3) times the norm of the current nonlinear residual
   */
  Real linear_tolerance_multiplier;

protected:

  /**
   * The \p LinearSolver defines the interface used to
   * solve the linear_implicit system.  This class handles all the
   * details of interfacing with various linear algebra packages
   * like PETSc or LASPACK.
   */
  AutoPtr<LinearSolver<Number> > linear_solver;

  /**
   * This does a line search in the direction opposite linear_solution
   * to try and minimize the residual of newton_iterate.
   * newton_iterate is moved to the end of the quasiNewton step, and
   * the return value is the substep size.
   */
  Real line_search(Real tol, Real last_residual, Real& current_residual,
		   NumericVector<Number> &newton_iterate,
		   const NumericVector<Number> &linear_solution);

  /**
   * This prints output for the convergence criteria based on
   * by the given residual and step size.
   */
  void print_convergence(unsigned int step_num,
			 Real current_residual,
			 Real step_norm,
			 bool linear_solve_finished);

  /**
   * This returns true if a convergence criterion has been passed
   * by the given residual and step size; false otherwise.
   */
  bool test_convergence(Real current_residual,
			Real step_norm,
			bool linear_solve_finished);
};


} // namespace libMesh


#endif // #define __newton_solver_h__