-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fix extract block for tensor spaces #308
Conversation
@@ -148,7 +148,7 @@ def components(self) -> _typing.Dict[_typing.Tuple[int, ...], int]: | |||
offset = 0 | |||
c_offset = 0 | |||
for e in self.sub_elements: | |||
for i, j in enumerate(np.ndindex(e.value_shape)): | |||
for i, j in enumerate(np.ndindex(e.reference_value_shape)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change shouldn't be in this PR (see #307)
for i, j in enumerate(np.ndindex(e.reference_value_shape)): | |
for i, j in enumerate(np.ndindex(e.value_shape)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll revert it once 307 is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :)
Nice! This'll be really handy for coupled problems. Do we have a test? |
I think we can adapt the stokes demo. I use this in many of my own works lately. |
To be able to easily extract blocks from
ufl.MixedFuntionSpaces
.Motivation:
Instead of writing out every block of
a
andL
by hand, asone can now do
It also fixes
extract_blocks
for tensors, and properly document this function, as to what happens ifi
orj
is not provided.Now it extracts the blocks as a scalar, vector or tensor.