PCGalerkinSetComputeSubmatrix#

Provide a routine that will be called to compute the Galerkin submatrix

Synopsis#

#include "petscksp.h" 
PetscErrorCode PCGalerkinSetComputeSubmatrix(PC pc, PetscErrorCode (*computeAsub)(PC, Mat, Mat, Mat *, void *), void *ctx)

Logically Collective

Input Parameters#

  • pc - the preconditioner context

  • computeAsub - routine that computes the submatrix from the global matrix

  • ctx - context used by the routine, or NULL

Calling sequence of computeAsub#

PetscErrorCode computeAsub(PC pc, Mat A, Mat Ap, Mat *cAP, void *ctx);
  • PC - the PCGALERKIN

  • A - the matrix in the PCGALERKIN

  • Ap - the computed submatrix from any previous computation, if NULL it has not previously been computed

  • cAp - the submatrix computed by this routine

  • ctx - optional user-defined function context

Notes#

Instead of providing this routine you can call PCGalerkinGetKSP() and then KSPSetOperators() to provide the submatrix, but that will not work for multiple KSPSolve()s with different matrices unless you call it for each solve.

This routine is called each time the outer matrix is changed. In the first call the Ap argument is NULL and the routine should create the matrix and computes its values in cAp. On each subsequent call the routine should up the Ap matrix.

Developer Note#

If the user does not call this routine nor call PCGalerkinGetKSP() and KSPSetOperators() then PCGALERKIN could automatically compute the submatrix via calls to MatGalerkin() or MatRARt()

See Also#

PC, PCCreate(), PCSetType(), PCType, PCGALERKIN, PCGalerkinSetRestriction(), PCGalerkinSetInterpolation(), PCGalerkinGetKSP()

Level#

Intermediate

Location#

src/ksp/pc/impls/galerkin/galerkin.c

Implementations#

PCGalerkinSetComputeSubmatrix_Galerkin(PC pc, PetscErrorCode (*computeAsub) in src/ksp/pc/impls/galerkin/galerkin.c


Edit on GitLab

Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages