Actual source code: shell.h
1: #pragma once
3: #include <petsc/private/matimpl.h>
4: #include <petsc/private/vecimpl.h>
6: struct _MatShellOps {
7: /* 3 */ PetscErrorCode (*mult)(Mat, Vec, Vec);
8: /* 5 */ PetscErrorCode (*multtranspose)(Mat, Vec, Vec);
9: /* 17 */ PetscErrorCode (*getdiagonal)(Mat, Vec);
10: /* 43 */ PetscErrorCode (*copy)(Mat, Mat, MatStructure);
11: /* 60 */ PetscErrorCode (*destroy)(Mat);
12: /* 121 */ PetscErrorCode (*multhermitiantranspose)(Mat, Vec, Vec);
13: };
15: struct _n_MatShellMatFunctionList {
16: PetscErrorCode (*symbolic)(Mat, Mat, Mat, void **);
17: PetscErrorCode (*numeric)(Mat, Mat, Mat, void *);
18: PetscErrorCode (*destroy)(void *);
19: MatProductType ptype;
20: char *composedname; /* string to identify routine with double dispatch */
21: char *resultname; /* result matrix type */
23: struct _n_MatShellMatFunctionList *next;
24: };
25: typedef struct _n_MatShellMatFunctionList *MatShellMatFunctionList;
27: typedef struct {
28: struct _MatShellOps ops[1];
30: /* The user will manage the scaling and shifts for the MATSHELL, not the default */
31: PetscBool managescalingshifts;
33: /* support for MatScale, MatShift and MatMultAdd */
34: PetscScalar vscale, vshift;
35: Vec dshift;
36: Vec left, right;
37: Vec left_work, right_work;
38: Vec left_add_work, right_add_work;
40: /* support for MatAXPY */
41: Mat axpy;
42: PetscScalar axpy_vscale;
43: Vec axpy_left, axpy_right;
44: PetscObjectState axpy_state;
46: /* support for ZeroRows/Columns operations */
47: IS zrows;
48: IS zcols;
49: Vec zvals;
50: Vec zvals_w;
51: VecScatter zvals_sct_r;
52: VecScatter zvals_sct_c;
54: /* MatMat operations */
55: MatShellMatFunctionList matmat;
57: /* user defined context */
58: PetscContainer ctxcontainer;
59: } Mat_Shell;
61: PETSC_INTERN PetscErrorCode MatAssemblyEnd_Shell(Mat X, MatAssemblyType assembly);