mirror of
https://github.com/cosmo-sims/monofonIC.git
synced 2024-09-20 18:13:44 +02:00
Merged in master (pull request #26)
add missing HACC/GenericIO fields Approved-by: Oliver Hahn
This commit is contained in:
commit
b7f12faa89
1 changed files with 18 additions and 20 deletions
|
@ -16,6 +16,7 @@ protected:
|
||||||
std::vector<float> vx, vy, vz;
|
std::vector<float> vx, vy, vz;
|
||||||
std::vector<float> mass, hh, uu;
|
std::vector<float> mass, hh, uu;
|
||||||
std::vector<float> mu, phi, rho;
|
std::vector<float> mu, phi, rho;
|
||||||
|
std::vector<float> zmet, yhe;
|
||||||
std::vector<uint16_t> mask;
|
std::vector<uint16_t> mask;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -85,6 +86,10 @@ public:
|
||||||
vy.reserve(vy.size() + npart);
|
vy.reserve(vy.size() + npart);
|
||||||
vz.reserve(vz.size() + npart);
|
vz.reserve(vz.size() + npart);
|
||||||
ids.reserve(ids.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 _pos = reinterpret_cast<const float*>(pc.get_pos32_ptr());
|
||||||
auto _vel = reinterpret_cast<const float*>(pc.get_vel32_ptr());
|
auto _vel = reinterpret_cast<const float*>(pc.get_vel32_ptr());
|
||||||
|
@ -98,10 +103,9 @@ public:
|
||||||
vx.push_back(_vel[3*i + 0]);
|
vx.push_back(_vel[3*i + 0]);
|
||||||
vy.push_back(_vel[3*i + 1]);
|
vy.push_back(_vel[3*i + 1]);
|
||||||
vz.push_back(_vel[3*i + 2]);
|
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));
|
std::copy(_ids, _ids+npart, std::back_inserter(ids));
|
||||||
|
|
||||||
if(hacc_hydro_) {
|
if(hacc_hydro_) {
|
||||||
|
@ -115,20 +119,12 @@ public:
|
||||||
std::fill(mass.begin() + prev_size, mass.end(), particle_mass);
|
std::fill(mass.begin() + prev_size, mass.end(), particle_mass);
|
||||||
}
|
}
|
||||||
|
|
||||||
mask.resize(new_size);
|
hh.resize(new_size, hh_value_);
|
||||||
std::fill(mask.begin() + prev_size, mask.end(), s == cosmo_species::baryon ? 1<<2 : 0);
|
uu.resize(new_size, s == cosmo_species::baryon ? uu_value_ : 0.0f);
|
||||||
|
rho.resize(new_size, rho_value_);
|
||||||
hh.resize(new_size);
|
mu.resize(new_size, s == cosmo_species::baryon ? mu_value_ : 0.0f);
|
||||||
std::fill(hh.begin() + prev_size, hh.end(), hh_value_);
|
zmet.resize(new_size, 0.0f);
|
||||||
|
yhe.resize(new_size, 0.0f);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,13 +141,15 @@ public:
|
||||||
writer.addVariable("vz", vz);
|
writer.addVariable("vz", vz);
|
||||||
writer.addVariable("id", ids);
|
writer.addVariable("id", ids);
|
||||||
writer.addVariable("phi", phi);
|
writer.addVariable("phi", phi);
|
||||||
|
writer.addVariable("mask", mask);
|
||||||
if(hacc_hydro_) {
|
if(hacc_hydro_) {
|
||||||
writer.addVariable("mass", mass);
|
writer.addVariable("mass", mass);
|
||||||
writer.addVariable("mask", mask);
|
|
||||||
writer.addVariable("hh", hh);
|
writer.addVariable("hh", hh);
|
||||||
writer.addVariable("uu", uu);
|
writer.addVariable("uu", uu);
|
||||||
writer.addVariable("rho", rho);
|
writer.addVariable("rho", rho);
|
||||||
writer.addVariable("mu", mu);
|
writer.addVariable("mu", mu);
|
||||||
|
writer.addVariable("zmet", zmet);
|
||||||
|
writer.addVariable("yhe", yhe);
|
||||||
}
|
}
|
||||||
writer.write();
|
writer.write();
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
|
Loading…
Reference in a new issue