<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 11, 2014 at 8:37 AM, 吕超 <span dir="ltr"><<a href="mailto:luchao@mail.iggcas.ac.cn" target="_blank">luchao@mail.iggcas.ac.cn</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>  Hi, recently,when I use PETSc to bulid 2d arrays such as PetscScalar A[512][512],B[512][512],C,D,E,F,..., program always has error of Segmentation Violation. So I want to use PetscMalloc to bulid 2d array, and I hope that I can also use these 2d array A[i][j] by subscripts as before. Could do please tell me how can I do? Thank you.</p>
</blockquote><div>1) This is a C question, not a PETSc question</div><div><br></div><div>2) If you are using 2D arrays for fields, you should be using the DMDA, which has a section in the manual</div><div><br></div><div>  Thanks,</div>
<div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>LV CHAO</p><p>2014/3/11<br><br><br></p><span></span><br><br><br></blockquote>
</div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener
</div></div>