Fixes for SPH. Workaround for buggy gadget headers. Fixed borg generation for newer API.

This commit is contained in:
Guilhem Lavaux 2015-06-03 10:31:09 +02:00
parent bb94130bcd
commit b639bcedaf
8 changed files with 55 additions and 11 deletions

View file

@ -66,12 +66,15 @@ int main(int argc, char **argv)
SimuData *p = loadGadgetMulti(fname, 0, 0);
double L0 = p->BoxSize/MPC;
cout << "Will read " << p->TotalNumPart << " particles" << endl;
array_type parts(boost::extents[p->TotalNumPart][7]);
uint64_t q = 0;
try {
for (int cpuid=0;;cpuid++) {
cout << " = CPU " << cpuid << " = " << endl;
p = loadGadgetMulti(fname, cpuid, NEED_POSITION|NEED_VELOCITY|NEED_MASS);
cout << " = DONE LOAD, COPYING IN PLACE" << endl;
for (uint32_t i = 0; i < p->NumPart; i++)
{
for (int j = 0; j < 3; j++)
@ -87,11 +90,13 @@ int main(int argc, char **argv)
parts[q][6] = p->Mass[i];
q++;
}
cout << " = DONE (q=" << q << ")" << endl;
delete p;
}
} catch (const NoSuchFileException& e) {}
cout << " ++ WRITING ++" << endl;
hdf5_write_array(f, "particles", parts);
return 0;