Skip to content

Commit

Permalink
Bsplines relax float asserts (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegouix authored Jul 5, 2024
1 parent 97099de commit 7f12edc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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 - rmin() >= -length() * 1e-14);
assert(rmax() - x >= -length() * 1e-14);
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 - rmin() >= -length() * 1e-14);
assert(rmax() - x >= -length() * 1e-14);
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 - rmin() >= -length() * 1e-14);
assert(rmax() - x >= -length() * 1e-14);
// 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 - rmin() >= -length() * 1e-14);
assert(rmax() - x >= -length() * 1e-14);

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 - rmin() >= -length() * 1e-14);
assert(rmax() - x >= -length() * 1e-14);
// 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 - rmin() >= -length() * 1e-14);
assert(rmax() - x >= -length() * 1e-14);

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

0 comments on commit 7f12edc

Please sign in to comment.