On Thu, Nov 19, 2020 at 4:35 PM Zhang, Hong <hzh...@mcs.anl.gov> wrote:
> Matt, > At a local section point (including ghost point), how to find all the > owners? For example, proc[0] and proc[2] share p. How proc[0] find that > proc[2] is an owner? Any routine would provide this info? > All ownership data is handled by the PetscSF, the Section just stores local information about data. You can ask the SF is a point is a leaf, meaning that it is not owned. You can also ask for an owned point, how many other processes have it as a leaf: https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PetscSF/PetscSFComputeDegreeBegin.html Thanks, Matt > Hong > > ------------------------------ > *From:* Matthew Knepley <knep...@gmail.com> > *Sent:* Wednesday, November 18, 2020 1:56 PM > *To:* Lawrence Mitchell <we...@gmx.li> > *Cc:* Zhang, Hong <hzh...@mcs.anl.gov>; petsc-dev <petsc-dev@mcs.anl.gov> > *Subject:* Re: [petsc-dev] Can I call PetscSectionAddDof(s, p, ndof) at a > shred 'p' by more than one processors? > > On Wed, Nov 18, 2020 at 2:19 PM Lawrence Mitchell <we...@gmx.li> wrote: > > > On 18 Nov 2020, at 15:26, Zhang, Hong via petsc-dev < > petsc-dev@mcs.anl.gov> wrote: > > > > Matt or Jed, > > Can I call PetscSectionAddDof(s,p,ndof) at a shred 'p' by more than one > processors? For example, > > if (rank == 0) { > > PetscSectionAddDof(s,p,1) ; > > } else if (rank == 1) { > > PetscSectionAddDof(s,p,2) ; > > } > > Then, at shared 'p', section 's' has dof=3? > > Sections are "local" objects that are tied together by an SF that > describes point ownership. > > So I think that the only thing you need is that if two processes set a dof > on what is globally the same point, they should agree on how many dofs live > there. > > I wonder if PetscSectionAddDof (etc...) should be marked as logically > collective. > > > Right now, what you want is handled by creating a global Section from a > local Section: > > > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PetscSection/PetscSectionCreateGlobalSection.html > > The global Section contains global offsets for all local points, and the > ghost points have negative offsets. > > There is no facility for combining dofs. The idea is that you know the > number of dofs on each local point. If you change that > interpretation, you could easily use SF to add them up and broadcast the > sum. > > Thanks, > > Matt > > > Lawrence > > -- > 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/>