Hi.

We are writing a code for a FD scheme on an irregular domain and thus the local stencil is quite variable: we have inner nodes, boundary nodes and inactive nodes, each with their own stencil type and offset with respect to the grid node. We currently create a matrix with DMCreateMatrix on a DMDA and for now have set the option MAT_NEW_NONZERO_LOCATIONS to PETSC_TRUE, but its time to render the code memory-efficient. The layout created automatically is correct for inner nodes, wrong for boundary ones (off-centered stencils) and redundant for outer nodes.

After the preprocessing stage (including stencil creation) we'd be in position to set the nonzero pattern properly.

Do we need to start from a Mat created by CreateMatrix? Or is it ok to call DMCreateMatrix (so that the splitting among CPUs and the block size are set by PETSc) and then call a MatSetPreallocation routine?

Also, I've seen in some examples that you call the Seq and the MPI preallocation routines in a row. Does this work because MatMPIAIJSetPreallocation silently does nothing on a Seq matrix and viceversa?

Thanks

    Matteo


Reply via email to