Skip to content

Comments

Mesh, dofmap, coef from masks.#2319

Open
adperezm wants to merge 53 commits intoExtremeFLOW:developfrom
adperezm:feature/submesh
Open

Mesh, dofmap, coef from masks.#2319
adperezm wants to merge 53 commits intoExtremeFLOW:developfrom
adperezm:feature/submesh

Conversation

@adperezm
Copy link
Collaborator

@adperezm adperezm commented Feb 13, 2026

Hi,

This one complements a bit #2315 and depends on #2305

The idea here is to create mesh_t and dofmap_t from masks. This allows to do anything you would do with those. For example, write out files. So in this case, one could write a subdomain form the user module and a point_zone with:

call neko_user_access%case%fluid%c_Xh%dof%subset_by_mask(dof, my_point_zone%mask)
call field%init(dof)
call field_masked_gather_copy(field, temp%x(:,1, 1, 1), my_point_zone%mask, temp%dof%size())
call output%write(field, time%t)

So this one would work like #2315. However, in this case, there would be copies of data floating around, not nicely with pointers.

I think both approaches have their uses, and therefore I think both should be allowed in the main code.

I think the one thing that would not work here is to perform dssum after creating the gs_t from subsets. This is because I had to overwrite the original ids of the points in the elements to avoid problems with periodic boundaries. If anyone has any idea on how to keep using the original points ids while still reliably being able to generate dofmaps from mesh_t, then I would be happy.

(this should get much more cleaner for review after #2305 is in)

adperezm and others added 30 commits January 30, 2026 15:12
Co-authored-by: Timofey Mukha <timofey.mukha@protonmail.com>
Co-authored-by: Victor Baconnet <baconnet@kth.se>
…ol' into feature/full_element_point_zones"

This reverts commit 46dd43b, reversing
changes made to 5c701c7.
Co-authored-by: Victor Baconnet <baconnet@kth.se>
Co-authored-by: Victor Baconnet <baconnet@kth.se>
Co-authored-by: Victor Baconnet <baconnet@kth.se>
Co-authored-by: Victor Baconnet <baconnet@kth.se>
@adperezm adperezm requested a review from njansson February 13, 2026 13:51
@adperezm adperezm changed the title Feature/sub_mesh Mesh, dofmap, coef from masks. Feb 13, 2026
@njansson
Copy link
Collaborator

Nice!

Is the checks in gather-scatter to prevent posting "empty" send/recv since that part of the domain is outside of the mask? Or is the gather-scatter exchange non-symmetric (as in the communication for global interpolation)?

@adperezm
Copy link
Collaborator Author

Nice!

Is the checks in gather-scatter to prevent posting "empty" send/recv since that part of the domain is outside of the mask? Or is the gather-scatter exchange non-symmetric (as in the communication for global interpolation)?

Thanks! :D

Yes, in this case it was to prevent "empty" send/recv.

I wanted to be able to build coef from these and I was getting segfaults when there were ranks with no data. In the future I would add an option to redistribute the elements that are in the mask among all ranks, but I left that for another PR.

@adperezm
Copy link
Collaborator Author

Let me know if you would like me to change something more here. Otherwise I guess review help wanted :D

@timfelle
Copy link
Collaborator

One thing to go through is to standardize the logical operators. In general we use the word based operators, .ge. rather than >=. I can see you are mixing a bit between the two.

mask_d = device_get_ptr(mask)
a_d = device_get_ptr(a)
call device_masked_gather_copy_0(a_d, b%x_d, mask_d, n, n_mask)
b_d = device_get_ptr(b)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any chance we can please not do this? There should be a variant with a device pointer instead of implicitly looking for a device array which may, or may not have been associated with the variable.

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.

4 participants