| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| 3 | SLEPc - Scalable Library for Eigenvalue Problem Computations | ||
| 4 | Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain | ||
| 5 | |||
| 6 | This file is part of SLEPc. | ||
| 7 | SLEPc is distributed under a 2-clause BSD license (see LICENSE). | ||
| 8 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| 9 | */ | ||
| 10 | /* | ||
| 11 | This provides a simple shell interface for programmers to create | ||
| 12 | their own spectral transformations without writing much interface code | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <slepc/private/stimpl.h> /*I "slepcst.h" I*/ | ||
| 16 | |||
| 17 | typedef struct { | ||
| 18 | void *ctx; /* user-provided context */ | ||
| 19 | STShellDestroyFn *destroy; /* context destroy */ | ||
| 20 | STShellApplyFn *apply; | ||
| 21 | STShellApplyTransposeFn *applytrans; | ||
| 22 | STShellApplyHermitianTransposeFn *applyhermtrans; | ||
| 23 | STShellBackTransformFn *backtransform; | ||
| 24 | } ST_SHELL; | ||
| 25 | |||
| 26 | 283889 | static PetscErrorCode STShellGetContext_Shell(ST st,PetscCtxRt ctx) | |
| 27 | { | ||
| 28 | 283889 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 29 | |||
| 30 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
283889 | PetscFunctionBegin; |
| 31 | 283889 | *(void**)ctx = shell->ctx; | |
| 32 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
283889 | PetscFunctionReturn(PETSC_SUCCESS); |
| 33 | } | ||
| 34 | |||
| 35 | /*@C | ||
| 36 | STShellGetContext - Returns the user-provided context associated with an `STSHELL`. | ||
| 37 | |||
| 38 | Not Collective | ||
| 39 | |||
| 40 | Input Parameter: | ||
| 41 | . st - spectral transformation context | ||
| 42 | |||
| 43 | Output Parameter: | ||
| 44 | . ctx - the user provided context | ||
| 45 | |||
| 46 | Level: advanced | ||
| 47 | |||
| 48 | .seealso: [](ch:st), `STSHELL`, `STShellSetContext()` | ||
| 49 | @*/ | ||
| 50 | 283889 | PetscErrorCode STShellGetContext(ST st,PetscCtxRt ctx) | |
| 51 | { | ||
| 52 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
283889 | PetscFunctionBegin; |
| 53 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
283889 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 54 |
2/8✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
283889 | PetscAssertPointer(ctx,2); |
| 55 |
9/16✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 2 times.
|
283889 | PetscUseMethod(st,"STShellGetContext_C",(ST,PetscCtxRt),(st,ctx)); |
| 56 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
283889 | PetscFunctionReturn(PETSC_SUCCESS); |
| 57 | } | ||
| 58 | |||
| 59 | 254 | static PetscErrorCode STShellSetContext_Shell(ST st,PetscCtx ctx) | |
| 60 | { | ||
| 61 | 254 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 62 | |||
| 63 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
254 | PetscFunctionBegin; |
| 64 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
254 | if (shell->destroy) PetscCall((*shell->destroy)(st)); |
| 65 | 254 | shell->ctx = ctx; | |
| 66 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
254 | PetscFunctionReturn(PETSC_SUCCESS); |
| 67 | } | ||
| 68 | |||
| 69 | /*@ | ||
| 70 | STShellSetContext - Sets the user-defined context for an `STSHELL`. | ||
| 71 | |||
| 72 | Logically Collective | ||
| 73 | |||
| 74 | Input Parameters: | ||
| 75 | + st - the shell `ST` | ||
| 76 | - ctx - the context | ||
| 77 | |||
| 78 | Level: advanced | ||
| 79 | |||
| 80 | Fortran Notes: | ||
| 81 | To use this from Fortran you must write a Fortran interface definition | ||
| 82 | for this function that tells Fortran the Fortran derived data type that | ||
| 83 | you are passing in as the `ctx` argument. | ||
| 84 | |||
| 85 | .seealso: [](ch:st), `STSHELL`, `STShellGetContext()`, `STShellSetDestroy()` | ||
| 86 | @*/ | ||
| 87 | 254 | PetscErrorCode STShellSetContext(ST st,PetscCtx ctx) | |
| 88 | { | ||
| 89 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
254 | PetscFunctionBegin; |
| 90 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
254 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 91 |
8/14✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
|
254 | PetscTryMethod(st,"STShellSetContext_C",(ST,PetscCtx),(st,ctx)); |
| 92 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
254 | PetscFunctionReturn(PETSC_SUCCESS); |
| 93 | } | ||
| 94 | |||
| 95 | 40 | static PetscErrorCode STShellSetDestroy_Shell(ST st,STShellDestroyFn *destroy) | |
| 96 | { | ||
| 97 | 40 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 98 | |||
| 99 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
40 | PetscFunctionBegin; |
| 100 | 40 | shell->destroy = destroy; | |
| 101 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
40 | PetscFunctionReturn(PETSC_SUCCESS); |
| 102 | } | ||
| 103 | |||
| 104 | /*@C | ||
| 105 | STShellSetDestroy - Set a context destroy function for the `STSHELL` context. | ||
| 106 | |||
| 107 | Logically Collective | ||
| 108 | |||
| 109 | Input Parameters: | ||
| 110 | + st - the shell `ST` | ||
| 111 | - destroy - context destroy function, see `STShellDestroyFn` for its calling sequence | ||
| 112 | |||
| 113 | Level: advanced | ||
| 114 | |||
| 115 | .seealso: [](ch:st), `STSHELL`, STShellSetContext()` | ||
| 116 | @*/ | ||
| 117 | 40 | PetscErrorCode STShellSetDestroy(ST st,STShellDestroyFn *destroy) | |
| 118 | { | ||
| 119 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
40 | PetscFunctionBegin; |
| 120 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
40 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 121 |
8/14✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
|
40 | PetscTryMethod(st,"STShellSetDestroy_C",(ST,STShellDestroyFn*),(st,destroy)); |
| 122 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
40 | PetscFunctionReturn(PETSC_SUCCESS); |
| 123 | } | ||
| 124 | |||
| 125 | 24192 | static PetscErrorCode STApply_Shell(ST st,Vec x,Vec y) | |
| 126 | { | ||
| 127 | 24192 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 128 | 24192 | PetscObjectState instate,outstate; | |
| 129 | |||
| 130 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
24192 | PetscFunctionBegin; |
| 131 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
24192 | PetscCheck(shell->apply,PetscObjectComm((PetscObject)st),PETSC_ERR_USER,"No apply() routine provided to Shell ST"); |
| 132 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
24192 | PetscCall(VecGetState(y,&instate)); |
| 133 |
14/26✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 2 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 2 times.
|
24192 | PetscCallBack("STSHELL user function apply()",(*shell->apply)(st,x,y)); |
| 134 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
24192 | PetscCall(VecGetState(y,&outstate)); |
| 135 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
24192 | if (instate == outstate) { |
| 136 | /* user forgot to increase the state of the output vector */ | ||
| 137 | ✗ | PetscCall(PetscObjectStateIncrease((PetscObject)y)); | |
| 138 | } | ||
| 139 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
5969 | PetscFunctionReturn(PETSC_SUCCESS); |
| 140 | } | ||
| 141 | |||
| 142 | 628 | static PetscErrorCode STApplyTranspose_Shell(ST st,Vec x,Vec y) | |
| 143 | { | ||
| 144 | 628 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 145 | 628 | PetscObjectState instate,outstate; | |
| 146 | |||
| 147 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
628 | PetscFunctionBegin; |
| 148 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
628 | PetscCheck(shell->applytrans,PetscObjectComm((PetscObject)st),PETSC_ERR_USER,"No applytrans() routine provided to Shell ST"); |
| 149 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
628 | PetscCall(VecGetState(y,&instate)); |
| 150 |
14/26✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 2 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 2 times.
|
628 | PetscCallBack("STSHELL user function applytrans()",(*shell->applytrans)(st,x,y)); |
| 151 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
628 | PetscCall(VecGetState(y,&outstate)); |
| 152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
628 | if (instate == outstate) { |
| 153 | /* user forgot to increase the state of the output vector */ | ||
| 154 | ✗ | PetscCall(PetscObjectStateIncrease((PetscObject)y)); | |
| 155 | } | ||
| 156 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
147 | PetscFunctionReturn(PETSC_SUCCESS); |
| 157 | } | ||
| 158 | |||
| 159 | #if defined(PETSC_USE_COMPLEX) | ||
| 160 | 364 | static PetscErrorCode STApplyHermitianTranspose_Shell(ST st,Vec x,Vec y) | |
| 161 | { | ||
| 162 | 364 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 163 | 364 | PetscObjectState instate,outstate; | |
| 164 | 364 | Vec w; | |
| 165 | |||
| 166 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
364 | PetscFunctionBegin; |
| 167 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
364 | if (shell->applyhermtrans) { |
| 168 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
80 | PetscCall(VecGetState(y,&instate)); |
| 169 |
14/26✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 times.
|
80 | PetscCallBack("STSHELL user function applyhermtrans()",(*shell->applyhermtrans)(st,x,y)); |
| 170 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
80 | PetscCall(VecGetState(y,&outstate)); |
| 171 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
80 | if (instate == outstate) { |
| 172 | /* user forgot to increase the state of the output vector */ | ||
| 173 | ✗ | PetscCall(PetscObjectStateIncrease((PetscObject)y)); | |
| 174 | } | ||
| 175 | } else { | ||
| 176 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
284 | PetscCall(VecDuplicate(x,&w)); |
| 177 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
284 | PetscCall(VecCopy(x,w)); |
| 178 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
284 | PetscCall(VecConjugate(w)); |
| 179 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
284 | PetscCall(STApplyTranspose_Shell(st,w,y)); |
| 180 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
284 | PetscCall(VecDestroy(&w)); |
| 181 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
284 | PetscCall(VecConjugate(y)); |
| 182 | } | ||
| 183 |
6/12✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
76 | PetscFunctionReturn(PETSC_SUCCESS); |
| 184 | } | ||
| 185 | #endif | ||
| 186 | |||
| 187 | 275353 | static PetscErrorCode STBackTransform_Shell(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) | |
| 188 | { | ||
| 189 | 275353 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 190 | |||
| 191 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
275353 | PetscFunctionBegin; |
| 192 |
16/28✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 2 times.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 2 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 2 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 2 times.
|
275353 | if (shell->backtransform) PetscCallBack("STSHELL user function backtransform()",(*shell->backtransform)(st,n,eigr,eigi)); |
| 193 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
67727 | PetscFunctionReturn(PETSC_SUCCESS); |
| 194 | } | ||
| 195 | |||
| 196 | /* | ||
| 197 | STIsInjective_Shell - Check if the user has provided the backtransform operation. | ||
| 198 | */ | ||
| 199 | 264 | PetscErrorCode STIsInjective_Shell(ST st,PetscBool* is) | |
| 200 | { | ||
| 201 | 264 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 202 | |||
| 203 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
264 | PetscFunctionBegin; |
| 204 | 264 | *is = shell->backtransform? PETSC_TRUE: PETSC_FALSE; | |
| 205 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
264 | PetscFunctionReturn(PETSC_SUCCESS); |
| 206 | } | ||
| 207 | |||
| 208 | 296 | static PetscErrorCode STDestroy_Shell(ST st) | |
| 209 | { | ||
| 210 | 296 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 211 | |||
| 212 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
296 | PetscFunctionBegin; |
| 213 |
6/8✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
|
296 | if (shell->destroy) PetscCall((*shell->destroy)(st)); |
| 214 |
5/8✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
|
296 | PetscCall(PetscFree(st->data)); |
| 215 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellGetContext_C",NULL)); |
| 216 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetContext_C",NULL)); |
| 217 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetDestroy_C",NULL)); |
| 218 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApply_C",NULL)); |
| 219 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyTranspose_C",NULL)); |
| 220 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyHermitianTranspose_C",NULL)); |
| 221 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetBackTransform_C",NULL)); |
| 222 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
71 | PetscFunctionReturn(PETSC_SUCCESS); |
| 223 | } | ||
| 224 | |||
| 225 | 264 | static PetscErrorCode STShellSetApply_Shell(ST st,STShellApplyFn *apply) | |
| 226 | { | ||
| 227 | 264 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 228 | |||
| 229 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
264 | PetscFunctionBegin; |
| 230 | 264 | shell->apply = apply; | |
| 231 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
264 | PetscFunctionReturn(PETSC_SUCCESS); |
| 232 | } | ||
| 233 | |||
| 234 | /*@C | ||
| 235 | STShellSetApply - Sets routine to use as the application of the | ||
| 236 | operator to a vector in the user-defined spectral transformation. | ||
| 237 | |||
| 238 | Logically Collective | ||
| 239 | |||
| 240 | Input Parameters: | ||
| 241 | + st - the spectral transformation context | ||
| 242 | - apply - the application-provided transformation routine | ||
| 243 | |||
| 244 | Level: advanced | ||
| 245 | |||
| 246 | .seealso: [](ch:st), `STSHELL`, `STShellSetBackTransform()`, `STShellSetApplyTranspose()`, `STShellSetApplyHermitianTranspose()` | ||
| 247 | @*/ | ||
| 248 | 264 | PetscErrorCode STShellSetApply(ST st,STShellApplyFn *apply) | |
| 249 | { | ||
| 250 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
264 | PetscFunctionBegin; |
| 251 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
264 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 252 |
8/14✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
|
264 | PetscTryMethod(st,"STShellSetApply_C",(ST,STShellApplyFn*),(st,apply)); |
| 253 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
264 | PetscFunctionReturn(PETSC_SUCCESS); |
| 254 | } | ||
| 255 | |||
| 256 | 58 | static PetscErrorCode STShellSetApplyTranspose_Shell(ST st,STShellApplyTransposeFn *applytrans) | |
| 257 | { | ||
| 258 | 58 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 259 | |||
| 260 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
58 | PetscFunctionBegin; |
| 261 | 58 | shell->applytrans = applytrans; | |
| 262 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
58 | PetscFunctionReturn(PETSC_SUCCESS); |
| 263 | } | ||
| 264 | |||
| 265 | /*@C | ||
| 266 | STShellSetApplyTranspose - Sets routine to use as the application of the | ||
| 267 | transposed operator to a vector in the user-defined spectral transformation. | ||
| 268 | |||
| 269 | Logically Collective | ||
| 270 | |||
| 271 | Input Parameters: | ||
| 272 | + st - the spectral transformation context | ||
| 273 | - applytrans - the application-provided transformation routine | ||
| 274 | |||
| 275 | Level: advanced | ||
| 276 | |||
| 277 | .seealso: [](ch:st), `STSHELL`, `STShellSetApply()`, `STShellSetBackTransform()` | ||
| 278 | @*/ | ||
| 279 | 58 | PetscErrorCode STShellSetApplyTranspose(ST st,STShellApplyTransposeFn *applytrans) | |
| 280 | { | ||
| 281 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
58 | PetscFunctionBegin; |
| 282 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
58 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 283 |
8/14✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
|
58 | PetscTryMethod(st,"STShellSetApplyTranspose_C",(ST,STShellApplyTransposeFn*),(st,applytrans)); |
| 284 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
58 | PetscFunctionReturn(PETSC_SUCCESS); |
| 285 | } | ||
| 286 | |||
| 287 | #if defined(PETSC_USE_COMPLEX) | ||
| 288 | 10 | static PetscErrorCode STShellSetApplyHermitianTranspose_Shell(ST st,STShellApplyHermitianTransposeFn *applyhermtrans) | |
| 289 | { | ||
| 290 | 10 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 291 | |||
| 292 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
10 | PetscFunctionBegin; |
| 293 | 10 | shell->applyhermtrans = applyhermtrans; | |
| 294 |
6/12✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
10 | PetscFunctionReturn(PETSC_SUCCESS); |
| 295 | } | ||
| 296 | #endif | ||
| 297 | |||
| 298 | /*@C | ||
| 299 | STShellSetApplyHermitianTranspose - Sets routine to use as the application of the | ||
| 300 | conjugate-transposed operator to a vector in the user-defined spectral transformation. | ||
| 301 | |||
| 302 | Logically Collective | ||
| 303 | |||
| 304 | Input Parameters: | ||
| 305 | + st - the spectral transformation context | ||
| 306 | - applyhermtrans - the application-provided transformation routine | ||
| 307 | |||
| 308 | Note: | ||
| 309 | If configured with real scalars, this function has the same effect as `STShellSetApplyTranspose()`, | ||
| 310 | so no need to call both. | ||
| 311 | |||
| 312 | Level: advanced | ||
| 313 | |||
| 314 | .seealso: [](ch:st), `STSHELL`, `STShellSetApply()`, `STShellSetApplyTranspose()`, `STShellSetBackTransform()` | ||
| 315 | @*/ | ||
| 316 | 10 | PetscErrorCode STShellSetApplyHermitianTranspose(ST st,STShellApplyHermitianTransposeFn *applyhermtrans) | |
| 317 | { | ||
| 318 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
10 | PetscFunctionBegin; |
| 319 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
10 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 320 |
8/14✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
|
10 | PetscTryMethod(st,"STShellSetApplyHermitianTranspose_C",(ST,STShellApplyHermitianTransposeFn*),(st,applyhermtrans)); |
| 321 |
6/12✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
10 | PetscFunctionReturn(PETSC_SUCCESS); |
| 322 | } | ||
| 323 | |||
| 324 | 256 | static PetscErrorCode STShellSetBackTransform_Shell(ST st,STShellBackTransformFn *backtr) | |
| 325 | { | ||
| 326 | 256 | ST_SHELL *shell = (ST_SHELL*)st->data; | |
| 327 | |||
| 328 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
256 | PetscFunctionBegin; |
| 329 | 256 | shell->backtransform = backtr; | |
| 330 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
256 | PetscFunctionReturn(PETSC_SUCCESS); |
| 331 | } | ||
| 332 | |||
| 333 | /*@C | ||
| 334 | STShellSetBackTransform - Sets the routine to be called after the | ||
| 335 | eigensolution process has finished in order to transform back the | ||
| 336 | computed eigenvalues. | ||
| 337 | |||
| 338 | Logically Collective | ||
| 339 | |||
| 340 | Input Parameters: | ||
| 341 | + st - the spectral transformation context | ||
| 342 | - backtr - the application-provided backtransform routine | ||
| 343 | |||
| 344 | Level: advanced | ||
| 345 | |||
| 346 | .seealso: [](ch:st), `STSHELL`, `STShellSetApply()`, `STShellSetApplyTranspose()` | ||
| 347 | @*/ | ||
| 348 | 256 | PetscErrorCode STShellSetBackTransform(ST st,STShellBackTransformFn *backtr) | |
| 349 | { | ||
| 350 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
256 | PetscFunctionBegin; |
| 351 |
3/16✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
256 | PetscValidHeaderSpecific(st,ST_CLASSID,1); |
| 352 |
8/14✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
|
256 | PetscTryMethod(st,"STShellSetBackTransform_C",(ST,STShellBackTransformFn*),(st,backtr)); |
| 353 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
256 | PetscFunctionReturn(PETSC_SUCCESS); |
| 354 | } | ||
| 355 | |||
| 356 | /*MC | ||
| 357 | STSHELL - STSHELL = "shell" - User-defined spectral transformation via callback | ||
| 358 | functions for the application of the operator to a vector and (optionally) the | ||
| 359 | backtransform operation. | ||
| 360 | |||
| 361 | Level: beginner | ||
| 362 | |||
| 363 | Note: | ||
| 364 | In order to define a `shell` spectral transformation, the user has to provide | ||
| 365 | the `apply` operation via `STShellSetApply()` and related functions, and | ||
| 366 | optionally a `backtransform` operation via `STShellSetBackTransform()`, and | ||
| 367 | in some cases a user-defined context containing relevant data via | ||
| 368 | `STShellSetContext()`. | ||
| 369 | |||
| 370 | .seealso: [](ch:st), `ST`, `STType`, `STSetType()`, `STShellSetApply()`, `STShellSetBackTransform()`, `STShellSetContext()` | ||
| 371 | M*/ | ||
| 372 | |||
| 373 | 296 | SLEPC_EXTERN PetscErrorCode STCreate_Shell(ST st) | |
| 374 | { | ||
| 375 | 296 | ST_SHELL *ctx; | |
| 376 | |||
| 377 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
296 | PetscFunctionBegin; |
| 378 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscNew(&ctx)); |
| 379 | 296 | st->data = (void*)ctx; | |
| 380 | |||
| 381 | 296 | st->usesksp = PETSC_FALSE; | |
| 382 | |||
| 383 | 296 | st->ops->apply = STApply_Shell; | |
| 384 | 296 | st->ops->applytrans = STApplyTranspose_Shell; | |
| 385 | #if defined(PETSC_USE_COMPLEX) | ||
| 386 | 151 | st->ops->applyhermtrans = STApplyHermitianTranspose_Shell; | |
| 387 | #else | ||
| 388 | 145 | st->ops->applyhermtrans = STApplyTranspose_Shell; | |
| 389 | #endif | ||
| 390 | 296 | st->ops->backtransform = STBackTransform_Shell; | |
| 391 | 296 | st->ops->destroy = STDestroy_Shell; | |
| 392 | |||
| 393 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellGetContext_C",STShellGetContext_Shell)); |
| 394 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetContext_C",STShellSetContext_Shell)); |
| 395 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetDestroy_C",STShellSetDestroy_Shell)); |
| 396 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApply_C",STShellSetApply_Shell)); |
| 397 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyTranspose_C",STShellSetApplyTranspose_Shell)); |
| 398 | #if defined(PETSC_USE_COMPLEX) | ||
| 399 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
151 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyHermitianTranspose_C",STShellSetApplyHermitianTranspose_Shell)); |
| 400 | #else | ||
| 401 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
145 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyHermitianTranspose_C",STShellSetApplyTranspose_Shell)); |
| 402 | #endif | ||
| 403 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
296 | PetscCall(PetscObjectComposeFunction((PetscObject)st,"STShellSetBackTransform_C",STShellSetBackTransform_Shell)); |
| 404 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
71 | PetscFunctionReturn(PETSC_SUCCESS); |
| 405 | } | ||
| 406 |