OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::BlockSum2D< T, W > Class Template Reference

BlockSum2D sums all components of f over a indicated subset. More...

#include <blockIntegralF2D.h>

+ Inheritance diagram for olb::BlockSum2D< T, W >:
+ Collaboration diagram for olb::BlockSum2D< T, W >:

Public Member Functions

 BlockSum2D (BlockF2D< W > &f, BlockIndicatorF2D< T > &indicatorF)
 
bool operator() (W output[], const int input[]) override
 
- Public Member Functions inherited from olb::BlockF2D< T >
virtual BlockStructureD< 2 > & getBlockStructure ()
 virtual destructor for defined behaviour
 
void setBlockStructure (BlockStructureD< 2 > *blockStructure)
 
BlockF2D< T > & operator- (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator+ (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator* (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator/ (BlockF2D< T > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, int >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
virtual bool operator() (T output[], const int input[])=0
 has to be implemented for 'every' derived class
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], int input0)
 
bool operator() (T output[], int input0, int input1)
 
bool operator() (T output[], int input0, int input1, int input2)
 
bool operator() (T output[], int input0, int input1, int input2, int input3)
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< T, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< T, int >
std::shared_ptr< GenericF< T, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::BlockF2D< T >
 BlockF2D (BlockStructureD< 2 > &blockStructure, int targetDim)
 
 BlockF2D (int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< T, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::BlockF2D< T >
BlockStructureD< 2 > * _blockStructure
 

Detailed Description

template<typename T, typename W = T>
class olb::BlockSum2D< T, W >

BlockSum2D sums all components of f over a indicated subset.

Definition at line 35 of file blockIntegralF2D.h.

Constructor & Destructor Documentation

◆ BlockSum2D()

template<typename T , typename W >
olb::BlockSum2D< T, W >::BlockSum2D ( BlockF2D< W > & f,
BlockIndicatorF2D< T > & indicatorF )

Definition at line 35 of file blockIntegralF2D.hh.

37 : BlockF2D<W>(f.getBlockStructure(), f.getTargetDim()+1),
38 _f(f),
39 _indicatorF(indicatorF)
40{
41 this->getName() = "BlockSum("+_f.getName()+")";
42}
virtual BlockStructureD< 2 > & getBlockStructure()
virtual destructor for defined behaviour
int getTargetDim() const
read only access to member variable _n
Definition genericF.hh:45
std::string & getName()
read and write access to name
Definition genericF.hh:51

References olb::GenericF< T, S >::getName(), and olb::GenericF< T, int >::getName().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename W >
bool olb::BlockSum2D< T, W >::operator() ( W output[],
const int input[] )
override

Definition at line 45 of file blockIntegralF2D.hh.

46{
47 OLB_ASSERT(_f.getSourceDim() == _indicatorF.getSourceDim(),
48 "functor source dimension equals indicator source dimension");
49
50 W outputTmp[_f.getTargetDim()];
51 int inputTmp[_f.getSourceDim()];
52 std::size_t voxels(0);
53
54 const auto& blockStructure = this->getBlockStructure();
55
56 for (inputTmp[0] = 0; inputTmp[0] < blockStructure.getNx(); ++inputTmp[0]) {
57 for (inputTmp[1] = 0; inputTmp[1] < blockStructure.getNy(); ++inputTmp[1]) {
58 if (_indicatorF(inputTmp)) {
59 _f(outputTmp,inputTmp);
60 for (int i = 0; i < _f.getTargetDim(); ++i) {
61 output[i] += outputTmp[i];
62 }
63 voxels += 1;
64 }
65 }
66 }
67 output[_f.getTargetDim()] += voxels;
68
69 return true;
70}
int getSourceDim() const
read only access to member variable _m
Definition genericF.hh:39
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References OLB_ASSERT.

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: