[petsc-users] Question on ISLocalToGlobalMappingGetIndices Fortran Interface
Danyang Su
danyang.su at gmail.com
Mon May 8 23:24:01 CDT 2023
Thanks, Mark. Yes, it actually works when I update to ISLocalToGlobalMappingGetIndicesF90. I made a mistake reporting this does not work.
Danyang
From: Mark Adams <mfadams at lbl.gov>
Date: Monday, May 8, 2023 at 7:22 PM
To: Danyang Su <danyang.su at gmail.com>
Cc: petsc-users <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Question on ISLocalToGlobalMappingGetIndices Fortran Interface
On Mon, May 8, 2023 at 6:50 PM Danyang Su <danyang.su at gmail.com> wrote:
Dear PETSc-Users,
Is there any changes in ISLocalToGlobalMappingGetIndices function after PETSc 3.17?
In the previous PETSc version (<= 3.17), the function ‘ISLocalToGlobalMappingGetIndices(ltogm,ltog,idltog,ierr)’ works fine, even though the value of idltog looks out of bound (-11472655627481), https://www.mcs.anl.gov/petsc/petsc-3.14/src/ksp/ksp/tutorials/ex14f.F90.html. The value of idltog is not clear.
In the latest PETSc version, this function can be called, but due to the extreme value of idltog, the code fails. I also tried to use ‘ISLocalToGlobalMappingGetIndicesF90(ltogm,ltog,ierr)’ () but no success.
* You do want the latter:
doc/changes/319.rst:- Deprecate ``ISLocalToGlobalMappingGetIndices()`` in favor of ``ISLocalToGlobalMappingGetIndicesF90()``
* You might look at a test:
src/ksp/ksp/tutorials/ex14f.F90: PetscCall(ISLocalToGlobalMappingGetIndicesF90(ltogm,ltog,ierr))
* If you use 64 bit integers be careful.
* You want to use a memory checker like Valgrind or Sanitize.
Mark
#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4)
call DMDAGetGlobalIndicesF90(dmda_flow%da,PETSC_NULL_INTEGER, &
idx,ierr)
CHKERRQ(ierr)
#else
call DMGetLocalToGlobalMapping(dmda_flow%da,ltogm,ierr)
CHKERRQ(ierr)
call ISLocalToGlobalMappingGetIndices(ltogm,ltog,idltog,ierr)
CHKERRQ(ierr)
#endif
dof = dmda_flow%dof
do ivol = 1, nngl
#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4)
node_idx_lg2pg(ivol) = (idx(ivol*dof)+1)/dof
#else
node_idx_lg2pg(ivol) = (ltog(ivol*dof + idltog)+1)/dof
#endif
end do
Any suggestions on that.
Thanks,
Danyang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230508/d863ef13/attachment.html>
More information about the petsc-users
mailing list