Skip to content

Commit

Permalink
interest coordinate
Browse files Browse the repository at this point in the history
  • Loading branch information
blegouix authored and tpadioleau committed May 18, 2024
1 parent 5945a76 commit a3bcb8e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
32 changes: 16 additions & 16 deletions include/ddc/kernels/splines/spline_evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,26 +241,26 @@ class SplineEvaluator
spline_coef) const
{
ddc::Coordinate<typename evaluation_mesh_type::continuous_dimension_type>
coord_eval_evaluation
coord_eval_interest
= ddc::select<typename evaluation_mesh_type::continuous_dimension_type>(coord_eval);
if constexpr (bsplines_type::is_periodic()) {
if (coord_eval_evaluation < ddc::discrete_space<bsplines_type>().rmin()
|| coord_eval_evaluation > ddc::discrete_space<bsplines_type>().rmax()) {
coord_eval_evaluation -= Kokkos::floor(
(coord_eval_evaluation
- ddc::discrete_space<bsplines_type>().rmin())
/ ddc::discrete_space<bsplines_type>().length())
* ddc::discrete_space<bsplines_type>().length();
if (coord_eval_interest < ddc::discrete_space<bsplines_type>().rmin()
|| coord_eval_interest > ddc::discrete_space<bsplines_type>().rmax()) {
coord_eval_interest -= Kokkos::floor(
(coord_eval_interest
- ddc::discrete_space<bsplines_type>().rmin())
/ ddc::discrete_space<bsplines_type>().length())
* ddc::discrete_space<bsplines_type>().length();
}
} else {
if (coord_eval_evaluation < ddc::discrete_space<bsplines_type>().rmin()) {
return m_left_extrap_rule(coord_eval_evaluation, spline_coef);
if (coord_eval_interest < ddc::discrete_space<bsplines_type>().rmin()) {
return m_left_extrap_rule(coord_eval_interest, spline_coef);
}
if (coord_eval_evaluation > ddc::discrete_space<bsplines_type>().rmax()) {
return m_right_extrap_rule(coord_eval_evaluation, spline_coef);
if (coord_eval_interest > ddc::discrete_space<bsplines_type>().rmax()) {
return m_right_extrap_rule(coord_eval_interest, spline_coef);
}
}
return eval_no_bc<eval_type>(coord_eval_evaluation, spline_coef);
return eval_no_bc<eval_type>(coord_eval_interest, spline_coef);
}

template <class EvalType, class Layout, class... CoordsDims>
Expand All @@ -278,12 +278,12 @@ class SplineEvaluator
std::experimental::extents<std::size_t, bsplines_type::degree() + 1>> const
vals(vals_ptr.data());
ddc::Coordinate<typename evaluation_mesh_type::continuous_dimension_type>
coord_eval_evaluation
coord_eval_interest
= ddc::select<typename evaluation_mesh_type::continuous_dimension_type>(coord_eval);
if constexpr (std::is_same_v<EvalType, eval_type>) {
jmin = ddc::discrete_space<bsplines_type>().eval_basis(vals, coord_eval_evaluation);
jmin = ddc::discrete_space<bsplines_type>().eval_basis(vals, coord_eval_interest);
} else if constexpr (std::is_same_v<EvalType, eval_deriv_type>) {
jmin = ddc::discrete_space<bsplines_type>().eval_deriv(vals, coord_eval_evaluation);
jmin = ddc::discrete_space<bsplines_type>().eval_deriv(vals, coord_eval_interest);
}
double y = 0.0;
for (std::size_t i = 0; i < bsplines_type::degree() + 1; ++i) {
Expand Down
12 changes: 6 additions & 6 deletions include/ddc/kernels/splines/spline_evaluator_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,23 +739,23 @@ class SplineEvaluator2D
std::experimental::extents<std::size_t, bsplines_type2::degree() + 1>> const
vals2(vals2_ptr.data());
ddc::Coordinate<typename evaluation_mesh_type1::continuous_dimension_type>
coord_eval_evaluation1
coord_eval_interest1
= ddc::select<typename evaluation_mesh_type1::continuous_dimension_type>(
coord_eval);
ddc::Coordinate<typename evaluation_mesh_type2::continuous_dimension_type>
coord_eval_evaluation2
coord_eval_interest2
= ddc::select<typename evaluation_mesh_type2::continuous_dimension_type>(
coord_eval);

if constexpr (std::is_same_v<EvalType1, eval_type>) {
jmin1 = ddc::discrete_space<bsplines_type1>().eval_basis(vals1, coord_eval_evaluation1);
jmin1 = ddc::discrete_space<bsplines_type1>().eval_basis(vals1, coord_eval_interest1);
} else if constexpr (std::is_same_v<EvalType1, eval_deriv_type>) {
jmin1 = ddc::discrete_space<bsplines_type1>().eval_deriv(vals1, coord_eval_evaluation1);
jmin1 = ddc::discrete_space<bsplines_type1>().eval_deriv(vals1, coord_eval_interest1);
}
if constexpr (std::is_same_v<EvalType2, eval_type>) {
jmin2 = ddc::discrete_space<bsplines_type2>().eval_basis(vals2, coord_eval_evaluation2);
jmin2 = ddc::discrete_space<bsplines_type2>().eval_basis(vals2, coord_eval_interest2);
} else if constexpr (std::is_same_v<EvalType2, eval_deriv_type>) {
jmin2 = ddc::discrete_space<bsplines_type2>().eval_deriv(vals2, coord_eval_evaluation2);
jmin2 = ddc::discrete_space<bsplines_type2>().eval_deriv(vals2, coord_eval_interest2);
}

double y = 0.0;
Expand Down

0 comments on commit a3bcb8e

Please sign in to comment.