Refactor dolfinx::fem::Form to use local indexing of forms, rather than integral ids#3740
Refactor dolfinx::fem::Form to use local indexing of forms, rather than integral ids#3740
dolfinx::fem::Form to use local indexing of forms, rather than integral ids#3740Conversation
|
Can you add some gentle background to the PR description? |
I've added an example to the description of the PR. |
|
@garth-wells any further comments? |
|
Yes, will add comments asap. |
|
@garth-wells I've addressed your comments. Good to merge? |
|
This is more of a critical bug-fix, so should go in asap. Btw. is the local index now needed? Looks like it will always be 0, 1, 2, ..., num_integrals |
They will if we integrate over all kernels and associated subdomain ids. dolfinx/cpp/dolfinx/fem/assemble_matrix_impl.h Lines 594 to 598 in d74fcba If you do not have that index, you have no sensible way of associating the set of forms with some integral ideas. I also think this should get merged, as it makes it possible to customize quadrature per integral measure used. |
|
@garth-wells Anything more needs addressing? We should merge this bugfix and can improve the data layout further if needed. |
All comments resolved. No new changes requested.
|
I've created issue #3876 to discuss a possible redesign of integrals storage. The bug is fixed with this PR, but situation could be much improved. |
As shown in: #3735, there are many UFL forms (especially in the case of mixed quadrature rules), where the
subdomain_idis not mapped 1-1 with an integration kernel.This PR refactors the Form class, to rather use the local indexing from the generated code (where integrals have been grouped) as the lookup key for the integral.
Only a minor change occurs in the user-interface, as
Form::subdomain_idsno longer maps to the UFL subdomain_ids.However, this is currently only used for internal looping, as the integral_idx -> subdomain_id mapping happens within the
create_form_factoryfunction.This allows for different quadrature degrees in different parts of a form.
Example:
This generates two different integration kernels in FFCx, with the integral information as:
As seen in the latter line here,
form_integral_ids_form_*is not a list of unique integers.In the main branch of DOLFINx, we assume that this id is unique, which is the root cause of #3735.