Skip to content

Commit

Permalink
Remove unnecessary constexpr qualification
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Dec 31, 2024
1 parent 04aced3 commit c227a07
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
10 changes: 5 additions & 5 deletions tests/splines/batched_2d_spline_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,21 @@ using BatchDims = ddc::type_seq_remove_t<ddc::detail::TypeSeq<X...>, ddc::detail

// Templated function giving first coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> x0()
KOKKOS_FUNCTION Coord<X> x0()
{
return Coord<X>(0.);
}

// Templated function giving last coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> xN()
KOKKOS_FUNCTION Coord<X> xN()
{
return Coord<X>(1.);
}

// Templated function giving step of the mesh in given dimension.
template <typename X>
constexpr double dx(std::size_t ncells)
double dx(std::size_t ncells)
{
return (xN<X>() - x0<X>()) / ncells;
}
Expand Down Expand Up @@ -215,7 +215,7 @@ void Batched2dSplineTest()
// Instantiate execution spaces and initialize spaces
Kokkos::DefaultHostExecutionSpace const host_exec_space;
ExecSpace const exec_space;
std::size_t constexpr ncells = 10;
std::size_t const ncells = 10;
DimsInitializer<
DDim<I1, I1, I2>,
DDim<I2, I1, I2>,
Expand Down Expand Up @@ -304,7 +304,7 @@ void Batched2dSplineTest()

#if defined(BC_HERMITE)
// Allocate and fill a chunk containing derivs to be passed as input to spline_builder.
int constexpr shift = s_degree % 2; // shift = 0 for even order, 1 for odd order
int const shift = s_degree % 2; // shift = 0 for even order, 1 for odd order
ddc::Chunk derivs_1d_lhs_alloc(dom_derivs_1d, ddc::KokkosAllocator<double, MemorySpace>());
ddc::ChunkSpan const derivs_1d_lhs = derivs_1d_lhs_alloc.span_view();
if (s_bcl == ddc::BoundCond::HERMITE) {
Expand Down
10 changes: 5 additions & 5 deletions tests/splines/batched_spline_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ using BatchDims = ddc::type_seq_remove_t<ddc::detail::TypeSeq<Y...>, ddc::detail

// Templated function giving first coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> x0()
KOKKOS_FUNCTION Coord<X> x0()
{
return Coord<X>(0.);
}

// Templated function giving last coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> xN()
KOKKOS_FUNCTION Coord<X> xN()
{
return Coord<X>(1.);
}

// Templated function giving step of the mesh in given dimension.
template <typename X>
constexpr double dx(std::size_t ncells)
double dx(std::size_t ncells)
{
return (xN<X>() - x0<X>()) / ncells;
}
Expand Down Expand Up @@ -202,7 +202,7 @@ void BatchedSplineTest()
Kokkos::DefaultHostExecutionSpace const host_exec_space;
ExecSpace const exec_space;

std::size_t constexpr ncells = 10;
std::size_t const ncells = 10;
DimsInitializer<DDim<I, I>, BatchDims<DDim<I, I>, DDim<X, I>...>> dims_initializer;
dims_initializer(ncells);

Expand Down Expand Up @@ -264,7 +264,7 @@ void BatchedSplineTest()

#if defined(BC_HERMITE)
// Allocate and fill a chunk containing derivs to be passed as input to spline_builder.
int constexpr shift = s_degree_x % 2; // shift = 0 for even order, 1 for odd order
int const shift = s_degree_x % 2; // shift = 0 for even order, 1 for odd order
ddc::Chunk derivs_lhs_alloc(dom_derivs, ddc::KokkosAllocator<double, MemorySpace>());
ddc::ChunkSpan const derivs_lhs = derivs_lhs_alloc.span_view();
if (s_bcl == ddc::BoundCond::HERMITE) {
Expand Down
24 changes: 12 additions & 12 deletions tests/splines/bsplines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnityUniform)
using DimX = typename TestFixture::DimX;
using BSplinesX = typename TestFixture::UBSplinesX;
using CoordX = ddc::Coordinate<DimX>;
static constexpr CoordX xmin(0.0);
static constexpr CoordX xmax(0.2);
static constexpr std::size_t ncells = TestFixture::ncells;
CoordX const xmin(0.0);
CoordX const xmax(0.2);
std::size_t const ncells = TestFixture::ncells;
ddc::init_discrete_space<BSplinesX>(xmin, xmax, ncells);

std::array<double, degree + 1> values_ptr;
Expand All @@ -87,9 +87,9 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnityNonUniform)
using DimX = typename TestFixture::DimX;
using BSplinesX = typename TestFixture::NUBSplinesX;
using CoordX = ddc::Coordinate<DimX>;
static constexpr CoordX xmin(0.0);
static constexpr CoordX xmax(0.2);
static constexpr std::size_t ncells = TestFixture::ncells;
CoordX const xmin(0.0);
CoordX const xmax(0.2);
std::size_t const ncells = TestFixture::ncells;
std::vector<CoordX> breaks(ncells + 1);
double dx = (xmax - xmin) / ncells;
for (std::size_t i(0); i < ncells + 1; ++i) {
Expand Down Expand Up @@ -139,9 +139,9 @@ TYPED_TEST(BSplinesFixture, RoundingNonUniform)
using DimX = typename TestFixture::DimX;
using BSplinesX = typename TestFixture::NUBSplinesX;
using CoordX = ddc::Coordinate<DimX>;
static constexpr CoordX xmin(0.0);
static constexpr CoordX xmax(0.2);
static constexpr std::size_t ncells = TestFixture::ncells;
CoordX const xmin(0.0);
CoordX const xmax(0.2);
std::size_t const ncells = TestFixture::ncells;
std::vector<CoordX> breaks(ncells + 1);
double const dx = (xmax - xmin) / ncells;
for (std::size_t i(0); i < ncells + 1; ++i) {
Expand Down Expand Up @@ -173,9 +173,9 @@ TYPED_TEST(BSplinesFixture, RoundingUniform)
using DimX = typename TestFixture::DimX;
using BSplinesX = typename TestFixture::UBSplinesX;
using CoordX = ddc::Coordinate<DimX>;
static constexpr CoordX xmin(0.0);
static constexpr CoordX xmax(0.2);
static constexpr std::size_t ncells = TestFixture::ncells;
CoordX const xmin(0.0);
CoordX const xmax(0.2);
std::size_t const ncells = TestFixture::ncells;
ddc::init_discrete_space<BSplinesX>(xmin, xmax, ncells);

ddc::DiscreteDomain<BSplinesX> const bspl_full_domain
Expand Down
8 changes: 4 additions & 4 deletions tests/splines/extrapolation_rule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,21 @@ using BatchDims = ddc::type_seq_remove_t<ddc::detail::TypeSeq<X...>, ddc::detail

// Templated function giving first coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> x0()
KOKKOS_FUNCTION Coord<X> x0()
{
return Coord<X>(0.);
}

// Templated function giving last coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> xN()
KOKKOS_FUNCTION Coord<X> xN()
{
return Coord<X>(1.);
}

// Templated function giving step of the mesh in given dimension.
template <typename X>
constexpr double dx(std::size_t ncells)
double dx(std::size_t ncells)
{
return (xN<X>() - x0<X>()) / ncells;
}
Expand Down Expand Up @@ -203,7 +203,7 @@ void ExtrapolationRuleSplineTest()
// Instantiate execution spaces and initialize spaces
Kokkos::DefaultHostExecutionSpace const host_exec_space;
ExecSpace const exec_space;
std::size_t constexpr ncells = 10;
std::size_t const ncells = 10;
DimsInitializer<
DDim<I1, I1, I2>,
DDim<I2, I1, I2>,
Expand Down
2 changes: 1 addition & 1 deletion tests/splines/knots_as_interpolation_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TYPED_TEST(UniformBSplinesFixture, KnotsAsInterpolationPoints)
using DDimX = typename TestFixture::DDimX;
using BSplinesX = typename TestFixture::BSplinesX;
using CoordX = ddc::Coordinate<DimX>;
constexpr ddc::BoundCond Bc = TestFixture::Bc;
ddc::BoundCond const Bc = TestFixture::Bc;
using KnotsAsInterpolationPoints = ddc::KnotsAsInterpolationPoints<BSplinesX, Bc, Bc>;
using Knots = ddc::knot_discrete_dimension_t<BSplinesX>;

Expand Down
10 changes: 5 additions & 5 deletions tests/splines/non_periodic_spline_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ void TestNonPeriodicSplineBuilderTestIdentity()
using execution_space = Kokkos::DefaultExecutionSpace;
using memory_space = execution_space::memory_space;

CoordX constexpr x0(0.);
CoordX constexpr xN(1.);
std::size_t constexpr ncells = 10;
CoordX const x0(0.);
CoordX const xN(1.);
std::size_t const ncells = 10;

// 1. Create BSplines
{
#if defined(BSPLINES_TYPE_UNIFORM)
ddc::init_discrete_space<BSplinesX>(x0, xN, ncells);
#elif defined(BSPLINES_TYPE_NON_UNIFORM)
DVectX constexpr npoints(ncells + 1);
DVectX const npoints(ncells + 1);
std::vector<CoordX> breaks(npoints);
double const dx = (xN - x0) / ncells;
for (int i(0); i < npoints; ++i) {
Expand Down Expand Up @@ -132,7 +132,7 @@ void TestNonPeriodicSplineBuilderTestIdentity()
yvals.domain(),
KOKKOS_LAMBDA(IndexX const ix) { yvals(ix) = evaluator(ddc::coordinate(ix)); });

int constexpr shift = s_degree_x % 2; // shift = 0 for even order, 1 for odd order
int const shift = s_degree_x % 2; // shift = 0 for even order, 1 for odd order
ddc::Chunk derivs_lhs_alloc(derivs_domain, ddc::KokkosAllocator<double, memory_space>());
ddc::ChunkSpan const derivs_lhs = derivs_lhs_alloc.span_view();
if (s_bcl == ddc::BoundCond::HERMITE) {
Expand Down
8 changes: 4 additions & 4 deletions tests/splines/periodic_spline_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ void TestPeriodicSplineBuilderTestIdentity()
using execution_space = Kokkos::DefaultExecutionSpace;
using memory_space = execution_space::memory_space;

CoordX constexpr x0(0.);
CoordX constexpr xN(1.);
std::size_t constexpr ncells = 10;
CoordX const x0(0.);
CoordX const xN(1.);
std::size_t const ncells = 10;

// 1. Create BSplines
{
#if defined(BSPLINES_TYPE_UNIFORM)
ddc::init_discrete_space<BSplinesX>(x0, xN, ncells);
#elif defined(BSPLINES_TYPE_NON_UNIFORM)
DVectX constexpr npoints(ncells + 1);
DVectX const npoints(ncells + 1);
std::vector<CoordX> breaks(npoints);
double const dx = (xN - x0) / ncells;
for (int i(0); i < npoints; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions tests/splines/periodic_spline_builder_ordered_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ using CoordX = ddc::Coordinate<DimX>;

TEST(PeriodicSplineBuilderOrderTest, OrderedPoints)
{
std::size_t constexpr ncells = 10;
std::size_t const ncells = 10;

// 1. Create BSplines
int constexpr npoints(ncells + 1);
int const npoints(ncells + 1);
std::vector<double> d_breaks({0, 0.01, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0});
std::vector<CoordX> breaks(npoints);
for (std::size_t i(0); i < npoints; ++i) {
Expand Down
8 changes: 4 additions & 4 deletions tests/splines/periodicity_spline_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ using Coord = ddc::Coordinate<X...>;

// Templated function giving first coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> x0()
Coord<X> x0()
{
return Coord<X>(0.);
}

// Templated function giving last coordinate of the mesh in given dimension.
template <typename X>
constexpr Coord<X> xN()
Coord<X> xN()
{
return Coord<X>(1.);
}

// Templated function giving step of the mesh in given dimension.
template <typename X>
constexpr double dx(std::size_t ncells)
double dx(std::size_t ncells)
{
return (xN<X>() - x0<X>()) / ncells;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ void PeriodicitySplineBuilderTest()
Kokkos::DefaultHostExecutionSpace const host_exec_space;
ExecSpace const exec_space;

std::size_t constexpr ncells = 10;
std::size_t const ncells = 10;
DimsInitializer<DDim<X>> dims_initializer;
dims_initializer(ncells);

Expand Down

0 comments on commit c227a07

Please sign in to comment.