[petsc-users] How to pass data to PETSc

Ted Sariyski tsariysk at craft-tech.com
Thu Oct 31 15:47:45 CDT 2013

I am about to use PETSc linear algebra. Two questions.

Q1: I have the stiffness matrix and the rhs vector assembled (outside) 
and in PETSc order. Do I still need to create a scatter:"ierr = 

Q2: I have PETSc vectors and matrix set:

ierr = VecCreate(MPI_COMM_WORLD,&bb);CHKERRQ(ierr);
ierr = VecSetFromOptions(bb);CHKERRQ(ierr);CHKPT
ierr = VecSetSizes(bb,Nvlocal,Nvglobal);CHKERRQ(ierr);
ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
ierr = MatSetSizes(A,Nvlocal,Nvlocal,Nvglobal,Nvglobal);CHKERRQ(ierr);

I passed the rhs myData to bb using VecSetValues:
ierr = VecSetValues(bb,Nvlocal,vertices,myData,INSERT_VALUES);CHKERRQ(ierr);

The matrix is in HYPRE sparse format. What is the recommended way to 
pass it to A?

Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131031/c17ab25e/attachment.html>

More information about the petsc-users mailing list