[petsc-users] DMCreateMatrix with some dense row

Barry Smith bsmith at mcs.anl.gov
Thu Sep 3 13:24:42 CDT 2015


    Look at DMCreateMatrix_DA_2d_MPIAIJ  (or the 3d version if working in 3d)   You need to copy this routine and add whatever additional preallocation information you need.   Then call DMDASetGetMatrix()  so that the DM will use your routine to create the matrix for you.

   Barry




> On Sep 3, 2015, at 11:28 AM, Sang pham van <pvsang002 at gmail.com> wrote:
> 
> Hi,
> 
> I am using DMCreateMatrix to create matrix from a existed DM object and defined stencil.
> In my code, boundary nodes need to involve many inner nodes, thus matrix rows corresponding to boundary nodes are almost dense. How can I  tell petsc that those rows need to be preallocated with more entries? I don't want to use MatMPIAIJSetPreallocation() since advantages of DM might be lost.
> 
> Many thanks.
> 
> Sam.
> 
>  



More information about the petsc-users mailing list