[petsc-users] Providing context to DMShell
Lawrence Mitchell
lawrence.mitchell at imperial.ac.uk
Tue Jan 12 09:44:01 CST 2016
On 12/01/16 15:37, Boris Boutkov wrote:
> Hello All,
>
> I'm trying to attach a context to the DMShell similarly to how a context
> is passed into SNES through the SetFunction routine. Specifically, I'm
> looking to provide my own interpolation routine to both
> DMShellSetCreateInterpolationand Injection, which requires some user
> data from my environment. Ive tried searching around the _p_DM*struct
> looking for somewhere to attach this data but found no convenient way,
> any pointers to how I could achieve this would be appreciated.
I think you want to do:
DMSetApplicationContext(dm, user_context);
Inside your interpolation routine you can then use:
PetscErrorCode interpolate(DM coarse, DM fine, Mat *m, Vec *v) {
...
DMGetApplicationContext(coarse, *ctx);
...
}
Cheers,
Lawrence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160112/728415bb/attachment.pgp>
More information about the petsc-users
mailing list