IS routines without a Fortran interface
Stephen R Ball
Stephen.R.Ball at awe.co.uk
Mon Jun 12 10:41:09 CDT 2006
Hi
I have rebuilt PETSc using your new zisltogf.c. However,
ISLocalToGlobalMpngGetInfoSize() does not appear to work for me. It seems to
jump out at line 28:
if (!called) {*ierr = PETSC_ERR_ARG_WRONGSTATE; return}
I am using the following Fortran code:
ISLocalToGlobalMapping :: mapping
integer :: nproc, numprocmax
integer,dimension,allocatable(:) :: procs, numprocs
integer,dimension,allocatable(:,:) :: indices
call ISLocalToGlobalCreate(PETSC_COMM_WORLD, nlt_rows, loc_to_glob_idx,
mapping, ierr) call ISLocalToGlobalMpngGetInfoSize(mapping, nproc,
numprocmax, ierr)
allocate(procs(nproc), stat=alloc_err) allocate(numprocs(nproc),
stat=alloc_err) allocate(indices(nproc, numprocmax), stat=alloc_err)
call ISLocalToGlobalMappingGetInfo(mapping, nproc, procs, numprocs, indices,
ierr)
Where "nlt_rows" is the number of local elements and "loc_to_glob_idx" is
the global index for each local element.
Have you any ideas on what could be causing the problem? Is it just a little
typo in your code, or something more serious?
Regards
Stephen
-----Original Message-----
From: Barry Smith [mailto:bsmith at mcs.anl.gov]
Sent: 11 June 2006 05:13
To: petsc-users at mcs.anl.gov
Subject: EXTERNAL: Re: IS routines without a Fortran interface
Stephen,
The difficulty with this routine is that it returns an array (the procs
and numprocs argument) and an array of arrays (2d array) as the last
argument. Returning 2d arrays from C to Fortran is not doable.
Thus I have devised a slightly different calling sequence for Fortran;
Fortran Usage:
$ ISLocalToGlobalMpngGetInfoSize(ISLocalToGlobalMapping,PetscInt
nproc,PetscInt numprocmax,ierr) followed by
$ ISLocalToGlobalMappingGetInfo(ISLocalToGlobalMapping,PetscInt
nproc, PetscInt procs[nproc],PetscInt numprocs[nproc],
PetscInt indices[nproc][numprocmax],ierr)
There is no ISLocalToGlobalMappingRestoreInfo() in Fortran. You
must make sure that procs[], numprocs[] and
indices[][] are large enough arrays, either by allocating them
dynamically or defining static ones large enough.
Attached is the new code, just drop it into src/vec/is/utisl/ftn-custom
to replace the
current zisltogf.c and run "make lib shared" in that directory.
Please let us know if you have any difficulties with it,
Barry
On Fri, 9 Jun 2006, Stephen R Ball wrote:
>
>
> Hi
>
> I am keen to use some of the indexing IS routines in my Fortan code
> but have discovered that several of them do not have a Fortran
> interface. In particular I would like to use
> ISLocalToGlobalMappingGetInfo() and
> ISLocalToGlobalMappingRestoreInfo(). Would it be possible for you to
> include these, and possibly any other missing IS routines not having a
> Fortran interface, in PETSc v2.3.1 as a new patch version.
>
> Regards
>
> Stephen
> --
> ______________________________________________________________________
> _________
>
> The information in this email and in any attachment(s) is commercial
> in confidence. If you are not the named addressee(s) or if you receive
> this email in error then any distribution, copying or use of this
> communication or the information in it is strictly prohibited. Please
> notify us immediately by email at admin.internet(at)awe.co.uk, and
> then delete this message from your computer. While attachments are
> virus checked, AWE plc does not accept any liability in respect of any
> virus which is not detected.
>
> AWE Plc
> Registered in England and Wales
> Registration No 02763902
> AWE, Aldermaston, Reading, RG7 4PR
>
>
--
_______________________________________________________________________________
The information in this email and in any attachment(s) is commercial in confidence. If you are not the named addressee(s) or if you receive this email in error then any distribution, copying or use of this communication or the information in it is strictly prohibited. Please notify us immediately by email at admin.internet(at)awe.co.uk, and then delete this message from your computer. While attachments are virus checked, AWE plc does not accept any liability in respect of any virus which is not detected.
AWE Plc
Registered in England and Wales
Registration No 02763902
AWE, Aldermaston, Reading, RG7 4PR
More information about the petsc-users
mailing list