Added mass to 3d filter
This commit is contained in:
parent
15e824a097
commit
7df2cdbe7c
@ -64,12 +64,12 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
SimuData *p = loadGadgetMulti(fname, 0, 0);
|
SimuData *p = loadGadgetMulti(fname, 0, 0);
|
||||||
double L0 = p->BoxSize/1000;
|
double L0 = p->BoxSize/1000;
|
||||||
array_type parts(boost::extents[p->TotalNumPart][6]);
|
array_type parts(boost::extents[p->TotalNumPart][7]);
|
||||||
uint64_t q = 0;
|
uint64_t q = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (int cpuid=0;;cpuid++) {
|
for (int cpuid=0;;cpuid++) {
|
||||||
p = loadGadgetMulti(fname, cpuid, NEED_POSITION|NEED_VELOCITY);
|
p = loadGadgetMulti(fname, cpuid, NEED_POSITION|NEED_VELOCITY|NEED_MASS);
|
||||||
for (uint32_t i = 0; i < p->NumPart; i++)
|
for (uint32_t i = 0; i < p->NumPart; i++)
|
||||||
{
|
{
|
||||||
parts[q][0] = p->Pos[0][i]/1000;
|
parts[q][0] = p->Pos[0][i]/1000;
|
||||||
@ -83,6 +83,7 @@ int main(int argc, char **argv)
|
|||||||
parts[q][3] = p->Vel[0][i];
|
parts[q][3] = p->Vel[0][i];
|
||||||
parts[q][4] = p->Vel[1][i];
|
parts[q][4] = p->Vel[1][i];
|
||||||
parts[q][5] = p->Vel[2][i];
|
parts[q][5] = p->Vel[2][i];
|
||||||
|
parts[q][6] = p->Mass[i];
|
||||||
q++;
|
q++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ using namespace CosmoTool;
|
|||||||
|
|
||||||
struct VCoord{
|
struct VCoord{
|
||||||
float v[3];
|
float v[3];
|
||||||
|
float mass;
|
||||||
};
|
};
|
||||||
|
|
||||||
using boost::format;
|
using boost::format;
|
||||||
@ -27,12 +28,12 @@ typedef boost::multi_array<float, 4> array4_type;
|
|||||||
|
|
||||||
ComputePrecision getVelocity(const VCoord& v, int i)
|
ComputePrecision getVelocity(const VCoord& v, int i)
|
||||||
{
|
{
|
||||||
return v.v[i];
|
return v.mass * v.v[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputePrecision getUnity(const VCoord& v)
|
ComputePrecision getMass(const VCoord& v)
|
||||||
{
|
{
|
||||||
return 1.0;
|
return v.mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef SPHSmooth<VCoord> MySmooth;
|
typedef SPHSmooth<VCoord> MySmooth;
|
||||||
@ -198,7 +199,7 @@ int main(int argc, char **argv)
|
|||||||
array3_type interpolated(boost::extents[Nres][Nres][Nres]);
|
array3_type interpolated(boost::extents[Nres][Nres][Nres]);
|
||||||
|
|
||||||
computeInterpolatedField(&tree1, boxsize, Nres, cx, cy, cz,
|
computeInterpolatedField(&tree1, boxsize, Nres, cx, cy, cz,
|
||||||
bins, interpolated, getUnity, rLimit2);
|
bins, interpolated, getMass, rLimit2);
|
||||||
hdf5_write_array(out_f, "density", interpolated);
|
hdf5_write_array(out_f, "density", interpolated);
|
||||||
//out_f.flush();
|
//out_f.flush();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user