[petsc-users] problem with MatShellGetContext
Matthew Knepley
knepley at gmail.com
Mon Aug 3 09:47:13 CDT 2015
On Mon, Aug 3, 2015 at 9:42 AM, Nicolas Pozin <nicolas.pozin at inria.fr>
wrote:
>
>
> ------------------------------
>
> *De: *"Matthew Knepley" <knepley at gmail.com>
> *À: *"Nicolas Pozin" <nicolas.pozin at inria.fr>
> *Cc: *"PETSc" <petsc-users at mcs.anl.gov>
> *Envoyé: *Lundi 3 Août 2015 16:33:16
> *Objet: *Re: [petsc-users] problem with MatShellGetContext
>
> On Mon, Aug 3, 2015 at 9:13 AM, Nicolas Pozin <nicolas.pozin at inria.fr>
> wrote:
>
>> Hello everyone,
>>
>> I am having trouble using MatShellGetContext.
>>
>> Here's the simple test I did :
>>
>>
>> typedef struct{
>> PetscInt testValue;
>> Mat matShell;
>> KSP currentCtx;
>> } AppCtx;
>>
>>
>> AppCtx context1;
>> KSPCreate(PETSC_COMM_WORLD,&context1.currentCtx);
>> context1.testValue=18;
>> MatCreateShell(PETSC_COMM_WORLD, nl, nl, nL, nL, context1.currentCtx,
>> &context1.matShell);
>>
>
> It looks like you want ''&context1" for the context argument. You are just
> passing the KSP pointer.
>
>> AppCtx context2;
>> MatShellGetContext(context1.matShell, (void*)&context2);
>>
>
> Here you better declare
>
> AppCtx *context2;
>
> and access it as
>
> context2->testValue;
>
> Thanks, but It doesn't work better unfortunately
>
This tells me NOTHING. How can I help you with this information? This has
nothing to do with PETSc. It is
simple C semantics. Write a test code and send it in.
Matt
> Matt
>
>> It happens that context2.testValue is different from 18.
>>
>> Any would have a clue on what I miss?
>>
>> thanks a lot,
>> Nicolas
>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150803/24e5ed7f/attachment.html>
More information about the petsc-users
mailing list