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

Let integration entities be specified manually #2269

Merged
merged 160 commits into from
Mar 13, 2023

Conversation

jpdean
Copy link
Member

@jpdean jpdean commented Jul 15, 2022

Currently, Form computes which entities to integrate over from a MeshTags object. This is fine for many common use cases, but in more specialised applications, it is useful to be able to specify the entities to assemble over manually. For instance, the user may want to perform a "one sided" facet integral on some interior facets of the mesh, which is not currently possible.

This PR refactors Form so that the entities to integrate over can be specified manually. A free function has been added to compute integration entities from meshtags, rather than this being computed in the form Form class.

There are still a few issues to fix:

  1. In python, since a plain dictionary does not have a ufl_id, it causes this check to fail. However, the check may not be necessary. If it is, id could be called on the data instead.
  2. There are a couple of places where data is being copied. There are a few ways to avoid these copies, but I'm not sure which approach would be best. Any suggestions would be much appreciated.
  3. Any suggestions on the best way to do the python bindings would be very helpful. At the moment, facets are flattened in both python and C++. I think it would be better to only flatten them in C++, but I'm open to suggestions!

@jpdean jpdean marked this pull request as ready for review March 6, 2023 18:07
@jpdean jpdean requested a review from garth-wells March 6, 2023 18:07
Copy link
Member

@garth-wells garth-wells left a comment

Choose a reason for hiding this comment

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

Last task is to replace some std::vector<std::int32_t> with py::array_t.

Might need to do some copies, but maybe some std::vector can be changed to std::span in C++ layer. Depends on how clever casting is.

@garth-wells garth-wells added this pull request to the merge queue Mar 13, 2023
Merged via the queue into main with commit c348948 Mar 13, 2023
@garth-wells garth-wells deleted the jpdean/manual_integration_domains_2 branch March 13, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants