6 #include <boost/static_assert.hpp>
7 #include <boost/type_traits/is_integral.hpp>
14 const unsigned int mpcBoxSizeX,
15 const unsigned int mpcBoxSizeY,
16 const unsigned int mpcBoxSizeZ,
18 : simulationBoxSizeX(mpcBoxSizeX),
19 simulationBoxSizeY(mpcBoxSizeY),
20 simulationBoxSizeZ(mpcBoxSizeZ),
21 cellSubdivisionsX(1), cellSubdivisionsY(1), cellSubdivisionsZ(1),
22 sweepCountPerOutput(0), currentBlockSweepCount(0)
31 if(settings.
has(
"cellSubdivision"))
33 settings.
read(
"cellSubdivision.x", &cellSubdivisionsX);
34 settings.
read(
"cellSubdivision.y", &cellSubdivisionsY);
35 settings.
read(
"cellSubdivision.z", &cellSubdivisionsZ);
38 if(settings.
has(
"sweepCountPerOutput"))
39 settings.
read(
"sweepCountPerOutput", &sweepCountPerOutput);
42 if(cellSubdivisionsX == 0)
44 if(cellSubdivisionsY == 0)
46 if(cellSubdivisionsZ == 0)
53 if(outputBlocks.empty())
60 ++currentBlockSweepCount;
62 if(sweepCountPerOutput == 0)
65 if(currentBlockSweepCount != sweepCountPerOutput)
71 currentBlockSweepCount = 0;
78 std::ofstream file(path.c_str(), std::ios::trunc);
79 file.precision(std::numeric_limits<FP>::digits10 + 2);
85 file <<
"meanVelX\tmeanVelY\tmeanVelZ\t";
86 file <<
"stdDevVelX\tstdDevVelY\tstdDevVelZ\t";
89 for(std::size_t i = 0; i < outputBlocks.size(); ++i)
92 printOutputBlockToStream(*(outputBlocks[i]), file);
99 typedef boost::multi_array<OnTheFlyStatistics<T>, 4> MA;
100 typedef boost::shared_ptr<MA> SPMA;
102 outputBlocks.push_back(
106 [simulationBoxSizeX * cellSubdivisionsX]
107 [simulationBoxSizeY * cellSubdivisionsY]
108 [simulationBoxSizeZ * cellSubdivisionsZ]
118 std::ostream& stream)
const
120 for(std::size_t x = 0; x < outputBlock.shape()[0]; ++x)
122 for(std::size_t y = 0; y < outputBlock.shape()[1]; ++y)
124 for(std::size_t z = 0; z < outputBlock.shape()[2]; ++z)
128 BOOST_STATIC_ASSERT(!boost::is_integral<T>::value);
130 stream << x / double(cellSubdivisionsX) <<
"\t";
131 stream << y / double(cellSubdivisionsY) <<
"\t";
132 stream << z / double(cellSubdivisionsZ) <<
"\t";
135 outputBlock[x][y][z][0].getSampleMean() <<
"\t";
137 outputBlock[x][y][z][1].getSampleMean() <<
"\t";
139 outputBlock[x][y][z][2].getSampleMean() <<
"\t";
142 outputBlock[x][y][z][0].
143 getSampleStandardDeviation() <<
"\t";
145 outputBlock[x][y][z][1].
146 getSampleStandardDeviation() <<
"\t";
148 outputBlock[x][y][z][2].
149 getSampleStandardDeviation() <<
"\t";
151 stream << outputBlock[x][y][z][0].getSampleSize() <<
"\n";
154 outputBlock[x][y][z][0].getSampleSize()
156 outputBlock[x][y][z][1].getSampleSize());
158 outputBlock[x][y][z][0].getSampleSize()
160 outputBlock[x][y][z][2].getSampleSize());