[petsc-users] Clarification on MatMPIBAIJSetPreallocation (d_nnz and o_nnz)

Jed Brown jed at jedbrown.org
Mon Oct 24 10:41:54 CDT 2022


I recommend calling this one preallocation function, which will preallocate scalar and block formats. It takes one value per block row, counting in blocks.

https://petsc.org/release/docs/manualpages/Mat/MatXAIJSetPreallocation/

Edoardo alinovi <edoardo.alinovi at gmail.com> writes:

> Hello Barry,
>
> I am doing some preliminary work to add a coupled solver in my code.  I am
> reading some documentation on MPIBAIJ as the matrix will be composed of
> blocks of size 3x3 in 2D and 4x4 in 3D for each cell in the domain.
>
> I can't quite understand how to set d_nnz and o_nnz. What is their size?
> Should I provide a number of non-zero entries for each block or should I do
> it line by line as in MATAIJ?
>
> Would you be able to provide me with a silly example?
>
> Thank you!


More information about the petsc-users mailing list