24#ifndef SUPER_INTEGRAL_F_3D_HH
25#define SUPER_INTEGRAL_F_3D_HH
38template <
typename T,
typename W>
41 :
SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()+1),
43 _indicatorF(std::move(indicatorF))
45 this->
getName() =
"Sum("+_f->getName()+
")";
49 if ( _f->getBlockFSize() == load.
size() &&
50 _indicatorF->getBlockFSize() == load.
size() ) {
51 for (
int iC = 0; iC < load.
size(); ++iC) {
54 _indicatorF->getBlockIndicatorF(iC))
60template <
typename T,
typename W>
65 std::forward<decltype(f)>(f),
66 superGeometry.getMaterialIndicator(material))
69template <
typename T,
typename W>
76 for (
int i = 0; i < this->getTargetDim(); ++i) {
80 if (this->_blockF.empty()) {
81 W outputTmp[_f->getTargetDim()];
82 int inputTmp[_f->getSourceDim()];
83 std::size_t voxels(0);
85 for (
int iC = 0; iC < load.
size(); ++iC) {
87 inputTmp[0] = load.
glob(iC);
88 for (inputTmp[1] = 0; inputTmp[1] < cuboid.
getNx(); ++inputTmp[1]) {
89 for (inputTmp[2] = 0; inputTmp[2] < cuboid.
getNy(); ++inputTmp[2]) {
90 for (inputTmp[3] = 0; inputTmp[3] < cuboid.
getNz(); ++inputTmp[3]) {
91 if (_indicatorF(inputTmp)) {
92 _f(outputTmp,inputTmp);
93 for (
int i = 0; i < _f->getTargetDim(); ++i) {
94 output[i] += outputTmp[i];
102 output[_f->getTargetDim()] = voxels;
105 for (
int iC = 0; iC < load.
size(); ++iC) {
106 this->getBlockF(iC)(output, input);
110#ifdef PARALLEL_MODE_MPI
111 for (
int i = 0; i < this->getTargetDim(); ++i) {
112 singleton::mpi().reduceAndBcast(output[i], MPI_SUM);
119template <
typename T,
typename W>
122 :
SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()),
124 _indicatorF(std::move(indicatorF))
126 this->
getName() =
"Integral("+_f->getName()+
")";
130 if ( _f->getBlockFSize() == load.
size() &&
131 _indicatorF->getBlockFSize() == load.
size() ) {
132 for (
int iC = 0; iC < load.
size(); ++iC) {
135 _indicatorF->getBlockIndicatorF(iC))
141template <
typename T,
typename W>
146 std::forward<decltype(f)>(f),
147 superGeometry.getMaterialIndicator(material))
150template <
typename T,
typename W>
157 for (
int i = 0; i < this->getTargetDim(); ++i) {
161 if (this->_blockF.empty()) {
162 W outputTmp[_f->getTargetDim()];
163 int inputTmp[_f->getSourceDim()];
165 for (
int iC = 0; iC < load.
size(); ++iC) {
168 inputTmp[0] = load.
glob(iC);
169 for (inputTmp[1] = 0; inputTmp[1] < cuboid.
getNx(); ++inputTmp[1]) {
170 for (inputTmp[2] = 0; inputTmp[2] < cuboid.
getNy(); ++inputTmp[2]) {
171 for (inputTmp[3] = 0; inputTmp[3] < cuboid.
getNz(); ++inputTmp[3]) {
172 if (_indicatorF(inputTmp)) {
173 _f(outputTmp,inputTmp);
174 for (
int i = 0; i < this->getTargetDim(); ++i) {
175 output[i] += outputTmp[i] * weight;
184 for (
int iC = 0; iC < load.
size(); ++iC) {
185 this->getBlockF(iC)(output, input);
189#ifdef PARALLEL_MODE_MPI
190 for (
int i = 0; i < this->getTargetDim(); ++i) {
BlockIntegral3D integrates f on a indicated subset.
BlockSum3D sums all components of f over a indicated subset.
A regular single 3D cuboid is the basic component of a 3D cuboid structure which defines the grid.
T getDeltaR() const
Read only access to the distance of cuboid nodes.
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.
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)
SuperIntegral3D integrates f on a indicated subset.
bool operator()(W output[], const int input[]) override
SuperIntegral3D(FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
Constructor for integrating f on a indicated subset.
virtual void communicate()
SuperSum3D sums all components of f over a indicated subset.
SuperSum3D(FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
Constructor for summing f on a indicated subset.
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Top level namespace for all of OpenLB.