28#include <Kokkos_Core.hpp>
38 Kokkos::View<double *[3], Kokkos::LayoutRight, Kokkos::HostSpace>;
40 Kokkos::View<double *[3], Kokkos::LayoutRight, Kokkos::HostSpace>;
42 Kokkos::View<double *[3], Kokkos::LayoutRight, Kokkos::HostSpace>;
44 Kokkos::View<int *[3], Kokkos::LayoutRight, Kokkos::HostSpace>;
47 using IdViewType = Kokkos::View<int *, Kokkos::HostSpace>;
68 void resize(std::size_t num_particles) {
73#ifdef ESPRESSO_ELECTROSTATICS
83#if defined(ESPRESSO_GAY_BERNE) or defined(ESPRESSO_DIPOLES)
86#ifdef ESPRESSO_DIPOLES
91 Kokkos::realloc(
position, num_particles);
92 Kokkos::realloc(
image, num_particles);
93#ifdef ESPRESSO_ELECTROSTATICS
94 Kokkos::realloc(
charge, num_particles);
96 Kokkos::realloc(
id, num_particles);
97 Kokkos::realloc(
type, num_particles);
99 Kokkos::realloc(
mass, num_particles);
101 Kokkos::realloc(
flags, num_particles);
102 Kokkos::realloc(
velocity, num_particles);
103#if defined(ESPRESSO_GAY_BERNE) or defined(ESPRESSO_DIPOLES)
104 Kokkos::realloc(
director, num_particles);
106#ifdef ESPRESSO_DIPOLES
107 Kokkos::realloc(
dipm, num_particles);
112 template <
typename array_layout,
typename T, std::
size_t N>
114 get_span_at(Kokkos::View<T *[N], array_layout, Kokkos::HostSpace>
const &view,
115 std::size_t i)
const {
116 return std::span<T, N>(
const_cast<T *
>(&view(i, 0)), N);
119 template <
typename array_layout,
typename T, std::
size_t N>
121 Kokkos::View<T *[N], array_layout, Kokkos::HostSpace>
const &view,
122 std::size_t i)
const {
124 auto const data = result.
data();
125#if !defined(__NVCOMPILER) && !defined(__CUDACC__)
126#if defined(__clang__)
128#elif defined(__GNUC__) or defined(__GNUG__)
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(__NVCOMPILER) && !defined(__CUDACC__)
143#if defined(__clang__)
145#elif defined(__GNUC__) or defined(__GNUG__)
149 for (std::size_t j = 0ul; j < N; j += 1ul) {
150 view(i, j) = value[j];
186 flags(i) = value ? uint8_t{1} : uint8_t{0};
190 return flags(i) == uint8_t{1};
DEVICE_QUALIFIER constexpr pointer data() noexcept
#define HOST_ONLY_QUALIFIER
void reset_any_exclusion()
DEVICE_QUALIFIER void set_has_exclusion(std::size_t i, bool value)
Kokkos::View< int *[3], Kokkos::LayoutRight, Kokkos::HostSpace > ImageViewType
Kokkos::View< double *, Kokkos::HostSpace > ChargeViewType
DEVICE_QUALIFIER std::span< T, N > get_span_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > const &view, std::size_t i) const
std::atomic< bool > any_exclusion
Kokkos::View< uint8_t *, Kokkos::HostSpace > FlagsViewType
Kokkos::View< double *, Kokkos::HostSpace > DipmViewType
Kokkos::View< double *[3], Kokkos::LayoutRight, Kokkos::HostSpace > DirectorViewType
DEVICE_QUALIFIER bool has_exclusion(std::size_t i) const
PositionViewType position
AoSoA_pack(std::size_t num_particles)
DEVICE_QUALIFIER void set_vector_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > &view, std::size_t i, Utils::Vector< T, N > const &value)
Kokkos::View< int *, Kokkos::HostSpace > TypeViewType
Kokkos::View< double *[3], Kokkos::LayoutRight, Kokkos::HostSpace > PositionViewType
DEVICE_QUALIFIER Utils::Vector< T, N > get_vector_at(Kokkos::View< T *[N], array_layout, Kokkos::HostSpace > const &view, std::size_t i) const
void mark_any_exclusion()
DirectorViewType director
Kokkos::View< double *[3], Kokkos::LayoutRight, Kokkos::HostSpace > VelocityViewType
HOST_ONLY_QUALIFIER void resize(std::size_t num_particles)
bool has_any_exclusion() const
Kokkos::View< double *, Kokkos::HostSpace > MassViewType
Kokkos::View< int *, Kokkos::HostSpace > IdViewType
VelocityViewType velocity