[petsc-users] Question on ISLocalToGlobalMappingGetIndices Fortran Interface

Mark Adams mfadams at lbl.gov
Mon May 8 21:21:57 CDT 2023


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/e0cefdec/attachment-0001.html>


More information about the petsc-users mailing list