[petsc-users] Fortran application context, passing a module
Praveen C
cpraveen at gmail.com
Sat Mar 18 06:43:09 CDT 2017
Thanks Barry. I have to pass three derived types. I now put my 3 types into
another type and pass that as the application context.
Best
praveen
On Fri, Mar 17, 2017 at 10:45 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> It looks to me that you are trying to pass a Fortran 90 derived type as
> one entry in an array of addresses as an application context (perhaps from
> some PETSc example). This will not work as written because Fortran doesn't
> know that PetscFortranAddr is an array of addresses.
>
> The conventional way to do this is to pass a derived type directly as
> the context. So you would just have
>
> type(mgrid) mygrid
>
> then when you call SNESSetComputeFunction() or whatever routine you
> are calling that requires a context
>
> SNESSetComputeFunction(snes,v,computefunction,mygrid,ierr)
>
> and inside your computefunction the ctx argument is declared as
> type(grid) mygrid
>
> See, for example, src/snes/examples/tutorials/ex5f90.F90
>
>
> Barry
>
> > type(mgrid)
>
>
> > On Mar 17, 2017, at 12:02 AM, Praveen C <cpraveen at gmail.com> wrote:
> >
> > Dear all
> >
> > I want to pass my own module as an application context in fortran. So I
> am trying something like this
> >
> > type(mgrid),target :: g
> > PetscFortranAddr :: ctx(6)
> > ctx(1) => g
> >
> > But this gives an error
> > Error: Non-POINTER in pointer association context (pointer assignment)
> at (1)
> >
> > Could you tell me how I can make this work ?
> >
> > Thanks
> > praveen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170318/fbf38d23/attachment.html>
More information about the petsc-users
mailing list