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