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

Add DoF extraction function #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add DoF extraction function #2

wants to merge 1 commit into from

Conversation

Psirus
Copy link
Collaborator

@Psirus Psirus commented Feb 8, 2019

So the idea was that I could throw any Function, subfunction or expression into a function and get a numpy vector back that I could plot. Basically it does:

  • Function -> f.vector()
  • subfunction -> interpolate(f, fs).vector()
  • expression -> project(expr).vector()

and I'm not sure anymore how useful this is. Let me know.

Edit: Reason for build failure: the behaviour seems to have changed going from 2017.2 to 2018.1 for the subfunction. Will investigate later.

@Psirus Psirus requested a review from TTitscher February 8, 2019 11:25
@TTitscher
Copy link
Contributor

TTitscher commented Jun 23, 2020

Is this still relevant?

A more general approach would transform a function/subfunction/expression (optional argument is the function space/mesh?) into a Function. This can then be plotted. If you prefer the numpy.array, call .vector()[:] afterwards.

The use case for me would be:

f = XDMFFile(....)
f.write(helpers.to_function(u), t) # does basically nothing, just common interface
f.write(helpers.to_function(sqrt(u)), t)
f.write(helpers.to_function(sqrt(u), super_fine_plotting_mesh), t)

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