Skip to content

Commit

Permalink
fix pedantic gcc error
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWibking committed Jan 19, 2024
1 parent d484364 commit 6cc4e82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/CICParticles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
namespace quokka
{

constexpr int CICParticleReals = 4; // mass vx vy vz
constexpr int CICParticleInts = 0;

enum ParticleDataIdx { ParticleMassIdx = 0, ParticleVxIdx, ParticleVyIdx, ParticleVzIdx };
constexpr int CICParticleRealComps = 4; // mass vx vy vz

// TODO(bwibking): switch to using struct-of-arrays (SOA) particles
using CICParticleContainer = amrex::AmrParticleContainer<CICParticleReals, CICParticleInts>;
using CICParticleIterator = amrex::ParIter<CICParticleReals, CICParticleInts>;
using CICParticleContainer = amrex::AmrParticleContainer<CICParticleRealComps>;
using CICParticleIterator = amrex::ParIter<CICParticleRealComps>;

struct CICDeposition {
amrex::Real Gconst{};
Expand Down
8 changes: 3 additions & 5 deletions src/SphericalCollapse/spherical_collapse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ template <> void RadhydroSimulation<CollapseProblem>::createInitialParticles()
int num_particles = 1000;
double particle_mass = 0.5 / static_cast<double>(num_particles);

quokka::CICParticleContainer::ParticleInitData pdata = {{particle_mass}, {0}, {0}, {0}}; // mass vx vy vz
quokka::CICParticleContainer::ParticleInitData pdata = {{particle_mass, 0, 0, 0}, {}, {}, {}}; // {mass vx vy vz}, empty, empty, empty
CICParticles->InitRandom(num_particles, iseed, pdata, generate_on_root_rank);
}

Expand Down Expand Up @@ -122,11 +122,9 @@ template <> void RadhydroSimulation<CollapseProblem>::ComputeDerivedVar(int lev,
// compute derived variables and save in 'mf'
if (dname == "gpot") {
const int ncomp = ncomp_cc_in;
auto const &state = state_new_cc_[lev].const_arrays();
auto const &phi_data_ref = phi[lev].const_arrays();
auto const &phi_arr = phi[lev].const_arrays();
auto output = mf.arrays();

amrex::ParallelFor(mf, [=] AMREX_GPU_DEVICE(int bx, int i, int j, int k) noexcept { output[bx](i, j, k, ncomp) = phi_data_ref[bx](i, j, k); });
amrex::ParallelFor(mf, [=] AMREX_GPU_DEVICE(int bx, int i, int j, int k) noexcept { output[bx](i, j, k, ncomp) = phi_arr[bx](i, j, k); });
}
}

Expand Down

0 comments on commit 6cc4e82

Please sign in to comment.