24#ifndef SUPER_AVERAGE_3D_HH
25#define SUPER_AVERAGE_3D_HH
33template <
typename T,
typename W>
36 :
SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()+1),
38 _indicatorF(std::move(indicatorF))
40 this->
getName() =
"Average("+_f->getName()+
")";
44 if ( _f->getBlockFSize() == load.
size() &&
45 _indicatorF->getBlockFSize() == load.
size() ) {
46 for (
int iC = 0; iC < load.
size(); ++iC) {
49 _indicatorF->getBlockIndicatorF(iC))
55template <
typename T,
typename W>
60 std::forward<decltype(f)>(f),
61 superGeometry.getMaterialIndicator(material))
64template <
typename T,
typename W>
71 for (
int i = 0; i < _f->getTargetDim(); ++i) {
75 W outputTmp[_f->getTargetDim()];
76 int inputTmp[_f->getSourceDim()];
77 std::size_t voxels(0);
79 for (
int iC = 0; iC < load.
size(); ++iC) {
81 inputTmp[0] = load.
glob(iC);
82 for (inputTmp[1] = 0; inputTmp[1] < cuboid.
getNx(); ++inputTmp[1]) {
83 for (inputTmp[2] = 0; inputTmp[2] < cuboid.
getNy(); ++inputTmp[2]) {
84 for (inputTmp[3] = 0; inputTmp[3] < cuboid.
getNz(); ++inputTmp[3]) {
85 if (_indicatorF(inputTmp)) {
86 _f(outputTmp,inputTmp);
87 for (
int i = 0; i < _f->getTargetDim(); ++i) {
88 output[i] += outputTmp[i];
97#ifdef PARALLEL_MODE_MPI
98 for (
int i = 0; i < _f->getTargetDim(); ++i) {
104 output[_f->getTargetDim()] = voxels;
105 for (
int i = 0; i < _f->getTargetDim(); ++i) {
106 output[i] /= output[_f->getTargetDim()];
BlockAverage3D returns the average in each component of f on a indicated subset.
A regular single 3D cuboid is the basic component of a 3D cuboid structure which defines the grid.
int getNz() const
Read access to cuboid depth.
int getNy() const
Read access to cuboid height.
int getNx() const
Read access to cuboid width.
A cuboid geometry represents a voxel mesh.
Cuboid3D< T > & get(int iC)
Read and write access to a single cuboid.
Smart pointer for managing the various ways of passing functors around.
std::string & getName()
read and write access to name
Base class for all LoadBalancer.
SuperAverage3D returns the average in each component of f on a indicated subset.
bool operator()(W output[], const int input[]) override
Global average operator.
SuperAverage3D(FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
Constructor for determining the average of f on a indicated subset.
represents all functors that operate on a SuperStructure<T,3> in general
SuperStructure< T, 3 > & getSuperStructure()
std::vector< std::unique_ptr< BlockF3D< W > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
Base indicator functor (discrete)
virtual void communicate()
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
Top level namespace for all of OpenLB.