[petsc-users] How to create and assemble matrices for DA vectors??
Алексей Рязанов
ram at ibrae.ac.ru
Thu Apr 7 18:17:32 CDT 2011
Hello.
When I create vectors using
VecCreate(PETSC_COMM_WORLD,&u);
VecSetSizes(u,PETSC_DECIDE, VecSize);
VecSetFromOptions(u);
VecDuplicate(u,&b);
and matrix using
MatCreate(PETSC_COMM_WORLD,&A);
MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,VecSize,VecSize);
MatSetFromOptions(A);
PETSc distributes their elements in a proper identical way among processors,
so I can use procedures like
MatMult(A,u,b);
and
KSPSolve(ksp,b,x);
Ofcourse after matrix assembling and initialization of KSP and PC
KSPCreate(PETSC_COMM_WORLD,&ksp);
KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);
And thats great and works amazingly!
But now I've created DA vectors "u" and "b" and assembled them through the
natural grid indexing.
And I need to solve the same SLE Au=b, where A is a Laplacian.
How should I create and assemble the A matrix according to my DA vector to
use the same functionality?
Thank you!
Alexey Ryazanov
______________________________________
Nuclear Safety Institute of Russian Academy of Sciences
<http://www.ibrae.ac.ru/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110408/8fa40a39/attachment.htm>
More information about the petsc-users
mailing list