10 const unsigned int mpcBoxSizeX,
11 const unsigned int mpcBoxSizeY,
12 const unsigned int mpcBoxSizeZ,
15 cellSubdivisionsX(1), cellSubdivisionsY(1), cellSubdivisionsZ(1)
24 if(settings.
has(
"cellSubdivision"))
26 settings.
read(
"cellSubdivision.x", &cellSubdivisionsX);
27 settings.
read(
"cellSubdivision.y", &cellSubdivisionsY);
28 settings.
read(
"cellSubdivision.z", &cellSubdivisionsZ);
31 if(cellSubdivisionsX == 0)
33 if(cellSubdivisionsY == 0)
35 if(cellSubdivisionsZ == 0)
38 const unsigned int sizeX = mpcBoxSizeX * cellSubdivisionsX;
39 const unsigned int sizeY = mpcBoxSizeY * cellSubdivisionsY;
40 const unsigned int sizeZ = mpcBoxSizeZ * cellSubdivisionsZ;
42 const std::vector<FP> zeroes(sizeZ, 0);
44 points.resize(sizeX, std::vector<std::vector<FP> >(sizeY, zeroes));
49 std::ofstream file(path.c_str(), std::ios::trunc);
50 file.precision(std::numeric_limits<FP>::digits10 + 2);
55 for(std::vector<std::vector<std::vector<FP> > >::size_type x=0; x<points.size(); ++x)
57 const std::vector<std::vector<FP> >& tmp1 = points[x];
58 for(std::vector<std::vector<FP> >::size_type y=0; y<tmp1.size(); ++y)
60 const std::vector<FP>& tmp2 = tmp1[y];
61 for(std::vector<FP>::size_type z=0; z<tmp2.size(); ++z)
63 const FP totalMass = tmp2[z];
64 file<<
FP(x)/cellSubdivisionsX<<
"\t"<<
FP(y)/cellSubdivisionsY<<
"\t"<<
FP(z)/cellSubdivisionsZ<<
"\t";
65 file<<totalMass / fillCount<<
"\n";