This file is indexed.

/usr/include/deal.II/lac/petsc_precondition.h is in libdeal.ii-dev 6.3.1-1.1.

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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
//---------------------------------------------------------------------------
//    $Id: petsc_precondition.h 20107 2009-11-13 15:40:05Z kronbichler $
//    Version: $Name$
//
//    Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//---------------------------------------------------------------------------
#ifndef __deal2__petsc_precondition_h
#define __deal2__petsc_precondition_h


#include <base/config.h>

#ifdef DEAL_II_USE_PETSC

#  include <lac/exceptions.h>
#  include <petscpc.h>

DEAL_II_NAMESPACE_OPEN



namespace PETScWrappers
{
                                   // forward declarations
  class MatrixBase;
  class VectorBase;
  class SolverBase;
  
  
/**
 * Base class for preconditioner classes using the PETSc functionality. The
 * classes in this hierarchy don't do a whole lot, except for providing a
 * function that sets the preconditioner and certain parameters on the
 * preconditioning context of the solver. These classes are basically here
 * only to allow a similar interface as already used for the deal.II solver
 * and preconditioner classes.
 *
 * Note that derived classes only provide interfaces to the relevant
 * functionality of PETSc. PETSc does not implement all preconditioners for
 * all matrix types. In particular, some preconditioners are not going to work
 * for parallel jobs, such as for example the ILU preconditioner.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionerBase
  {
    public:
                                       /**
                                        * Constructor. Take a pointer to the
                                        * matrix from which the preconditioner
                                        * shall be constructed.
                                        */
      PreconditionerBase (const MatrixBase &matrix);
      
                                       /**
                                        * Destructor.
                                        */
      virtual ~PreconditionerBase ();


    protected:
                                       /**
                                        * A pointer to the matrix that acts as
                                        * a preconditioner.
                                        */
      const Mat matrix;
      
                                       /**
                                        * Conversion operator to get a
                                        * representation of the matrix that
                                        * represents this preconditioner. We
                                        * use this inside the actual solver,
                                        * where we need to pass this matrix to
                                        * the PETSc solvers.
                                        */
      operator const Mat () const;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is requested by
                                        * the derived class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const = 0;

                                       /**
                                        * Make the solver class a friend,
                                        * since it needs to call the
                                        * conversion operator.
                                        */
      friend class SolverBase;
  };



/**
 * A class that implements the interface to use the PETSc Jacobi
 * preconditioner.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionJacobi : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {};

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionJacobi (const MatrixBase     &matrix,
                          const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };

      

/**
 * A class that implements the interface to use the PETSc Block Jacobi
 * preconditioner. The blocking structure of the matrix is determined by the
 * association of degrees of freedom to the individual processors in an
 * MPI-parallel job. If you use this preconditioner on a sequential job (or an
 * MPI job with only one process) then the entire matrix is the only block.
 *
 * By default, PETSc uses an ILU(0) decomposition of each diagonal block of
 * the matrix for preconditioning. This can be changed, as is explained in the
 * relevant section of the PETSc manual, but is not implemented here.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionBlockJacobi : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {};

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionBlockJacobi (const MatrixBase     &matrix,
                               const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };

      

/**
 * A class that implements the interface to use the PETSc SOR
 * preconditioner.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionSOR : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {
                                           /**
                                            * Constructor. By default,
                                            * set the damping parameter
                                            * to one.
                                            */
          AdditionalData (const double omega = 1);
	
                                           /**
                                            * Relaxation parameter.
                                            */
          double omega;
      };

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionSOR (const MatrixBase     &matrix,
                       const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };
      


/**
 * A class that implements the interface to use the PETSc SSOR
 * preconditioner.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionSSOR : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {
                                           /**
                                            * Constructor. By default,
                                            * set the damping parameter
                                            * to one.
                                            */
          AdditionalData (const double omega = 1);
	
                                           /**
                                            * Relaxation parameter.
                                            */
          double omega;
      };

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionSSOR (const MatrixBase     &matrix,
                        const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };
      


/**
 * A class that implements the interface to use the PETSc Eisenstat
 * preconditioner.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionEisenstat : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {
                                           /**
                                            * Constructor. By default,
                                            * set the damping parameter
                                            * to one.
                                            */
          AdditionalData (const double omega = 1);
	
                                           /**
                                            * Relaxation parameter.
                                            */
          double omega;
      };

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionEisenstat (const MatrixBase     &matrix,
                             const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };
      


/**
 * A class that implements the interface to use the PETSc Incomplete Cholesky
 * preconditioner.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionICC : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {
                                           /**
                                            * Constructor. By default,
                                            * set the fill-in parameter
                                            * to zero.
                                            */
          AdditionalData (const unsigned int levels = 0);
	
                                           /**
                                            * Fill-in parameter.
                                            */
          unsigned int levels;
      };

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionICC (const MatrixBase     &matrix,
                       const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };


  
/**
 * A class that implements the interface to use the PETSc ILU
 * preconditioner.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Wolfgang Bangerth, 2004
 */
  class PreconditionILU : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {
                                           /**
                                            * Constructor. By default,
                                            * set the fill-in parameter
                                            * to zero.
                                            */
          AdditionalData (const unsigned int levels = 0);
	
                                           /**
                                            * Fill-in parameter.
                                            */
          unsigned int levels;
      };

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionILU (const MatrixBase     &matrix,
                       const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };



/**
 * A class that implements the interface to use the PETSc LU
 * preconditioner. The LU decomposition is only implemented for single
 * processor machines. It should provide a convenient interface to
 * another direct solver.
 *
 * See the comment in the base class @ref PreconditionerBase for when this
 * preconditioner may or may not work.
 *
 * @ingroup PETScWrappers
 * @author Oliver Kayser-Herold, 2004
 */
  class PreconditionLU : public PreconditionerBase
  {
    public:
                                       /**
                                        * Standardized data struct to
                                        * pipe additional flags to the
                                        * preconditioner.
                                        */      
      struct AdditionalData
      {
                                           /**
                                            * Constructor. (Default values
					    * taken from function PCCreate_LU
					    * of the PetSC lib.)
                                            */
          AdditionalData (const double pivoting = 1.e-6,
			  const double zero_pivot = 1.e-12,
			  const double damping = 0.0);

                                           /**
                                            * Determines, when Pivoting is
					    * done during LU decomposition.
					    * 0.0 indicates no pivoting,
					    * and 1.0 complete pivoting.
					    * Confer PetSC manual for more
					    * details.
                                            */
          double pivoting;

                                           /**
                                            * Size at which smaller pivots
					    * are declared to be zero.
					    * Confer PetSC manual for more
					    * details.
					    */
	  double zero_pivot;					    

                                           /**
                                            * This quantity is added to the
					    * diagonal of the matrix during
					    * factorisation.
					    */
	  double damping;
      };

                                       /**
                                        * Constructor. Take the matrix which
                                        * is used to form the preconditioner,
                                        * and additional flags if there are
                                        * any.
                                        */
      PreconditionLU (const MatrixBase     &matrix,
		      const AdditionalData &additional_data = AdditionalData());
      
    protected:
                                       /**
                                        * Store a copy of the flags for this
                                        * particular preconditioner.
                                        */
      const AdditionalData additional_data;

                                       /**
                                        * Function that takes a Krylov
                                        * Subspace Preconditioner context
                                        * object, and sets the type of
                                        * preconditioner that is appropriate
                                        * for the present class.
                                        */
      virtual void set_preconditioner_type (PC &pc) const;      
  };

}


DEAL_II_NAMESPACE_CLOSE


#endif // DEAL_II_USE_PETSC

/*----------------------------   petsc_precondition.h     ---------------------------*/

#endif
/*----------------------------   petsc_precondition.h     ---------------------------*/