26#include <Kokkos_Core.hpp>
33#if defined(__GNUG__) or defined(__clang__)
34#define ESPRESSO_ATTR_ALWAYS_INLINE [[gnu::always_inline]]
36#define ESPRESSO_ATTR_ALWAYS_INLINE
70 void resize(std::size_t num_particles) {
75#ifdef ESPRESSO_ELECTROSTATICS
85#if defined(ESPRESSO_GAY_BERNE) or defined(ESPRESSO_DIPOLES)
88#ifdef ESPRESSO_DIPOLES
93 Kokkos::realloc(
position, num_particles);
94 Kokkos::realloc(
image, num_particles);
95#ifdef ESPRESSO_ELECTROSTATICS
96 Kokkos::realloc(
charge, num_particles);
98 Kokkos::realloc(
id, num_particles);
99 Kokkos::realloc(
type, num_particles);
101 Kokkos::realloc(
mass, num_particles);
103 Kokkos::realloc(
flags, num_particles);
104 Kokkos::realloc(
velocity, num_particles);
105#if defined(ESPRESSO_GAY_BERNE) or defined(ESPRESSO_DIPOLES)
106 Kokkos::realloc(
director, num_particles);
108#ifdef ESPRESSO_DIPOLES
109 Kokkos::realloc(
dipm, num_particles);
114 template <
typename array_layout,
typename T, std::
size_t N>
117 std::size_t i)
const {
118 return std::span<T, N>(
const_cast<T *
>(&view(i, 0)), N);
121 template <
typename array_layout,
typename T, std::
size_t N>
123 Kokkos::View<T *[N], array_layout, Kokkos::HostSpace>
const &view,
124 std::size_t i)
const {
126 auto const data = result.
data();
127#if (defined(__GNUC__) or defined(__GNUG__)) && !defined(__clang__)
132 for (std::size_t j = 0ul; j < N; j += 1ul) {
133 data[j] = view(i, j);
138 template <
typename array_layout,
typename T, std::
size_t N>
142#if (defined(__GNUC__) or defined(__GNUG__)) && !defined(__clang__)
147 for (std::size_t j = 0ul; j < N; j += 1ul) {
148 view(i, j) = value[j];
153 flags(i) = value ? uint8_t{1} : uint8_t{0};
DEVICE_QUALIFIER constexpr pointer data() noexcept
Kokkos::View< int *[3], Kokkos::LayoutRight, Kokkos::HostSpace > ImageViewType
Kokkos::View< double *, Kokkos::HostSpace > ChargeViewType
bool has_exclusion(std::size_t i) const
std::span< T, N > get_span_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > const &view, std::size_t i) const
Kokkos::View< uint8_t *, Kokkos::HostSpace > FlagsViewType
Kokkos::View< double *, Kokkos::HostSpace > DipmViewType
Kokkos::View< double *[3], Kokkos::LayoutRight, Kokkos::HostSpace > DirectorViewType
void set_vector_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > &view, std::size_t i, Utils::Vector< T, N > const &value)
PositionViewType position
AoSoA_pack(std::size_t num_particles)
Kokkos::View< int *, Kokkos::HostSpace > TypeViewType
Kokkos::View< double *[3], Kokkos::LayoutRight, Kokkos::HostSpace > PositionViewType
void set_has_exclusion(std::size_t i, bool value)
Utils::Vector< T, N > get_vector_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > const &view, std::size_t i) const
DirectorViewType director
Kokkos::View< double *, Kokkos::HostSpace > MassViewType
Kokkos::View< int *, Kokkos::HostSpace > IdViewType
VelocityViewType velocity
void resize(std::size_t num_particles)