[petsc-users] DA matrices and vectors ordering

Jed Brown jed at 59A2.org
Tue Jun 22 05:03:43 CDT 2010


On Tue, 22 Jun 2010 04:02:29 -0400, Valerio Grazioso <graziosov at me.queensu.ca> wrote:
> and I've got a matrix A ordered in a Petsc ordering: rows and variables have a sequential numbering relative to each processor.

This is always the order used internally, but your application code
doesn't have to "see" this ordering.  I suggest using
MatSetValuesStencil() which allows you to effectively insert values in
the natural ordering (as coordinates k,j,i) which will get mapped
appropriately to the internal storage.

> call DACreateLocalVector(da,qloc,err)

This also uses the "PETSc ordering" internally.

> call VecGetArrayF90(qloc,qloc_a,err)

But this does some pointer tricks so it looks like you are working in
the natural ordering.

>                         cont=cont+1   
> 			qloc_a(cont)=....

Can use qloc_a(i,j,k) here.

Jed


More information about the petsc-users mailing list