Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/archetypes/energy_dist.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ namespace arch {
real_t g_max,
real_t pl_ind)
: EnergyDistribution<S, M> { metric }
, pool { pool }
, g_min { g_min }
, g_max { g_max }
, pl_ind { pl_ind } {}
, pl_ind { pl_ind }
, pool { pool } {}

Inline void operator()(const coord_t<M::Dim>& x_Code,
vec_t<Dim::_3D>& v,
unsigned short sp = 0) const override {
unsigned short = 0) const override {
auto rand_gen = pool.get_state();
auto rand_X1 = Random<real_t>(rand_gen);
auto rand_gam = ONE;
Expand Down Expand Up @@ -225,7 +225,7 @@ namespace arch {

Inline void operator()(const coord_t<M::Dim>& x_Code,
vec_t<Dim::_3D>& v,
unsigned short s = 0) const override {
unsigned short sp = 0) const override {
if (cmp::AlmostZero(temperature)) {
v[0] = ZERO;
v[1] = ZERO;
Expand All @@ -245,7 +245,7 @@ namespace arch {
// boost only when using cartesian coordinates
if (not cmp::AlmostZero(boost_velocity)) {
boost(v);
if (not zero_current and s % 2 == 0) {
if (not zero_current and sp % 2 == 0) {
v[0] = -v[0];
v[1] = -v[1];
v[2] = -v[2];
Expand Down
6 changes: 3 additions & 3 deletions src/archetypes/particle_injector.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ namespace arch {
auto ppc0 = params.template get<real_t>("particles.ppc0");
array_t<real_t*> ni { "ni", M::Dim };
auto ni_h = Kokkos::create_mirror_view(ni);
std::size_t ncells = 1;
ncells_t ncells = 1;
for (auto d = 0; d < M::Dim; ++d) {
ni_h(d) = domain.mesh.n_active()[d];
ncells *= domain.mesh.n_active()[d];
}
Kokkos::deep_copy(ni, ni_h);
const auto nparticles = static_cast<std::size_t>(
const auto nparticles = static_cast<npart_t>(
(long double)(ppc0 * number_density * 0.5) * (long double)(ncells));

Kokkos::parallel_for(
Expand Down Expand Up @@ -320,7 +320,7 @@ namespace arch {
incl_ghosts.push_back({ false, false });
}
const auto extent = domain.mesh.ExtentToRange(box, incl_ghosts);
tuple_t<std::size_t, M::Dim> x_min { 0 }, x_max { 0 };
tuple_t<ncells_t, M::Dim> x_min { 0 }, x_max { 0 };
for (auto d = 0; d < M::Dim; ++d) {
x_min[d] = extent[d].first;
x_max[d] = extent[d].second;
Expand Down
12 changes: 6 additions & 6 deletions src/archetypes/spatial_dist.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ namespace arch {
metric.template convert<Crd::Ph, Crd::Cd>(x_Ph, x_Cd);
real_t dens { ZERO };
if constexpr (M::Dim == Dim::_1D) {
dens = density(static_cast<std::size_t>(x_Cd[0]) + N_GHOSTS, idx);
dens = density(static_cast<ncells_t>(x_Cd[0]) + N_GHOSTS, idx);
} else if constexpr (M::Dim == Dim::_2D) {
dens = density(static_cast<std::size_t>(x_Cd[0]) + N_GHOSTS,
static_cast<std::size_t>(x_Cd[1]) + N_GHOSTS,
dens = density(static_cast<ncells_t>(x_Cd[0]) + N_GHOSTS,
static_cast<ncells_t>(x_Cd[1]) + N_GHOSTS,
idx);
} else if constexpr (M::Dim == Dim::_3D) {
dens = density(static_cast<std::size_t>(x_Cd[0]) + N_GHOSTS,
static_cast<std::size_t>(x_Cd[1]) + N_GHOSTS,
static_cast<std::size_t>(x_Cd[2]) + N_GHOSTS,
dens = density(static_cast<ncells_t>(x_Cd[0]) + N_GHOSTS,
static_cast<ncells_t>(x_Cd[1]) + N_GHOSTS,
static_cast<ncells_t>(x_Cd[2]) + N_GHOSTS,
idx);
} else {
raise::KernelError(HERE, "Invalid dimension");
Expand Down
50 changes: 24 additions & 26 deletions src/checkpoint/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ namespace checkpoint {
}
}

auto ReadParticleCount(
adios2::IO& io,
adios2::Engine& reader,
unsigned short s,
std::size_t local_dom,
std::size_t ndomains) -> std::pair<std::size_t, std::size_t> {
auto ReadParticleCount(adios2::IO& io,
adios2::Engine& reader,
unsigned short s,
std::size_t local_dom,
std::size_t ndomains) -> std::pair<npart_t, npart_t> {
logger::Checkpoint(fmt::format("Reading particle count for: %d", s + 1), HERE);
auto npart_var = io.InquireVariable<std::size_t>(
fmt::format("s%d_npart", s + 1));
auto npart_var = io.InquireVariable<npart_t>(fmt::format("s%d_npart", s + 1));
if (npart_var) {
raise::ErrorIf(npart_var.Shape()[0] != ndomains,
"npart_var.Shape()[0] != ndomains",
Expand All @@ -57,21 +55,21 @@ namespace checkpoint {
"npart_var.Shape().size() != 1",
HERE);
npart_var.SetSelection(adios2::Box<adios2::Dims>({ local_dom }, { 1 }));
std::size_t npart;
npart_t npart;
reader.Get(npart_var, &npart, adios2::Mode::Sync);
const auto loc_npart = npart;
#if !defined(MPI_ENABLED)
std::size_t offset_npart = 0;
npart_t offset_npart = 0;
#else
std::vector<std::size_t> glob_nparts(ndomains);
std::vector<npart_t> glob_nparts(ndomains);
MPI_Allgather(&loc_npart,
1,
mpi::get_type<std::size_t>(),
mpi::get_type<npart_t>(),
glob_nparts.data(),
1,
mpi::get_type<std::size_t>(),
mpi::get_type<npart_t>(),
MPI_COMM_WORLD);
std::size_t offset_npart = 0;
npart_t offset_npart = 0;
for (auto d { 0u }; d < local_dom; ++d) {
offset_npart += glob_nparts[d];
}
Expand All @@ -89,8 +87,8 @@ namespace checkpoint {
const std::string& quantity,
unsigned short s,
array_t<T*>& array,
std::size_t count,
std::size_t offset) {
npart_t count,
npart_t offset) {
logger::Checkpoint(
fmt::format("Reading quantity: s%d_%s", s + 1, quantity.c_str()),
HERE);
Expand All @@ -115,8 +113,8 @@ namespace checkpoint {
unsigned short s,
array_t<real_t**>& array,
std::size_t nplds,
std::size_t count,
std::size_t offset) {
npart_t count,
npart_t offset) {
logger::Checkpoint(fmt::format("Reading quantity: s%d_plds", s + 1), HERE);
auto var = io.InquireVariable<real_t>(fmt::format("s%d_plds", s + 1));
if (var) {
Expand Down Expand Up @@ -168,28 +166,28 @@ namespace checkpoint {
const std::string&,
unsigned short,
array_t<int*>&,
std::size_t,
std::size_t);
npart_t,
npart_t);
template void ReadParticleData<float>(adios2::IO&,
adios2::Engine&,
const std::string&,
unsigned short,
array_t<float*>&,
std::size_t,
std::size_t);
npart_t,
npart_t);
template void ReadParticleData<double>(adios2::IO&,
adios2::Engine&,
const std::string&,
unsigned short,
array_t<double*>&,
std::size_t,
std::size_t);
npart_t,
npart_t);
template void ReadParticleData<short>(adios2::IO&,
adios2::Engine&,
const std::string&,
unsigned short,
array_t<short*>&,
std::size_t,
std::size_t);
npart_t,
npart_t);

} // namespace checkpoint
12 changes: 6 additions & 6 deletions src/checkpoint/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @implements
* - checkpoint::ReadFields -> void
* - checkpoint::ReadParticleData -> void
* - checkpoint::ReadParticleCount -> std::pair<std::size_t, std::size_t>
* - checkpoint::ReadParticleCount -> std::pair<npart_t, npart_t>
* @cpp:
* - reader.cpp
* @namespaces:
Expand Down Expand Up @@ -34,24 +34,24 @@ namespace checkpoint {
adios2::Engine&,
unsigned short,
std::size_t,
std::size_t) -> std::pair<std::size_t, std::size_t>;
std::size_t) -> std::pair<npart_t, npart_t>;

template <typename T>
void ReadParticleData(adios2::IO&,
adios2::Engine&,
const std::string&,
unsigned short,
array_t<T*>&,
std::size_t,
std::size_t);
npart_t,
npart_t);

void ReadParticlePayloads(adios2::IO&,
adios2::Engine&,
unsigned short,
array_t<real_t**>&,
std::size_t,
std::size_t,
std::size_t);
npart_t,
npart_t);

} // namespace checkpoint

Expand Down
Loading