[petsc-users] DAGetMatrix with extra nonzeros: memory preallocation

Mohamad M. Nasr-Azadani mmnasr at gmail.com
Sat Sep 10 16:03:02 CDT 2011


Thanks Jed.
Is there any example that could guide me on that?

Best,
Mohamad


On Sat, Sep 10, 2011 at 5:35 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> 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/c44728f3/attachment.htm>


More information about the petsc-users mailing list