Skip to content

Commit fab1202

Browse files
committed
Make some variables const and add documentation
1 parent b7c86e8 commit fab1202

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

include/ddc/kernels/splines/spline_evaluator_nd.hpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,9 @@ class SplineEvaluatorND<
367367
auto const spline_coef_ND = spline_coef[j];
368368
ddc::for_each(
369369
evaluation_domain_type<Idx...>(spline_eval.domain()),
370-
[=](typename evaluation_domain_type<Idx...>::discrete_element_type const
371-
i) {
370+
[=,
371+
*this](typename evaluation_domain_type<
372+
Idx...>::discrete_element_type const i) {
372373
spline_eval_ND(i) = eval(coords_eval_ND(i), spline_coef_ND);
373374
});
374375
});
@@ -754,7 +755,7 @@ class SplineEvaluatorND<
754755
std::is_same_v<batch_domain_type<BatchedDDom>, BatchedDDom>,
755756
"The integrals domain must only contain the batch dimensions");
756757

757-
batch_domain_type<BatchedDDom> batch_domain(integrals.domain());
758+
batch_domain_type<BatchedDDom> const batch_domain(integrals.domain());
758759
auto values_alloc = std::make_tuple(
759760
ddc::
760761
Chunk(ddc::DiscreteDomain<bsplines_type<Idx>>(spline_coef.domain()),
@@ -847,9 +848,11 @@ class SplineEvaluatorND<
847848
(update_coord_eval<Idx>(coord_eval), ...);
848849

849850
double res = 0.;
850-
bool needs_extrap = (... || check_needs_extrapolation<Idx>(coord_eval, spline_coef, res));
851+
// We rely on short circuit here. If we need to extrapolate on one of the dims, `res` will be set and `check_needs_extrapolation` will return true.
852+
bool const needs_extrapolation
853+
= (... || check_needs_extrapolation<Idx>(coord_eval, spline_coef, res));
851854

852-
if (needs_extrap) {
855+
if (needs_extrapolation) {
853856
return res;
854857
}
855858

@@ -962,6 +965,18 @@ struct SplineEvaluatorNDHelper<
962965

963966
} // namespace detail
964967

968+
/**
969+
* @brief A class to evaluate, differentiate or integrate a spline function of arbitrary dimension.
970+
*
971+
* A class which contains an operator () which can be used to evaluate, differentiate or integrate a spline function of arbitrary dimension.
972+
*
973+
* @tparam Args... The template parameters of the evaluator:
974+
* - ExecSpace The Kokkos execution space on which the spline evaluation is performed.
975+
* - MemorySpace The Kokkos memory space on which the data (spline coefficients and evaluation) is stored.
976+
* - BSplines A TypeSeq containing the N discrete dimensions representing the B-splines along the dimensions of interest.
977+
* - EvaluationDDim A TypeSeq containing the discrete dimensions on which evaluation points are defined.
978+
* - ExtrapolationRule A TypeSeq containing the lower and upper extrapolation rules along each dimension of interest.
979+
*/
965980
template <typename... Args>
966981
using SplineEvaluatorND = typename detail::SplineEvaluatorNDHelper<Args...>::type;
967982

0 commit comments

Comments
 (0)