<div class="gmail_quote">2012/4/9 Zhenglun (Alan) Wei <span dir="ltr">&lt;<a href="mailto:zhenglun.wei@gmail.com">zhenglun.wei@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear All,<br>
    I hope you&#39;re having a nice day.<br>
    I&#39;m working on ex45. It does not have any output subroutine inside. Therefore, I was trying to write out mine.<br>
    I was trying to use DMDAVecGetArray; but I found that the DM object has been destroyed at very beginning of the main code. Therefore, I swithed to VecGetArray. However, it gives me warning like:<br>
ex45.c:185: warning: passing argument 2 of &#39;VecGetArray&#39; from incompatible pointer type<br>
    Then, it shows a memory violation error during execution, which is attached as &#39;out&#39;. I checked &#39;VecGetArray&#39; examples in PETSc manual, it always shows how to use it to extract one-dimensional array. I wonder if it can do 3-dimensional?<br>
</blockquote><div><br></div><div>Use DMDAVecGetArray(), see my reply to your other message.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    Also, there are other two minor questions:<br>
1) in ex45.c, &#39;ComputeRHS&#39;, there is a if(x) {} statement, I write probe statements inside this if statement to see if the code ever go through it; the result shows it does not. I don&#39;t know why. ;(<br></blockquote>
<div><br></div><div>Use a debugger and examine the stack to find out why that argument is 0. Learning to use a debugger is absolutely a good time investment. In cases like this, it&#39;s the difference between conclusively answering the question in seconds and having to actually think.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) probe statements are added in &#39;ComputeRHS&#39; for both ex45.c and ex29.c. The size parameter used for DMDACreate3d in ex45 is -7, -7, -7; while for DMDACreate2d in ex29 is -7,-7. The probe statements show that the real 2d domain generated in ex29 is 25*25, which, as I understand, is because of multigrid. However, with multigrid scheme, the ex45 create a 7*7*7 3d domain. Any suggestions on this?<br>
</blockquote><div><br></div><div><div>Please do not follow this version of ex29.c because it uses the deprecated DMMG. The example has been updated in petsc-dev. The refinement was coming from automatic refinement via DMMG.</div>
<div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex29.c.html">http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex29.c.html</a></div></div><div><br></div>
</div>