-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Constrain scalar types with concept #2690
Conversation
Looking at the diff I've used dolfinx::scalar in some places where instead I should have used std::floating_point so I will make these changes. This would support changing all mesh related T to U throughout. |
cpp/dolfinx/fem/discreteoperators.h
Outdated
@@ -47,7 +47,7 @@ namespace dolfinx::fem | |||
/// @param[in] V1 Nédélec (first kind) element and and dofmap for | |||
/// corresponding space to interpolate into | |||
/// @param[in] mat_set A functor that sets values in a matrix | |||
template <typename T, std::floating_point U = dolfinx::scalar_value_type_t<T>> | |||
template <dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this constraint U to be the same scalar type as T? Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Tiny formatting comment.
This PR constrains T (which is usually used to denote a scalar related to the finite element coefficients) to be a real or complex floating point type. Let me know if this needs to be widened re: multi-precision support.
In terms of naming 'field' might be more mathematically correct than 'scalar'.
I wonder also if we should change all of the Mesh related Ts to Us throughout?