libmesh icon indicating copy to clipboard operation
libmesh copied to clipboard

[WIP] Allow specifying element range in project_vector

Open hugary1995 opened this issue 4 months ago • 2 comments

Using std::optional to avoid breaking API. This is needed in moose element subdomain modifier where we need to project a function onto a subset of the mesh.

hugary1995 avatar Oct 02 '25 21:10 hugary1995

I will add some tests later. @roystgnr please let me know if this looks okay to you before I go too far.

hugary1995 avatar Oct 02 '25 21:10 hugary1995

Sorry I missed the comment here!

Definitely we want to add this feature.

I'd have made the range argument a pointer with a nullptr default, but out of force of habit rather than because it's a good idea, and I'm happy with std::optional here. Someone correct me if I'm wrong, but best practices now is to use std::optional for any object that's lightweight enough to not worry about copying, right? (and probably also for heavyweight objects, eventually, when C++26 adds optional<T&> support?) Our ranges are currently like 48 bytes, so the copies should be fine.

roystgnr avatar Oct 08 '25 15:10 roystgnr