Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

u.sub(0) should still be in a ComponentFunctionSpace if the vector is 1 dimensional #3902

Merged
merged 8 commits into from
Dec 3, 2024

Conversation

JHopeCollins
Copy link
Member

@JHopeCollins JHopeCollins commented Dec 3, 2024

Currrently, for u in a VectorFunctionSpace, the Functions returned by u.sub are in different types of spaces depending on the dimension of the VFS.

  • if dim is 2 or higher, then u.sub(i).function_space() is a ComponentProxyFunctionSpace.
  • if dim is 1, then u.sub(0) is u, instead of being in the ComponentProxyFunctionSpace.

This PR changes the u.sub(0) for 1-dim vectors to be in the ComponentProxyFunctionSpace by changing the if-statement to test self.rank instead of self.dof_dset.cdim.
Change made here:

if self.function_space().rank == 0:

The rest of the changes are making how/where the mixed/vector-ness is tested in subfunctions/sub/_components consistent across functions and function spaces.

@JHopeCollins JHopeCollins self-assigned this Dec 3, 2024
Copy link

github-actions bot commented Dec 3, 2024

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake complex8125 ran6540 passed1585 skipped0 failed

Copy link

github-actions bot commented Dec 3, 2024

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake real8131 ran7345 passed786 skipped0 failed

Copy link
Contributor

@connorjward connorjward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically just f-strings

firedrake/function.py Outdated Show resolved Hide resolved
firedrake/function.py Outdated Show resolved Hide resolved
firedrake/function.py Outdated Show resolved Hide resolved
firedrake/function.py Outdated Show resolved Hide resolved
firedrake/functionspaceimpl.py Outdated Show resolved Hide resolved
firedrake/functionspaceimpl.py Outdated Show resolved Hide resolved
firedrake/functionspaceimpl.py Outdated Show resolved Hide resolved
Co-authored-by: Connor Ward <[email protected]>
@JHopeCollins JHopeCollins enabled auto-merge (squash) December 3, 2024 16:23
@JHopeCollins JHopeCollins merged commit 530243e into master Dec 3, 2024
18 checks passed
@JHopeCollins JHopeCollins deleted the JHopeCollins/vector_sub1 branch December 3, 2024 17:05
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