On 26 April 2016 at 16:50, Gautam Bisht <[email protected]> wrote: > I want to follow up on this old thread. If a user knows the exact fill > pattern of the off-diagonal block (i.e. d_nz+o_nz or d_nnz+o_nnz ), can > one still not preallocate memory for the off-diagonal matrix when using > DMComposite? >
You are always free to over-ride the method dm->ops->creatematrix with your own custom code to create and preallocate the matrix. You will need to add #include <petsc/private/dmimpl.h> into your source file to expose the contents of the DM object. > > -Gautam. > > On Tue, Sep 30, 2014 at 3:48 PM, Jed Brown <[email protected]> wrote: > >> Gautam Bisht <[email protected]> writes: >> >> > Hi, >> > >> > The comment on line 419 of SNES ex 28.c >> > < >> http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex28.c.html >> > >> > says >> > that the approach used in this example is not the best way to allocate >> > off-diagonal blocks. Is there an example that shows a better way off >> > allocating memory for off-diagonal matrix blocks when using DMComposite? >> >> The problem is that the allocation interfaces specialize on the matrix >> type. Barry wrote a DMCompositeSetCoupling(), but there are no >> examples. This is something that PETSc needs to improve. I have been >> unsuccessful at conceiving a _simple_ yet flexible/extensible solution. >> > >
