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

TAY wee-beng zonexo at gmail.com
Tue Jul 10 14:23:05 CDT 2012


On 10/7/2012 8:48 PM, Randall Mackie wrote:
>
> 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 
>> <mailto: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:
>
> http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex5f90.F.html
>
> Note that for DOF> 1, the indexing is like vec(3,xs:xe,ys:ye,zs:ze) 
> for example..
>
>
> Randy

Thanks Randy, I did this as well. But now I'm using DMDAVecGetArrayF90 
since it's easier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120710/7ad2ca49/attachment-0001.html>


More information about the petsc-users mailing list