<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-CA link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Thanks, Mark. Yes, it actually works when I update to ISLocalToGlobalMappingGetIndicesF90. I made a mistake reporting this does not work.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Danyang<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:12.0pt;color:black'>From: </span></b><span style='font-size:12.0pt;color:black'>Mark Adams <mfadams@lbl.gov><br><b>Date: </b>Monday, May 8, 2023 at 7:22 PM<br><b>To: </b>Danyang Su <danyang.su@gmail.com><br><b>Cc: </b>petsc-users <petsc-users@mcs.anl.gov><br><b>Subject: </b>Re: [petsc-users] Question on ISLocalToGlobalMappingGetIndices Fortran Interface<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Mon, May 8, 2023 at 6:50 PM Danyang Su <<a href="mailto:danyang.su@gmail.com">danyang.su@gmail.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Dear PETSc-Users,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Is there any changes in ISLocalToGlobalMappingGetIndices function after PETSc 3.17? <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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), <a href="https://www.mcs.anl.gov/petsc/petsc-3.14/src/ksp/ksp/tutorials/ex14f.F90.html" target="_blank">https://www.mcs.anl.gov/petsc/petsc-3.14/src/ksp/ksp/tutorials/ex14f.F90.html</a>. The value of idltog is not clear.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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.<o:p></o:p></p></div></div></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>* You do want the latter:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>doc/changes/319.rst:- Deprecate ``ISLocalToGlobalMappingGetIndices()`` in favor of ``ISLocalToGlobalMappingGetIndicesF90()``<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>* You might look at a test:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>src/ksp/ksp/tutorials/ex14f.F90: PetscCall(ISLocalToGlobalMappingGetIndicesF90(ltogm,ltog,ierr))<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>* If you use 64 bit integers be careful. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>* You want to use a memory checker like Valgrind or Sanitize.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Mark<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>call</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> DMDAGetGlobalIndicesF90(dmda_flow%da,PETSC_NULL_INTEGER, &</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> idx,ierr)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> CHKERRQ(ierr)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>#else</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>call</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> DMGetLocalToGlobalMapping(dmda_flow%da,ltogm,ierr)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> CHKERRQ(ierr)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>call</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> ISLocalToGlobalMappingGetIndices(ltogm,ltog,idltog,ierr)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> CHKERRQ(ierr)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>#endif</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> dof = dmda_flow%dof</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>do</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> ivol = </span><span style='font-size:10.5pt;font-family:Menlo;color:#B5CEA8'>1</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'>, nngl</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> node_idx_lg2pg(ivol) = (idx(ivol*dof)+</span><span style='font-size:10.5pt;font-family:Menlo;color:#B5CEA8'>1</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'>)/dof</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>#else</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> node_idx_lg2pg(ivol) = (ltog(ivol*dof + idltog)+</span><span style='font-size:10.5pt;font-family:Menlo;color:#B5CEA8'>1</span><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'>)/dof</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>#endif</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:Menlo;color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:Menlo;color:#569CD6'>end do</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Any suggestions on that. <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thanks,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Danyang<o:p></o:p></p></div></div></div></blockquote></div></div></div></body></html>