Skip to content

RestrictedDualSet: inherit entity permutations - #267

Merged
pbrubeck merged 2 commits into
mainfrom
pbrubeck/restricted-entity-permutations
Aug 5, 2026
Merged

RestrictedDualSet: inherit entity permutations#267
pbrubeck merged 2 commits into
mainfrom
pbrubeck/restricted-entity-permutations

Conversation

@pbrubeck

@pbrubeck pbrubeck commented Jul 28, 2026

Copy link
Copy Markdown

Before this PR, RestrictedElement reported no entity permutations, and consumers that orient dofs entity by entity cannot lay out a restricted space consistently with the space it restricts.

By inheriting permuations, an entity whose dofs are all kept by the restriction will keep their relative order, so it would permute under orientation exactly as in the unrestricted case, and an entity whose dofs are all dropped permutes trivially.

An entity that keeps only some of its dofs (a very niche case) has no permutation to inherit, since the ones it drops may be where the parent permutation sends the ones it keeps, so no permutations are reported at all in that case.

An entity whose dofs are all kept by the restriction keeps their relative
order, so it permutes under orientation exactly as it did before, and an
entity whose dofs are all dropped permutes trivially.  An entity that
keeps only some of its dofs has no permutation to inherit, since the ones
it drops may be where the parent permutation sends the ones it keeps, so
no permutations are reported at all in that case.

Without this a restricted element reports no entity permutations, and
consumers that orient dofs entity by entity cannot lay out a restricted
space consistently with the space it restricts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck added a commit to firedrakeproject/firedrake that referenced this pull request Jul 28, 2026
A restricted element reports no entity permutations without it, so a
restricted space is not laid out consistently with the space it
restricts.

This PR is stacked on another branch rather than on main, which leaves
'base_ref' unrecognised, so PETSc has no branch to clone and the install
fails before any test runs.  Fall back to the main configuration, which
is the one this branch is ultimately aimed at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck added a commit to firedrakeproject/firedrake that referenced this pull request Jul 28, 2026
A restricted element reports no entity permutations without it, so a
restricted space is not laid out consistently with the space it
restricts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck added a commit to firedrakeproject/firedrake that referenced this pull request Jul 28, 2026
A restricted element reports no entity permutations without it, so a
restricted space is not laid out consistently with the space it
restricts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck added a commit to firedrakeproject/firedrake that referenced this pull request Jul 28, 2026
A restricted element reports no entity permutations without it, so a
restricted space is not laid out consistently with the space it
restricts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck added a commit to firedrakeproject/firedrake that referenced this pull request Jul 28, 2026
A restricted element reports no entity permutations without it, so a
restricted space is not laid out consistently with the space it
restricts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck added a commit to firedrakeproject/firedrake that referenced this pull request Jul 30, 2026
A restricted element reports no entity permutations without it, so a
restricted space is not laid out consistently with the space it
restricts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit f8f2cb5)
@pbrubeck
pbrubeck requested a review from connorjward August 4, 2026 15:52
@connorjward

Copy link
Copy Markdown

Before this PR, RestrictedElement reported no entity permutations, and consumers that orient dofs entity by entity cannot lay out a restricted space consistently with the space it restricts.

Why is this useful?

since the ones it drops may be where the parent permutation sends the ones it keeps

I don't understand what this means.

@pbrubeck

pbrubeck commented Aug 5, 2026

Copy link
Copy Markdown
Author

Why is this useful?

Consistency in the entity permutations ensures a consistent entity numbering between a FunctionSpace(RestrictedElement) and its unrestricted parent, so that we can use SF/Section to assign across restrictions firedrakeproject/firedrake#5287

since the ones it drops may be where the parent permutation sends the ones it keeps

I don't understand what this means.

RestrictedElement is generic, it can keep any subset of the DOFs on each entity. The most common restrictions are topological, so all DOFs on one entity are either kept or dropped, and propagating the entity permutations is allowed when all DOFs are kept. If only some DOFs are kept, we cannot keep the permutations because then the parent permutation might send parent DOFs to where the child has dropped them.

@connorjward

Copy link
Copy Markdown

Consistency in the entity permutations ensures a consistent entity numbering between a FunctionSpace(RestrictedElement) and its unrestricted parent, so that we can use SF/Section to assign across restrictions firedrakeproject/firedrake#5287

I just want to make sure that this is unrelated to entity_dofs. Data in the global vector is stored by topological entity so is unrelated to some of the FIAT numbering.

RestrictedElement is generic, it can keep any subset of the DOFs on each entity. The most common restrictions are topological, so all DOFs on one entity are either kept or dropped, and propagating the entity permutations is allowed when all DOFs are kept. If only some DOFs are kept, we cannot keep the permutations because then the parent permutation might send parent DOFs to where the child has dropped them.

I guess I have no idea why the entity permutations affect the global data layout. In principle we should be able to support assigning to arbitrary restricted elements using your new approach.

@pbrubeck

pbrubeck commented Aug 5, 2026

Copy link
Copy Markdown
Author

I guess I have no idea why the entity permutations affect the global data layout. In principle we should be able to support assigning to arbitrary restricted elements using your new approach.

The entity permutations were introduced to ensure a consistent DOFs numbering when redistributing a FunctionSpace (via Checkpointing). We only enable them for CG and DG spaces on simplices.

Sure, the SF/Section approach can be made as general as one like, but I'm afraid that mismatching entity-permutations might cost you extra book-keeping that can otherwise be resolved with something so simple as having children elements that obey their parents. I think we can always come back to get the niche case of partrial restrictions on an entity.

Either way, this PR is good on its own.

@connorjward

Copy link
Copy Markdown

I guess I have no idea why the entity permutations affect the global data layout. In principle we should be able to support assigning to arbitrary restricted elements using your new approach.

The entity permutations were introduced to ensure a consistent DOFs numbering when redistributing a FunctionSpace (via Checkpointing). We only enable them for CG and DG spaces on simplices.

Sure, the SF/Section approach can be made as general as one like, but I'm afraid that mismatching entity-permutations might cost you extra book-keeping that can otherwise be resolved with something so simple as having children elements that obey their parents. I think we can always come back to get the niche case of partrial restrictions on an entity.

I'm afraid I still don't see why this PR helps with anything. I have just grepped for entity_permutations in Firedrake and it is exclusively used to build node lists, to reorder DoFs relative to a particular cell or facet. We don't need those for assign because we don't do any packing there.

@pbrubeck

pbrubeck commented Aug 5, 2026

Copy link
Copy Markdown
Author

I'm afraid I still don't see why this PR helps with anything. I have just grepped for entity_permutations in Firedrake and it is exclusively used to build node lists, to reorder DoFs relative to a particular cell or facet. We don't need those for assign because we don't do any packing there.

It does no harm having consistent numbering in the node lists between the RestrictedElement and its parent space. Why should we have them ordered inconsistently if we know how to do it consistently?

Mathematically in FIAT, the restriction operation should propagate every piece of information of the element. Suppose you have a FunctionSpace with no interior DOFs and you restrict it to the facets, the restriction should be a noop. Without this PR that restriction silently gives you a different space.

@connorjward

Copy link
Copy Markdown

I'm afraid I still don't see why this PR helps with anything. I have just grepped for entity_permutations in Firedrake and it is exclusively used to build node lists, to reorder DoFs relative to a particular cell or facet. We don't need those for assign because we don't do any packing there.

It does no harm having consistent numbering in the node lists between the RestrictedElement and its parent space. Why should we have them ordered inconsistently if we know how to do it consistently?

Mathematically in FIAT, the restriction operation should propagate every piece of information of the element. Suppose you have a FunctionSpace with no interior DOFs and you restrict it to the facets, the restriction should be a noop. Without this PR that restriction silently gives you a different space.

This makes perfect sense. I am happy with that argument. I just get concerned when reasons are given that don't make sense.

Comment thread test/FIAT/unit/test_orientation.py Outdated
Comment thread test/FIAT/unit/test_orientation.py
Cover degree 1,2 Lagrange facet restrictions, and add a case where
restricting to a single dof on a shared entity drops permutations
entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pbrubeck
pbrubeck requested a review from connorjward August 5, 2026 11:04
@pbrubeck
pbrubeck merged commit 4608219 into main Aug 5, 2026
9 checks passed
@pbrubeck
pbrubeck deleted the pbrubeck/restricted-entity-permutations branch August 5, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants