[petsc-users] DAGetMatrix with extra nonzeros: memory preallocation
Jed Brown
jedbrown at mcs.anl.gov
Sat Sep 10 07:35:59 CDT 2011
On Sat, Sep 10, 2011 at 12:36, Mohamad M. Nasr-Azadani <mmnasr at gmail.com>wrote:
> I am setting up a matrix (parallel) using DA's in 3D.
> DA is built upon a width=1, STAR_STENCIL type.
> The nonzero structure of the resulting matrix is hepta-diagonal for the
> most part, however, since I am imposing boundary conditions using
> interpolation methods, for some boundary nodes, it is possible that some
> extra nonzeros are added into new locations.
> This obviously reduces the matrix setup and assembly efficiency since the
> new nonzeros are not preallocated.
> Is there any way that I could do it myself, i.e. preallocate the new
> nonzeros before matrix setup to get the best performance?
>
Unfortunately there is not a convenient way to express this such that
DMGetMatrix() will preallocate for those entries. You can preallocate your
own matrix without calling DMGetMatrix(). It's not very hard for a stencil
width of 1 with STAR, but it is still some code to write.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110910/71dd7300/attachment.htm>
More information about the petsc-users
mailing list