[petsc-users] DMPlex: a Mapping Array between Natural and Distributed Cell Index

Barry Smith bsmith at petsc.dev
Thu Jul 14 10:00:06 CDT 2022



> On Jul 13, 2022, at 9:52 PM, Bora Jeong <boraj1021 at gmail.com> wrote:
> 
> Dear petsc team,
>   
> I am a user of DMPlex for a finite volume code and there is a necessity to know global index of each cell. Here the global index means the indexing that can be found from a mesh file itself without distribution over processors. It seems petsc community denotes this indexing term as "natural". 
> 
> What I want to do is to create a local array (not petsc vector but just an array variable in the program) to map distributed cell ID to natual cell ID, for example, an array "A"; 
> A(distributed_node_ID) = natural_node_ID

  Is this array going to be complete on each MPI rank? That is on any rank you can make any distributed cell ID to the natural, or do you only need it for local cells (and ghosts)? 
> 
> There are some petsc functions to support mapping between global and natural vectors. However, I just need to define the array "A" as above example. To achieve this, what is a proper/smart way? In other words, how can I extract the natural_cell_ID from a distributed local_cell_ID? 
> 
> I turned on DMSetUseNatural(DM, PETSC_TRUE) before distribution, but after this, defining all the required section and star forest objects to get natural and global vectors seems not that direct way for my purpose, which is just to extract the above mapping array "A". Can I get any comments about it? 
> 
> Regards
> Mo



More information about the petsc-users mailing list