Christophe Ortiz <[email protected]> writes: > Would the following be ok ? > > //Creation of vector X of size dof*dof: > VecCreateSeq(PETSC_COMM_SELF,dof*dof,&X); > > // Using two-dimensional array style: > PetscScalar *x;
This needs to be PetscScalar **x; as you would have noticed if you tried to compile. > VecGetArray2d(X,dof,dof,0,0,&x); > > x[i][j] = ...; Yes. > Is it ok ? > Then, what should be passed to MatSetValuesBlocked() ? Since the array starts are (0,0), you can just pass &x[0][0]. Remember to call VecRestoreArray2d() and eventually VecDestroy().
pgphUNP0sttOo.pgp
Description: PGP signature
