[petsc-users] List of points with dof>0 in a PetscSection

Matthew Knepley knepley at gmail.com
Tue Jun 28 12:17:33 CDT 2022

On Fri, Jun 10, 2022 at 4:06 PM Blaise Bourdin <bourdin at mcmaster.ca> wrote:

> Hi,
> Given a PetscSection, is there an easy way to get a list of point at which
> the number of dof is >0?
> For instance, when projecting over a FE space, I’d rather do a loop over
> such points than do a loop over all points in a DM, get the number of dof,
> and test if it is >0.

We do not have an index like this. There is always a tradeoff between
direct indexing (as we have now in Section) and indirect indexing (as you
would have
if you compressed the indices). For internal uses, the search would never
pay off I think. It would not be hard to make this up front if you think it
would be
beneficial. I have never seen a case where the loop takes much more time
than the compressed version.



> Regards,
> Blaise
> --
> Professor, Department of Mathematics & Statistics
> Hamilton Hall room 409A, McMaster University
> 1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada
> https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243

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/20220628/d45ce1a1/attachment.html>

More information about the petsc-users mailing list