[petsc-users] IS natural numbering to global numbering

Matthew Knepley knepley at gmail.com
Sun Jun 18 13:39:28 CDT 2023


On Sun, Jun 18, 2023 at 2:21 PM YuSh Lo <ysjosh.lo at gmail.com> wrote:

> Hi Matthew,
>
> Yes, I have called DMPlexDistribute().
>
> so what I do is:
>
> CALL DMSetUseNatural(serialDM, PETSC_TRUE, errorCode)
> CALL DMPlexDistribute(serialDM, 0, migrationSF, distributedDM, errorCode)
> CALL DMPlexGetGlobalToNaturalSF(serialDM, naturalSF, errorCode)
> CALL PetscSFView(naturalSF, PETSC_VIEWER_STDOUT_WORLD, errorCode)
>
> The naturalSF is null.
>

You can see here:


https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexdistribute.c#L1836

that the natural SF is created when you distribute. Are you running in
serial?


https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexdistribute.c#L1715

No SF is created in serial because we do not reorder unless distributing.

  Thanks,

     Matt


> Thanks,
> Josh
>
>
>
> Matthew Knepley <knepley at gmail.com> 於 2023年6月18日 週日 上午7:42寫道:
>
>> On Sun, Jun 18, 2023 at 2:12 AM YuSh Lo <ysjosh.lo at gmail.com> wrote:
>>
>>> I am getting a null PetscSF after calling DMPlexGetGlobalToNatural
>>>
>>
>> Did you call DMDIstribute()? This is where the map is created because
>> until then, the map is identity.
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>> YuSh Lo <ysjosh.lo at gmail.com> 於 2023年6月18日 週日 上午12:18寫道:
>>>
>>>> Hi Matthew,
>>>>
>>>> After setting DMSetUseNatural to true and calling
>>>> DMPlexGetGlobalToNatural,
>>>> I call PestcSFView right away, it gives segmentation fault.
>>>> I have also tried DMGetNaturalSF, it also gives segmentation fault when
>>>> calling PetscSFView.
>>>> I use PETSC_VIEWER_STDOUT_WORLD as PetscViewer
>>>>
>>>> Thanks,
>>>> Josh
>>>>
>>>>
>>>> Matthew Knepley <knepley at gmail.com> 於 2023年6月9日 週五 下午1:04寫道:
>>>>
>>>>> On Fri, Jun 9, 2023 at 1:46 PM YuSh Lo <ysjosh.lo at gmail.com> wrote:
>>>>>
>>>>>> Hi Barry,
>>>>>>
>>>>>> Is there any way to use the mapping generated by DMPlexDistribute
>>>>>> along with AO?
>>>>>>
>>>>>
>>>>> For Plex, if you turn on
>>>>>
>>>>>   https://petsc.org/main/manualpages/DM/DMSetUseNatural/
>>>>>
>>>>> before DMPlexDistribute(), it will compute and store a GlobalToNatural
>>>>> map. This can be
>>>>> used to map vectors back and forth, but you can extract the SF
>>>>>
>>>>>   DMPlexGetGlobalToNaturalSF
>>>>> <https://petsc.org/main/manualpages/DMPlex/DMPlexGetGlobalToNaturalSF/>
>>>>>
>>>>> and use that to remap your IS, by extracting the indices.
>>>>>
>>>>>   THanks,
>>>>>
>>>>>      Matt
>>>>>
>>>>>
>>>>>> Thanks,
>>>>>> Josh
>>>>>>
>>>>>>
>>>>>> Barry Smith <bsmith at petsc.dev> 於 2023年6月9日 週五 上午10:42寫道:
>>>>>>
>>>>>>>
>>>>>>>   You might be looking for
>>>>>>> https://petsc.org/release/manualpages/AO/AO/#ao
>>>>>>>
>>>>>>>
>>>>>>> On Jun 9, 2023, at 11:02 AM, Mark Adams <mfadams at lbl.gov> wrote:
>>>>>>>
>>>>>>> An IS is just an array of integers. We need your context.
>>>>>>> Is this question for sparse matrices? If so look at the
>>>>>>> documentation on the AIJ matrix construction and the global vertex
>>>>>>> numbering system.
>>>>>>>
>>>>>>> Mark
>>>>>>>
>>>>>>> On Thu, Jun 8, 2023 at 1:15 PM YuSh Lo <ysjosh.lo at gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have an IS that contains some vertex that is in natural
>>>>>>>> numbering. How do I map them to global numbering without being distributed?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Josh
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>> --
>>>>> What most experimenters take for granted before they begin their
>>>>> experiments is infinitely more interesting than any results to which their
>>>>> experiments lead.
>>>>> -- Norbert Wiener
>>>>>
>>>>> https://www.cse.buffalo.edu/~knepley/
>>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>>
>>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230618/d886871d/attachment.html>


More information about the petsc-users mailing list