Open jhale opened 2 months ago
set_bc
: make $x_0$ optional (this will require some more changes, but should be able to remove a quite drastic code duplication problem)locate_entities_boundary
and exterior_facet_indices
combinable - see https://github.com/FEniCS/dolfinx/pull/3283locate_dofs_topological
)
Describe new/missing feature
std::optional
provides a modern way to express passing or returning value or not computed.We are currently using many sentinel function arguments and return values including
-1
,nullptr
and empty strings that require the user to read the docstring of the function to understand the argument or return value. These can be replaced withstd::optional
which is very explicit. An additional advantage is that nanobind has support forstd::optional
which results in consistent behaviour between the Python (typing.Optional
) and C++ interfaces and a reduction in Python wrapper code complexity.A first step would be identifying all
typing.Optional
arguments in Python which typically leads to a sentinel in C++.Examples of use are here:
https://github.com/FEniCS/dolfinx/pull/3328 https://github.com/FEniCS/dolfinx/pull/3322
Suggested user interface
No response