[petsc-users] PetscMalloc with Fortran
Jed Brown
jed at jedbrown.org
Thu May 15 09:45:21 CDT 2014
Jonas Mairhofer <mairhofer at itt.uni-stuttgart.de> writes:
> Hi, I'm trying to set the coloring of a matrix using ISColoringCreate.
> Therefore I need an array 'colors' which in C can be creates as (from
> example ex5s.c)
>
> int *colors
> PetscMalloc(...,&colors)
There is no PetscMalloc in Fortran, due to language "deficiencies".
> colors(i) = ....
>
> ISColoringCreate(...)
>
> How do I have to define the array colors in Fortran?
>
> I tried:
>
> Integer, allocatable :: colors(:) and allocate() instead of
> PetscMalloc
>
> and
>
> Integer, pointer :: colors
>
> but neither worked.
The ISColoringCreate Fortran binding copies from the array you pass into
one allocated using PetscMalloc. You should pass a normal Fortran array
(statically or dynamically allocated).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140515/83aa46ed/attachment.pgp>
More information about the petsc-users
mailing list