Re: [petsc-users] Array of SNES's

2016-01-05 Thread Justin Chang
Okay so i think there's no need for this in my case. Doing a standard NewtonLS and using the same SNES was no issue at all. My original issue was dealing with the Variational Inequality at each grid point which seemed to break down unless I "reset" the SNES. But when I use these options: -snes_fd

Re: [petsc-users] Array of SNES's

2016-01-05 Thread Timothée Nicolas
(Sorry I forgot to answer all in the first message) Well I have never used Petsc in python, but in FORTRAN, it seems to work like any array. So why not use a python list for instance ? You would start with SNESs = [], create a new snes and append it to the list with SNESs.append(snes). Then you

[petsc-users] Array of SNES's

2016-01-05 Thread Justin Chang
Hi all, Is it possible to create an array of SNES's? If I have a problem size N degrees of freedom, I want each dof to have its own SNES solver (basically a pointer to N SNES's). Reason for this is because I am performing a "post-processing" step where after my global solve, each entry of my

Re: [petsc-users] Array of SNES's

2016-01-05 Thread Patrick Sanan
Do all the SNES's need to be constructed at the same time? It will obviously require a lot of memory to store N SNES objects (or perhaps your N is small), and if they don't all need to exist simultaneously, then do you have the option to create and destroy one at a time as you loop over your grid

Re: [petsc-users] Array of SNES's

2016-01-05 Thread Justin Chang
Timothee, No i haven't tried, mainly because I don't know how. Btw I am not doing this in C or FORTRAN, I want to do this in python (via petsc4py) since I am trying to make this compatible with Firedrake (which is also python-based). Thanks, Justin On Tue, Jan 5, 2016 at 8:57 PM, Timothée

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Matthew Knepley
How devastating would it be for Deal.II if we renamed them MatCreateSubMatrix()? ;) Matt On Tue, Jan 5, 2016 at 5:53 PM, Barry Smith wrote: > > Yeah, looks like MatGetSubMatrix() and MatGetSubMatrices() didn't get > renamed to the "current" approach. > >Barry > > >

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Jed Brown
Matthew Knepley writes: > How devastating would it be for Deal.II if we renamed them > MatCreateSubMatrix()? ;) I know it's consistent with respect to reference counting semantics, but it might be harder for new users to find when searching the docs. I have no data either

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Barry Smith
> On Jan 5, 2016, at 7:29 PM, Jed Brown wrote: > > Matthew Knepley writes: > >> How devastating would it be for Deal.II if we renamed them >> MatCreateSubMatrix()? ;) > > I know it's consistent with respect to reference counting semantics, but > it might

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Dave May
The manpage http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetDiagonalBlock.html indicates the reference counter on the returned matrix (a) isn't incremented. This statement would imply that in the absence of calling PetscObjectReference() yourself, you should not call

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Bhalla, Amneet Pal S
On Jan 5, 2016, at 3:32 PM, Barry Smith > wrote: So get -> no destroy create -> destroy Is MatGetSubMatrices() exception to this rule? The manual says to call the destroy() function after done with it.

[petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Bhalla, Amneet Pal S
Hi Folks, Is it safe to call MatDestroy on the sequential matrix returned by MatGetDiagonalBlock() after it’s no longer used? Thanks, — Amneet = Amneet Bhalla Postdoctoral Research Associate Department of Mathematics and McAllister Heart

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Satish Balay
Looking at example usages in src/ksp/pc/impls/bjacobi/bjacobi.c or src/ksp/pc/impls/gasm/gasm.c - there is no call to MatDestroy.. [or MatRestoreDiagonalBlock] Satish On Tue, 5 Jan 2016, Bhalla, Amneet Pal S wrote: > Hi Folks, > > Is it safe to call MatDestroy on the sequential matrix returned

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Bhalla, Amneet Pal S
On Jan 5, 2016, at 3:20 PM, Dave May > wrote: This statement would imply that in the absence of calling PetscObjectReference() yourself, you should not call MatDestroy() on the matrix returned Got it. Thanks!

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Barry Smith
In general XXXGetYYY() do not increase the reference count and you should not destroy. Some XXXGetYYY() have a corresponding XXXRestoreYYY(). XXXCreateYYY() DO increase the reference count and should have destroy called. So get -> no destroy create -> destroy Barry In the

Re: [petsc-users] Calling MatDestroy on MatGetDiagonalBlock

2016-01-05 Thread Barry Smith
Yeah, looks like MatGetSubMatrix() and MatGetSubMatrices() didn't get renamed to the "current" approach. Barry > On Jan 5, 2016, at 5:46 PM, Bhalla, Amneet Pal S wrote: > > > >> On Jan 5, 2016, at 3:32 PM, Barry Smith wrote: >> >> So get ->