This file is indexed.

/usr/lib/petscdir/3.1/include/petscdmmg.h is in libpetsc3.1-dev 3.1.dfsg-11ubuntu1.

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
/*
  Defines the interface functions for the DMMG object.
*/
#ifndef __PETSCDMMG_H
#define __PETSCDMMG_H
#include "petscsnes.h"
#include "petscda.h"
PETSC_EXTERN_CXX_BEGIN

/*S
     DMMGArray - Fortran only. This is used in the main program when doing DMMGCreate(), DMMGSetDM() etc.
        in the subroutines like FormFunction() one should use DMMG.

        You can use DMMGArrayGetDMMG(DMMGArray,DMMG,ierr) to obtain the DMMG from a DMMG.

   Level: intermediate

  Concepts: multigrid, Newton-multigrid

.seealso:  DMCompositeCreate(), DA, DMComposite, DM, DMMGCreate(), DMMGSetKSP(), DMMGSetSNES(), DMMGSetInitialGuess(),
           DMMGSetNullSpace(), DMMGSetMatType()
S*/

/*S
     DMMG -  Data structure to easily manage multi-level non-linear solvers on grids managed by DM
          
   Level: intermediate

   Fortran Users: see also DMMGArray

  Concepts: multigrid, Newton-multigrid

.seealso:  DMCompositeCreate(), DA, DMComposite, DM, DMMGCreate(), DMMGSetKSP(), DMMGSetSNES(), DMMGSetInitialGuess(),
           DMMGSetNullSpace(),  DMMGSetMatType()
S*/
typedef struct _n_DMMG* DMMG;
struct _n_DMMG {
  DM             dm;                   /* grid information for this level */
  Vec            x,b,r;                /* global vectors used in multigrid preconditioner for this level*/
  Mat            J;                    /* matrix on this level */
  Mat            B;
  Mat            R;                    /* restriction to next coarser level (not defined on level 0) */
  PetscInt       nlevels;              /* number of levels above this one (total number of levels on level 0)*/
  MPI_Comm       comm;
  PetscErrorCode (*solve)(DMMG*,PetscInt);
  void           *user;         
  PetscTruth     galerkin;                  /* for A_c = R*A*R^T */
  MatType        mtype;                     /* create matrices of this type */
  char           *prefix;

  /* KSP only */
  KSP            ksp;             
  PetscErrorCode (*rhs)(DMMG,Vec);

  /* SNES only */
  Vec            Rscale;                 /* scaling to restriction before computing Jacobian */
  PetscErrorCode (*computejacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,void*);  

  PetscTruth     updatejacobian;         /* compute new Jacobian when DMMGComputeJacobian_Multigrid() is called */
  PetscInt       updatejacobianperiod;   /* how often, inside a SNES, the Jacobian is recomputed */

  PetscTruth     getcoloringfrommat;     /* call a graph coloring algorithm on the matrix to get the coloring, instead of getting it from the DM */
  ISColoringType isctype;
  MatFDColoring  fdcoloring;             /* only used with FD coloring for Jacobian */  
  SNES           snes;                  
  PetscErrorCode (*initialguess)(DMMG,Vec);
  Vec            w,work1,work2;         /* global vectors */
  Vec            lwork1;

  PetscErrorCode (*lfj)(void);          /* function used when computing Jacobian via FD, usually da->lf */

  /* FAS only */
  NLF            nlf;                   /* FAS smoother object */
  VecScatter     inject;                /* inject from this level to the next coarsest */
  PetscTruth     monitor,monitorall;
  PetscInt       presmooth,postsmooth,coarsesmooth;
  PetscReal      rtol,abstol,rrtol;       /* convergence tolerance */   
  
};

EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGCreate(MPI_Comm,PetscInt,void*,DMMG**);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGDestroy(DMMG*);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetUp(DMMG*);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetKSP(DMMG*,PetscErrorCode (*)(DMMG,Vec),PetscErrorCode (*)(DMMG,Mat,Mat));
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetSNES(DMMG*,PetscErrorCode (*)(SNES,Vec,Vec,void*),PetscErrorCode (*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*));
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetFromOptions(DMMG*);

EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetInitialGuessLocal(DMMG*,PetscErrorCode (*)(void));
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetInitialGuess(DMMG*,PetscErrorCode (*)(DMMG,Vec));
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGInitialGuessCurrent(DMMG,Vec);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGView(DMMG*,PetscViewer);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSolve(DMMG*);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetUseMatrixFree(DMMG*);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetDM(DMMG*,DM);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetUpLevel(DMMG*,KSP,PetscInt);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetNullSpace(DMMG*,PetscTruth,PetscInt,PetscErrorCode (*)(DMMG,Vec[]));
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetMatType(DMMG*,const MatType);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetISColoringType(DMMG*,ISColoringType);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetOptionsPrefix(DMMG*,const char[]);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGFormFunction(SNES,Vec,Vec,void *);

EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGGetSNESLocal(DMMG*,DALocalFunction1*,DALocalFunction1*);
EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetSNESLocal_Private(DMMG*,DALocalFunction1,DALocalFunction1,DALocalFunction1,DALocalFunction1);
#if defined(PETSC_HAVE_ADIC)
#  define DMMGSetSNESLocal(dmmg,function,jacobian,ad_function,admf_function) \
  DMMGSetSNESLocal_Private(dmmg,(DALocalFunction1)function,(DALocalFunction1)jacobian,(DALocalFunction1)(ad_function),(DALocalFunction1)(admf_function))
#else
#  define DMMGSetSNESLocal(dmmg,function,jacobian,ad_function,admf_function) DMMGSetSNESLocal_Private(dmmg,(DALocalFunction1)function,(DALocalFunction1)jacobian,(DALocalFunction1)0,(DALocalFunction1)0)
#endif

EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetSNESLocali_Private(DMMG*,PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*),PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*),PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*));
#if defined(PETSC_HAVE_ADIC)
#  define DMMGSetSNESLocali(dmmg,function,ad_function,admf_function) DMMGSetSNESLocali_Private(dmmg,(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*))function,(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*))(ad_function),(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*))(admf_function))
#else
#  define DMMGSetSNESLocali(dmmg,function,ad_function,admf_function) DMMGSetSNESLocali_Private(dmmg,(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*))function,0,0)
#endif

EXTERN PetscErrorCode PETSCSNES_DLLEXPORT DMMGSetSNESLocalib_Private(DMMG*,PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*),PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*),PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*));
#if defined(PETSC_HAVE_ADIC)
#  define DMMGSetSNESLocalib(dmmg,function,ad_function,admf_function) DMMGSetSNESLocalib_Private(dmmg,(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*))function,(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*))(ad_function),(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,void*,void*))(admf_function))
#else
#  define DMMGSetSNESLocalib(dmmg,function,ad_function,admf_function) DMMGSetSNESLocalib_Private(dmmg,(PetscErrorCode(*)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*))function,0,0)
#endif

extern PetscErrorCode DMMGSetSNESLocalFD(DMMG*,DALocalFunction1);

/*MC
   DMMGGetRHS - Returns the right hand side vector from a DMMG solve on the finest grid

   Synopsis:
   Vec DMMGGetRHS(DMMG *dmmg)

   Not Collective, but resulting vector is parallel

   Input Parameters:
.   dmmg - DMMG solve context

   Level: intermediate

   Fortran Usage:
.     DMMGGetRHS(DMMG dmmg,Vec b,PetscErrorCode ierr)

.seealso: DMMGCreate(), DMMGSetSNES(), DMMGSetKSP(), DMMGSetSNESLocal(), DMMGGetRHS()

M*/
#define DMMGGetRHS(ctx)              (ctx)[(ctx)[0]->nlevels-1]->b

#define DMMGGetr(ctx)              (ctx)[(ctx)[0]->nlevels-1]->r

/*MC
   DMMGGetx - Returns the solution vector from a DMMG solve on the finest grid

   Synopsis:
   Vec DMMGGetx(DMMG *dmmg)

   Not Collective, but resulting vector is parallel

   Input Parameters:
.   dmmg - DMMG solve context

   Level: intermediate

   Fortran Usage:
.     DMMGGetx(DMMG dmmg,Vec x,PetscErrorCode ierr)

.seealso: DMMGCreate(), DMMGSetSNES(), DMMGSetKSP(), DMMGSetSNESLocal()

M*/
#define DMMGGetx(ctx)              (ctx)[(ctx)[0]->nlevels-1]->x

/*MC
   DMMGGetJ - Returns the Jacobian (matrix) for the finest level

   Synopsis:
   Mat DMMGGetJ(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetB(), DMMGGetRHS()

M*/
#define DMMGGetJ(ctx)              (ctx)[(ctx)[0]->nlevels-1]->J

/*MC
   DMMGGetComm - Returns the MPI_Comm for the finest level

   Synopsis:
   MPI_Comm DMMGGetJ(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ()

M*/
#define DMMGGetComm(ctx)           (ctx)[(ctx)[0]->nlevels-1]->comm

/*MC
   DMMGGetB - Returns the matrix for the finest level used to construct the preconditioner; usually 
              the same as the Jacobian

   Synopsis:
   Mat DMMGGetJ(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ()

M*/
#define DMMGGetB(ctx)              (ctx)[(ctx)[0]->nlevels-1]->B

/*MC
   DMMGGetFine - Returns the DMMG associated with the finest level

   Synopsis:
   DMMG DMMGGetFine(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ()

M*/
#define DMMGGetFine(ctx)           (ctx)[(ctx)[0]->nlevels-1]


/*MC
   DMMGGetKSP - Gets the KSP object (linear solver object) for the finest level

   Synopsis:
   KSP DMMGGetKSP(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

   Notes: If this is a linear problem (i.e. DMMGSetKSP() was used) then this is the 
     master linear solver. If this is a nonlinear problem (i.e. DMMGSetSNES() was used) this
     returns the KSP (linear solver) that is associated with the SNES (nonlinear solver)

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ(), KSPGetSNES()

M*/
#define DMMGGetKSP(ctx)            (ctx)[(ctx)[0]->nlevels-1]->ksp

/*MC
   DMMGGetSNES - Gets the SNES object (nonlinear solver) for the finest level

   Synopsis:
   SNES DMMGGetSNES(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

   Notes: If this is a linear problem (i.e. DMMGSetKSP() was used) then this returns PETSC_NULL

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ(), KSPGetKSP()

M*/
#define DMMGGetSNES(ctx)           (ctx)[(ctx)[0]->nlevels-1]->snes

/*MC
   DMMGGetDM - Gets the DM object on the finest level

   Synopsis:
   DM DMMGGetDM(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ(), KSPGetKSP()

M*/
#define DMMGGetDM(ctx)             ((ctx)[(ctx)[0]->nlevels-1]->dm)

/*MC
   DMMGGetDA - Gets the DA object on the finest level

   Synopsis:
   DA DMMGGetDA(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

   Notes: Use only if the DMMG was created with a DA, not a DMComposite

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ(), KSPGetKSP(), DMMGGetDMComposite()

M*/
#define DMMGGetDA(ctx)             (DA)((ctx)[(ctx)[0]->nlevels-1]->dm)

/*MC
   DMMGGetDMComposite - Gets the DMComposite object on the finest level

   Synopsis:
   DMComposite DMMGGetDMComposite(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

   Notes: Use only if the DMMG was created with a DA, not a DMComposite

.seealso: DMMGCreate(), DMMGSetUser(), DMMGGetJ(), KSPGetKSP(), DMMGGetDA()

M*/
#define DMMGGetDMComposite(ctx)        (DMComposite)((ctx)[(ctx)[0]->nlevels-1]->dm)

/*MC
   DMMGGetUser - Returns the user context for a particular level

   Synopsis:
   void* DMMGGetUser(DMMG *dmmg,PetscInt level)

   Not Collective

   Input Parameters:
+   dmmg - DMMG solve context
-   level - the number of the level you want the context for

   Level: intermediate

.seealso: DMMGCreate(), DMMGSetUser()

M*/
#define DMMGGetUser(ctx,level)     ((ctx)[level]->user)

/*MC
   DMMGSetUser - Sets the user context for a particular level

   Synopsis:
   PetscErrorCode DMMGSetUser(DMMG *dmmg,PetscInt level,void *ctx)

   Not Collective

   Input Parameters:
+   dmmg - DMMG solve context
.   level - the number of the level you want the context for
-   ctx - the context

   Level: intermediate

   Note: if the context is the same for each level just pass it in with 
         DMMGCreate() and don't call this macro

.seealso: DMMGCreate(), DMMGGetUser()

M*/
#define DMMGSetUser(ctx,level,usr) ((ctx)[level]->user = usr,0)

/*MC
   DMMGGetLevels - Gets the number of levels in a DMMG object

   Synopsis:
   PetscInt DMMGGetLevels(DMMG *dmmg)

   Not Collective

   Input Parameter:
.   dmmg - DMMG solve context

   Level: intermediate

.seealso: DMMGCreate(), DMMGGetUser()

M*/
#define DMMGGetLevels(ctx)         (ctx)[0]->nlevels

PETSC_EXTERN_CXX_END
#endif