Skip to content
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

Bsplines relax float asserts #519

Merged
merged 7 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions include/ddc/kernels/splines/bsplines_non_uniform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<DDim> NonUniformBSplines<Tag, D>::
std::array<double, degree()> left;
std::array<double, degree()> right;

assert(x >= rmin());
assert(x <= rmax());
assert(x + Kokkos::abs(rmin()) * 1e-14 >= rmin());
tpadioleau marked this conversation as resolved.
Show resolved Hide resolved
assert(x - Kokkos::abs(rmax()) * 1e-14 <= rmax());
assert(values.size() == degree() + 1);

// 1. Compute cell index 'icell'
Expand Down Expand Up @@ -500,8 +500,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<DDim> NonUniformBSplines<Tag, D>::
std::array<double, degree()> left;
std::array<double, degree()> right;

assert(x >= rmin());
assert(x <= rmax());
assert(x + Kokkos::abs(rmin()) * 1e-14 >= rmin());
assert(x - Kokkos::abs(rmax()) * 1e-14 <= rmax());
assert(derivs.size() == degree() + 1);

// 1. Compute cell index 'icell'
Expand Down Expand Up @@ -573,8 +573,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<DDim> NonUniformBSplines<Tag, D>::
std::experimental::extents<std::size_t, degree() + 1, degree() + 1>> const
ndu(ndu_ptr.data());

assert(x >= rmin());
assert(x <= rmax());
assert(x + Kokkos::abs(rmin()) * 1e-14 >= rmin());
assert(x - Kokkos::abs(rmax()) * 1e-14 <= rmax());
// assert(n >= 0); as long as n is unsigned
assert(n <= degree());
assert(derivs.extent(0) == 1 + degree());
Expand Down Expand Up @@ -663,8 +663,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<NonUniformBsplinesKnots<DDim>> NonUn
Tag,
D>::Impl<DDim, MemorySpace>::find_cell_start(ddc::Coordinate<Tag> const& x) const
{
assert(x <= rmax());
assert(x >= rmin());
assert(x + Kokkos::abs(rmin()) * 1e-14 >= rmin());
assert(x - Kokkos::abs(rmax()) * 1e-14 <= rmax());

if (x == rmin())
return m_break_point_domain.front();
Expand Down
8 changes: 4 additions & 4 deletions include/ddc/kernels/splines/bsplines_uniform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement<DDim> UniformBSplines<Tag, D>::Impl<
double offset;
int jmin;

assert(x >= rmin());
assert(x <= rmax());
assert(x + Kokkos::abs(rmin()) * 1e-14 >= rmin());
assert(x - Kokkos::abs(rmax()) * 1e-14 <= rmax());
// assert(n >= 0); as long as n is unsigned
assert(n <= degree());
assert(derivs.extent(0) == 1 + degree());
Expand Down Expand Up @@ -554,8 +554,8 @@ KOKKOS_INLINE_FUNCTION void UniformBSplines<Tag, D>::Impl<DDim, MemorySpace>::ge
double& offset,
ddc::Coordinate<Tag> const& x) const
{
assert(x >= rmin());
assert(x <= rmax());
assert(x + Kokkos::abs(rmin()) * 1e-14 >= rmin());
assert(x - Kokkos::abs(rmax()) * 1e-14 <= rmax());

double const inv_dx = inv_step();
if (x == rmin()) {
Expand Down