> Actually, there is a better way: MatCreateShell allows you to give a > "context" pointer. You currently pass NULL in this place. Pass *this here, > and then in the static matrix_mult function get back the context using > MatShellGetContext.
This is the usual sequence to maintain state for Shell objects (Mat, PC) and also for other objects (KSP, SNES, TS), set the application context as necessary to propagate information. All examples with the Mat shell types have such calls in the tutorials, if you need to understand this further. http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex62.c.html Vijay On Thu, Jun 28, 2012 at 4:46 PM, Wolfgang Bangerth <[email protected]> wrote: > >> Anyway, what you need is a way for the matrix_mult function (whether >> it's global or a static member function) to establish what the proper >> MatrixFree object is that belongs to the matrix object it is called >> with. Here is a crude approach: > > > Actually, there is a better way: MatCreateShell allows you to give a > "context" pointer. You currently pass NULL in this place. Pass *this here, > and then in the static matrix_mult function get back the context using > MatShellGetContext. > > Best > W. > > _______________________________________________ > dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii _______________________________________________ dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii
