use constexpr instead of define for better typechecking

This commit is contained in:
Axel Kohlmeyer
2020-12-22 10:40:28 -05:00
parent ce24d70ccc
commit 7a934eac37
2 changed files with 7 additions and 5 deletions

View File

@ -19,8 +19,6 @@
#include "error.h"
#include "domain.h"
#define DELTA 10 // much smaller than atom_vec.cpp
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
@ -35,10 +33,13 @@ AtomVecKokkos::AtomVecKokkos(LAMMPS *lmp) : AtomVec(lmp)
no_border_vel_flag = 1;
}
static constexpr bigint DELTA=10; // much smaller than DELTA in atom_vec.cpp
/* ----------------------------------------------------------------------
roundup N so it is a multiple of DELTA
error if N exceeds 32-bit int, since will be used as arg to grow()
overload needed because Kokkos uses a smaller DELTA than in atom_vec.cpp
and an exponential instead of a linear growth
------------------------------------------------------------------------- */
bigint AtomVecKokkos::roundup(bigint n)

View File

@ -29,9 +29,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
#define DELTA 16384
#define DELTA_BONUS 8192
/* ---------------------------------------------------------------------- */
AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
@ -188,6 +185,8 @@ void AtomVec::init()
error->all(FLERR,"KOKKOS package requires a kokkos enabled atom_style");
}
static constexpr bigint DELTA=16384;
/* ----------------------------------------------------------------------
roundup N so it is a multiple of DELTA
error if N exceeds 32-bit int, since will be used as arg to grow()
@ -211,6 +210,8 @@ void AtomVec::grow_nmax()
nmax += DELTA;
}
static constexpr bigint DELTA_BONUS=8192;
/* ----------------------------------------------------------------------
grow nmax_bonus so it is a multiple of DELTA_BONUS
------------------------------------------------------------------------- */