[petsc-users] petsc malloc multidimensional array
Matthew Knepley
knepley at gmail.com
Tue Mar 11 08:41:21 CDT 2014
On Tue, Mar 11, 2014 at 8:37 AM, 吕超 <luchao at mail.iggcas.ac.cn> wrote:
> 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.
>
1) This is a C question, not a PETSc question
2) If you are using 2D arrays for fields, you should be using the DMDA,
which has a section in the manual
Thanks,
Matt
> LV CHAO
>
> 2014/3/11
>
>
>
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140311/d8649f7d/attachment.html>
More information about the petsc-users
mailing list