-
Notifications
You must be signed in to change notification settings - Fork 7
Add spline compatibility check helper #878
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #878 +/- ##
=======================================
Coverage 89.94% 89.94%
=======================================
Files 55 55
Lines 2863 2863
Branches 976 976
=======================================
Hits 2575 2575
Misses 91 91
Partials 197 197 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Following changes are needed?
template <class Builder, class Evaluator>
struct is_spline_compatible<Builder, Evaluator,
std::enable_if_t<is_spline_builder_v<Builder> && is_spline_evaluator_v<Evaluator>
|| is_spline_builder_v<Evaluator> && is_spline_evaluator_v<Builder> >> Should be template <class Builder, class Evaluator>
struct is_spline_compatible<Builder, Evaluator,
std::enable_if_t<(is_spline_builder_v<Builder> && is_spline_evaluator_v<Evaluator>)
|| (is_spline_builder_v<Evaluator> && is_spline_evaluator_v<Builder>) >> |
You can keep
Yes please
Yes I guess the point of the linter is to clarify the intent. |
OK
What kind of docstrings do you prefer?
OK |
}; | ||
|
||
template <class Builder, class Evaluator> | ||
struct is_spline_compatible<Builder, Evaluator, |
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.
I'm not sure this name is very explicit. I would expect it to check if a spline is compatible with a builder or if a spline is compatible with an evaluator, not if a spline builder is compatible with an evaluator
I'm not sure what to suggest instead though
struct is_spline_compatible<Builder, Evaluator, | |
struct is_spline_interpolation_possible<Builder, Evaluator, |
struct is_spline_compatible<Builder, Evaluator, | |
struct is_interpolation_possible<Builder, Evaluator, |
?
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.
I do not have a strong preference.
But, I would prefer to include a term spline
at least and ideally not too long
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.
I definitely agree that it should not be too long.
I'm not sure it is important to include spline
though? If you had a different intermediate representation it is likely that you would still need a similar check for a compatible Builder and Evaluator. That is why I suggested is_interpolation_possible
If splines are important then maybe shares_spline_basis
? But this doesn't cover the Memory/Execution space aspects
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.
After some discussion, we decided to rename it as is_evaluator_admissible<Builder, Evaluator>
and we do not accept is_evaluator_admissible<Evaluator, Builder>
64b4312
to
b33f82c
Compare
@tpadioleau Can you format this |
Done |
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.
Thanks for the contribution! Just a few comments about the form. Can you also add your name to the authors ?
#include "spline_evaluator_2d.hpp" | ||
|
||
namespace ddc { | ||
template <class 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.
template <class T> | |
template <class T> |
#include <cassert> | ||
#include <cstddef> | ||
#include <memory> | ||
#include <optional> | ||
#include <stdexcept> | ||
#include <tuple> | ||
#include <type_traits> | ||
#include <utility> |
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.
Can you update the list of headers ?
inline constexpr bool is_spline_builder_v = is_spline_builder<T>::value; | ||
|
||
template <class T> | ||
struct is_spline_builder2D : std::false_type |
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.
struct is_spline_builder2D : std::false_type | |
struct is_spline_builder2d : std::false_type |
ddc::BoundCond BcLower2, | ||
ddc::BoundCond BcUpper2, | ||
ddc::SplineSolver Solver> | ||
struct is_spline_builder2D<SplineBuilder2D< |
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.
struct is_spline_builder2D<SplineBuilder2D< | |
struct is_spline_builder2d<SplineBuilder2D< |
* @tparam T The type to be checked if is a SplineBuilder2D | ||
*/ | ||
template <class T> | ||
inline constexpr bool is_spline_builder2D_v = is_spline_builder2D<T>::value; |
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.
inline constexpr bool is_spline_builder2D_v = is_spline_builder2D<T>::value; | |
inline constexpr bool is_spline_builder2d_v = is_spline_builder2d<T>::value; |
inline constexpr bool is_spline_evaluator_v = is_spline_evaluator<T>::value; | ||
|
||
template <class T> | ||
struct is_spline_evaluator2D : std::false_type |
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.
struct is_spline_evaluator2D : std::false_type | |
struct is_spline_evaluator2d : std::false_type |
class UpperExtrapolationRule1, | ||
class LowerExtrapolationRule2, | ||
class UpperExtrapolationRule2> | ||
struct is_spline_evaluator2D<SplineEvaluator2D< |
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.
struct is_spline_evaluator2D<SplineEvaluator2D< | |
struct is_spline_evaluator2d<SplineEvaluator2D< |
* @tparam T The type to be checked if is a SplineEvaluator2D | ||
*/ | ||
template <class T> | ||
inline constexpr bool is_spline_evaluator2D_v = is_spline_evaluator2D<T>::value; |
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.
inline constexpr bool is_spline_evaluator2D_v = is_spline_evaluator2D<T>::value; | |
inline constexpr bool is_spline_evaluator2d_v = is_spline_evaluator2D<T>::value; |
#include <cstddef> | ||
#include <stdexcept> | ||
#include <vector> |
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.
Can you update the list of headers ?
|
||
#include "test_utils.hpp" | ||
|
||
struct DimX |
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.
Can you put struct DimX, DDimX, DimY, DDimY and BSplinesTraits in an inline namespace ?
inline namespace anonymous_namespace_workaround_spline_traits_cpp { }
This PR aims at a helper to check the consistency of spline builder and evaluator.
For some reason, I need double parentheses to use
ASSERT_FALSE
likeASSERT_FALSE((ddc::is_spline_compatible_v<Builder2D_1, Builder2D_1>));