24#ifndef BLOCK_STDDEVIATION_F3D_HH
25#define BLOCK_STDDEVIATION_F3D_HH
32template <
typename T,
typename W>
34 BlockIndicatorF3D<T>& indicatorF,
37 : BlockAverage3D<T,W>(f, indicatorF),
39 _indicatorF(indicatorF),
41 _expectedValue(expectedValue)
43 this->getName() =
"BlockStdDeviation("+_f.getName()+
")";
46template <
typename T,
typename W>
47bool BlockStdDeviationF3D<T,W>::operator() (W output[],
const int input[])
49 OLB_ASSERT(_f.getSourceDim() == _indicatorF.getSourceDim(),
50 "functor source dimension equals indicator source dimension");
52 std::size_t voxels(0);
54 W outputTmp[_f.getTargetDim()];
56 int inputTmp[_f.getSourceDim()];
58 for (
int i = 0; i < this->getTargetDim(); ++i) {
63 for (inputTmp[0] = 0; inputTmp[0] < _cuboid.getNx(); ++inputTmp[0]) {
64 for (inputTmp[1] = 0; inputTmp[1] < _cuboid.getNy(); ++inputTmp[1]) {
65 for (inputTmp[2] = 0; inputTmp[2] < _cuboid.getNz(); ++inputTmp[2]) {
66 if (_indicatorF(inputTmp)) {
67 _f(outputTmp,inputTmp);
68 for (
int i = 0; i < _f.getTargetDim(); ++i) {
69 output[i] += util::pow((outputTmp[i] - _expectedValue), 2);
79 output[_f.getTargetDim()] += voxels;
BlockStdDeviationF3D(BlockF3D< W > &f, BlockIndicatorF3D< T > &indicatorF, Cuboid3D< T > &cuboid, T expectedValue)
Top level namespace for all of OpenLB.
#define OLB_ASSERT(COND, MESSAGE)