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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to