1
0
Fork 0
mirror of https://github.com/cosmo-sims/monofonIC.git synced 2024-09-19 17:03:45 +02:00

add missing HACC/GenericIO fields

This commit is contained in:
Michael Buehlmann 2022-04-28 13:13:51 -05:00
parent 762bef3aa2
commit fbf6690458

View file

@ -16,6 +16,7 @@ protected:
std::vector<float> vx, vy, vz;
std::vector<float> mass, hh, uu;
std::vector<float> mu, phi, rho;
std::vector<float> zmet, yhe;
std::vector<uint16_t> mask;
public:
@ -85,6 +86,10 @@ public:
vy.reserve(vy.size() + npart);
vz.reserve(vz.size() + npart);
ids.reserve(ids.size() + npart);
mask.reserve(mask.size() + npart);
// phi doesn't need to be initialized, just needs to be present in data
phi.resize(phi.size() + npart, 0.0f);
auto _pos = reinterpret_cast<const float*>(pc.get_pos32_ptr());
auto _vel = reinterpret_cast<const float*>(pc.get_vel32_ptr());
@ -98,10 +103,9 @@ public:
vx.push_back(_vel[3*i + 0]);
vy.push_back(_vel[3*i + 1]);
vz.push_back(_vel[3*i + 2]);
mask.push_back(s == cosmo_species::baryon ? 1<<2 : 0);
}
// phi doesn't need to be initialized, just needs to be present in data
phi.resize(phi.size() + npart);
std::copy(_ids, _ids+npart, std::back_inserter(ids));
if(hacc_hydro_) {
@ -115,20 +119,12 @@ public:
std::fill(mass.begin() + prev_size, mass.end(), particle_mass);
}
mask.resize(new_size);
std::fill(mask.begin() + prev_size, mask.end(), s == cosmo_species::baryon ? 1<<2 : 0);
hh.resize(new_size);
std::fill(hh.begin() + prev_size, hh.end(), hh_value_);
uu.resize(new_size);
std::fill(uu.begin() + prev_size, uu.end(), s == cosmo_species::baryon ? uu_value_ : 0.0f);
rho.resize(new_size);
std::fill(rho.begin() + prev_size, rho.end(), rho_value_);
mu.resize(new_size);
std::fill(mu.begin() + prev_size, mu.end(), s == cosmo_species::baryon ? mu_value_ : 0.0f);
hh.resize(new_size, hh_value_);
uu.resize(new_size, s == cosmo_species::baryon ? uu_value_ : 0.0f);
rho.resize(new_size, rho_value_);
mu.resize(new_size, s == cosmo_species::baryon ? mu_value_ : 0.0f);
zmet.resize(new_size, 0.0f);
yhe.resize(new_size, 0.0f);
}
}
@ -145,13 +141,15 @@ public:
writer.addVariable("vz", vz);
writer.addVariable("id", ids);
writer.addVariable("phi", phi);
writer.addVariable("mask", mask);
if(hacc_hydro_) {
writer.addVariable("mass", mass);
writer.addVariable("mask", mask);
writer.addVariable("hh", hh);
writer.addVariable("uu", uu);
writer.addVariable("rho", rho);
writer.addVariable("mu", mu);
writer.addVariable("zmet", zmet);
writer.addVariable("yhe", yhe);
}
writer.write();
MPI_Barrier(MPI_COMM_WORLD);