Skip to content

Commit 055e8da

Browse files
committed
enabled order 0 splines, directly returns 0 when asked for derivative order strictly smaller than spline order
1 parent 73e55bc commit 055e8da

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fdaPDE/src/fields/spline.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Spline : public ScalarFieldBase<1, Spline> {
5252
template <typename InputType_>
5353
requires(internals::is_subscriptable<InputType_, int> || std::is_floating_point_v<InputType_>)
5454
constexpr Scalar operator()(const InputType_& p_) const {
55+
if (n_ > order_) { return 0.0; } // derivative order higher than spline order
5556
double p;
5657
if constexpr (internals::is_subscriptable<InputType_, int>) {
5758
p = p_[0];
@@ -117,7 +118,7 @@ class Spline : public ScalarFieldBase<1, Spline> {
117118
})
118119
Spline(KnotsVectorType&& knots, int i, int order) : i_(i), order_(order) {
119120
fdapde_assert(
120-
i >= 0 && order > 0 && std::cmp_greater_equal(knots.size(), order_ + 1) && std::cmp_less(i_, knots.size()));
121+
i >= 0 && order >= 0 && std::cmp_greater_equal(knots.size(), order + 1) && std::cmp_less(i_, knots.size()));
121122
knots_.reserve(knots.size());
122123
for (std::size_t i = 0; i < knots.size(); ++i) { knots_.push_back(knots[i]); }
123124
};

0 commit comments

Comments
 (0)