OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
olb::BlockLpNorm2D< T, W, P > Class Template Referencefinal

Block level functor that returns the Lp norm over omega of the euklid norm of the input block functor. More...

#include <blockLpNorm2D.h>

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

Public Member Functions

 BlockLpNorm2D (BlockF2D< W > &f, BlockIndicatorF2D< T > &indicatorF)
 
bool operator() (W output[], const int input[]) override
 
- Public Member Functions inherited from olb::BlockF2D< W >
virtual BlockStructureD< 2 > & getBlockStructure ()
 virtual destructor for defined behaviour
 
void setBlockStructure (BlockStructureD< 2 > *blockStructure)
 
BlockF2D< W > & operator- (BlockF2D< W > &rhs)
 
BlockF2D< W > & operator+ (BlockF2D< W > &rhs)
 
BlockF2D< W > & operator* (BlockF2D< W > &rhs)
 
BlockF2D< W > & operator/ (BlockF2D< W > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, S >
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 S 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[], S input0)
 
bool operator() (T output[], S input0, S input1)
 
bool operator() (T output[], S input0, S input1, S input2)
 
bool operator() (T output[], S input0, S input1, S input2, S input3)
 

Protected Attributes

BlockF2D< W > & _f
 
BlockIndicatorF2D< T > & _indicatorF
 
- Protected Attributes inherited from olb::BlockF2D< W >
BlockStructureD< 2 > * _blockStructure
 

Additional Inherited Members

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

Detailed Description

template<typename T, typename W, int P>
class olb::BlockLpNorm2D< T, W, P >

Block level functor that returns the Lp norm over omega of the euklid norm of the input block functor.

Instances are contained in SuperLpNorm2D::_blockF.

Definition at line 38 of file blockLpNorm2D.h.

Constructor & Destructor Documentation

◆ BlockLpNorm2D()

template<typename T , typename W , int P>
olb::BlockLpNorm2D< T, W, P >::BlockLpNorm2D ( BlockF2D< W > & f,
BlockIndicatorF2D< T > & indicatorF )
Parameters
fdata functor
indicatorFindicator functor describing the subset to be integrated

Definition at line 35 of file blockLpNorm2D.hh.

37 : BlockF2D<W>(f.getBlockStructure(), f.getTargetDim()),
38 _f(f),
39 _indicatorF(indicatorF)
40{
41 OLB_ASSERT(_f.getSourceDim() == _indicatorF.getSourceDim(),
42 "functor source dimension equals indicator source dimension");
43
44 this->getName() = "BlockL" + std::to_string(P) + "Norm(" + _f.getName() + ")";
45}
virtual BlockStructureD< 2 > & getBlockStructure()
virtual destructor for defined behaviour
BlockIndicatorF2D< T > & _indicatorF
BlockF2D< W > & _f
int getTargetDim() const
read only access to member variable _n
Definition genericF.hh:45
int getSourceDim() const
read only access to member variable _m
Definition genericF.hh:39
std::string & getName()
read and write access to name
Definition genericF.hh:51
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References olb::BlockLpNorm2D< T, W, P >::_f, olb::BlockLpNorm2D< T, W, P >::_indicatorF, olb::GenericF< T, S >::getName(), olb::GenericF< T, S >::getSourceDim(), and OLB_ASSERT.

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

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

Definition at line 48 of file blockLpNorm2D.hh.

49{
50 const auto& blockGeometry = _indicatorF.getBlockGeometry();
51 const int nX = blockGeometry.getNx();
52 const int nY = blockGeometry.getNy();
53 const T weight = util::pow(blockGeometry.getDeltaR(), 2);
54
55 output[0] = W(0);
56 W outputTmp[_f.getTargetDim()];
57 int inputTmp[_f.getSourceDim()];
58
59 for (inputTmp[0] = 0; inputTmp[0] < nX; ++inputTmp[0]) {
60 for (inputTmp[1] = 0; inputTmp[1] < nY; ++inputTmp[1]) {
61 if (_indicatorF(inputTmp)) {
62 _f(outputTmp, inputTmp);
63 for (int iDim = 0; iDim < _f.getTargetDim(); ++iDim) {
64 output[0] = LpNormImpl<T,W,P>()(output[0], outputTmp[iDim], weight);
65 }
66 }
67 }
68 }
69
70 output[0] = LpNormImpl<T,W,P>().enclose(output[0]);
71
72 return true;
73}
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::LpNormImpl< T, W, P >::enclose(), and olb::util::pow().

+ Here is the call graph for this function:

Member Data Documentation

◆ _f

template<typename T , typename W , int P>
BlockF2D<W>& olb::BlockLpNorm2D< T, W, P >::_f
protected

Definition at line 40 of file blockLpNorm2D.h.

◆ _indicatorF

template<typename T , typename W , int P>
BlockIndicatorF2D<T>& olb::BlockLpNorm2D< T, W, P >::_indicatorF
protected

Definition at line 41 of file blockLpNorm2D.h.


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