<div class="gmail_quote">On Sat, Apr 16, 2011 at 22:26, Алексей Рязанов <span dir="ltr"><<a href="mailto:ram@ibrae.ac.ru">ram@ibrae.ac.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div>1. Please tell me, what's the principal difference between procedures DAGetGlobalVector and DACreateGlobalVector? I cant catch it from man pages.</div></div></blockquote><div><br></div><div>
Use DACreateGlobalVector() if you ownership of the vector, you call VecDestroy() when you are done with it.</div><div><br></div><div>Use DAGetGlobalVector() to let the DA manage the lifetime of the vector, call DARestoreGlobalVector() when you are done with it. The DA does not actually destroy the vector, it keeps it around and just gives it back next time you call DAGetGlobalVector(). This is usually what you want for "work" vectors.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote">
<div><br></div><div>2. As I can read from DAGetMatrix man page, this procedure:</div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div>
<span style="font-family:'Times New Roman';font-size:medium">Creates a matrix with the correct parallel layout and nonzero structure required for computing the Jacobian on a function defined using the stencil set in the</span></div>
<span style="font-family:'Times New Roman';font-size:medium"> DA</span></div><div class="gmail_quote"><div><span style="font-family:'Times New Roman';font-size:medium"><p>
Notes: This properly preallocates the number of nonzeros in the sparse matrix so you do not need to do it yourself.</p></span></div></div><div class="gmail_quote"><div><span style="font-family:'Times New Roman';font-size:medium"><p>
By default it also sets the nonzero structure and puts in the zero entries. To prevent setting the nonzero pattern call <a href="http://../DA/DASetMatPreallocateOnly.html#DASetMatPreallocateOnly" target="_blank">DASetMatPreallocateOnly</a>()</p>
</span></div></div></blockquote><div class="gmail_quote"><div>So I use DASetMatPreallocateOnly.</div></div></blockquote><div><br></div><div>Why would you want to do that?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div> But I dont need a Jacobian. I need a matrix of my linear system</div></div></blockquote><div><br></div><div>But that _is_ the Jacobian of the residual function (f(x) = A*x - b for linear problems). This language is used frequently in PETSc.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div> with its original number of nonzeros per row and its original nonzero pattern.</div>
</div></blockquote></div><br><div>What do you mean by "original"?</div><div><br></div><div>You are setting values that have not been preallocated, perhaps because the stencil you defined for the DA is different from the one you are using during assembly.</div>