Thank you very much, Satish! Ill try it<div><br></div><div>Alexey<br><br><div class="gmail_quote">8 апреля 2011 г. 3:32 пользователь Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>></span> написал:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Fri, 8 Apr 2011, Алексей Рязанов wrote:<br>
<br>
> Hello.<br>
><br>
> When I create vectors using<br>
><br>
> VecCreate(PETSC_COMM_WORLD,&u);<br>
> VecSetSizes(u,PETSC_DECIDE, VecSize);<br>
> VecSetFromOptions(u);<br>
> VecDuplicate(u,&b);<br>
><br>
> and matrix using<br>
><br>
> MatCreate(PETSC_COMM_WORLD,&A);<br>
> MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,VecSize,VecSize);<br>
> MatSetFromOptions(A);<br>
><br>
> PETSc distributes their elements in a proper identical way among processors,<br>
> so I can use procedures like<br>
><br>
> MatMult(A,u,b);<br>
><br>
> and<br>
> KSPSolve(ksp,b,x);<br>
> Ofcourse after matrix assembling and initialization of KSP and PC<br>
><br>
> KSPCreate(PETSC_COMM_WORLD,&ksp);<br>
> KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);<br>
><br>
> And thats great and works amazingly!<br>
><br>
><br>
><br>
><br>
> But now I've created DA vectors "u" and "b" and assembled them through the<br>
> natural grid indexing.<br>
><br>
> And I need to solve the same SLE Au=b, where A is a Laplacian.<br>
><br>
> How should I create and assemble the A matrix according to my DA vector to<br>
> use the same functionality?<br>
<br>
</div></div>Create u,b with DAGetGlobalVector() and A with DAGetMatrix() and they<br>
will match the DA. For eg: check: src/snes/examples/tutorials/ex5.c<br>
[or some of the examples in src/dm/da/examples]<br>
<br>
Satish<br>
<div class="im"><br>
><br>
> Thank you!<br>
><br>
> Alexey Ryazanov<br>
> ______________________________________<br>
> Nuclear Safety Institute of Russian Academy of Sciences<br>
</div>> <<a href="http://www.ibrae.ac.ru/" target="_blank">http://www.ibrae.ac.ru/</a>><br>
> </blockquote></div><br></div>