Fixes for SPH. Workaround for buggy gadget headers. Fixed borg generation for newer API.
This commit is contained in:
parent
bb94130bcd
commit
b639bcedaf
8 changed files with 55 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -123,10 +123,12 @@ int main(int argc, char **argv)
|
|||
|
||||
MyCell *allCells_1 = new MyCell[N1_points];
|
||||
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (long i = 0; i < Nres*Nres*Nres; i++)
|
||||
bins.data()[i] = 0;
|
||||
|
||||
cout << "Shuffling data in cells..." << endl;
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (int i = 0 ; i < N1_points; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
|
@ -144,6 +146,7 @@ int main(int argc, char **argv)
|
|||
if (rx < 0 || rx >= Nres || ry < 0 || ry >= Nres || rz < 0 || rz >= Nres)
|
||||
continue;
|
||||
|
||||
#pragma omp atomic update
|
||||
bins[rx][ry][rz]++;
|
||||
}
|
||||
v1_data.resize(boost::extents[1][1]);
|
||||
|
@ -168,7 +171,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
double pz = (rz)*boxsize/Nres-cz;
|
||||
|
||||
cout << rz << " / " << Nres << endl;
|
||||
(cout << rz << " / " << Nres << endl).flush();
|
||||
for (int ry = 0; ry < Nres; ry++)
|
||||
{
|
||||
double py = (ry)*boxsize/Nres-cy;
|
||||
|
@ -193,6 +196,7 @@ int main(int argc, char **argv)
|
|||
smooth1.addGridSite(c);
|
||||
}
|
||||
}
|
||||
(cout << " Done " << rz << endl).flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +208,7 @@ int main(int argc, char **argv)
|
|||
bins, interpolated, getMass, rLimit2);
|
||||
hdf5_write_array(out_f, "density", interpolated);
|
||||
//out_f.flush();
|
||||
for (int i = 0; i < 0; i++) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
computeInterpolatedField(&tree1, boxsize, Nres, cx, cy, cz,
|
||||
bins, interpolated, boost::bind(getVelocity, _1, i), rLimit2);
|
||||
hdf5_write_array(out_f, str(format("p%d") % i), interpolated);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue