[petsc-users] Declaring struct to represent field for dof > 1 for DM in Fortran

Randall Mackie rlmackie862 at gmail.com
Tue Jul 10 13:48:12 CDT 2012

On Jul 10, 2012, at 11:29 AM, Jed Brown wrote:

> On Tue, Jul 10, 2012 at 1:22 PM, TAY wee-beng <zonexo at gmail.com> wrote:
> Do you mean DMDAVecGetArrayDOFF90 ? I tried to compile but it gives the error during linking:
> 1>dm_test2d.obj : error LNK2019: unresolved external symbol DMDAVECGETARRAYDOFF90 referenced in function MAIN__
> Matt was suggesting that someone should implement this function, it doesn't exist currently.
> Fortran makes this stuff really painful and we don't know how to make it do something reasonable without depending on your types. You can write your own DMDAVecGetArrayF90WithYourType(), but sadly, it requires some circus tricks to make work. (We can't put this in PETSc because we don't know what your field type is.)

In my Fortran code, I simply use VecGetArrayF90 on a vector created with, for example, DMGetGlobalVector, and it
works perfectly fine for DOF>1. You might want to look at this example:


Note that for DOF> 1, the indexing is like vec(3,xs:xe,ys:ye,zs:ze) for example..

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120710/06712985/attachment.html>

More information about the petsc-users mailing list