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

Block level arithmetic operations for BlockF2D functors. More...

#include <blockCalcF2D.h>

+ Inheritance diagram for olb::BlockCalcF2D< T, F >:
+ Collaboration diagram for olb::BlockCalcF2D< T, F >:

Public Member Functions

 BlockCalcF2D (BlockF2D< T > &f, BlockF2D< T > &g)
 
 BlockCalcF2D (BlockF2D< T > &f, GenericF< T, int > &g, int glob)
 
 BlockCalcF2D (GenericF< T, int > &f, int glob, BlockF2D< T > &g)
 
bool operator() (T output[], const int input[]) override
 has to be implemented for 'every' derived class
 
- 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
 
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)
 

Protected Attributes

GenericF< T, int > & _f
 
GenericF< T, int > & _g
 
const int _glob
 Optional global cuboid ID for mixed super / block usage.
 
const bool _fIsBlock
 
const bool _gIsBlock
 
- Protected Attributes inherited from olb::BlockF2D< T >
BlockStructureD< 2 > * _blockStructure
 

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)
 

Detailed Description

template<typename T, template< typename > class F>
class olb::BlockCalcF2D< T, F >

Block level arithmetic operations for BlockF2D functors.

Template Parameters
FFunction object defining the arithmetic operation to be perfomed e.g. std::minus for substraction

Functors BlockCalcF2D<T,F>::_f and BlockCalcF2D<T,F>::_f are stored as GenericF<T,int> references to support arithmetic operations between block and super functors. For details see BlockCalcF2D<T,F>::operator().

Definition at line 49 of file blockCalcF2D.h.

Constructor & Destructor Documentation

◆ BlockCalcF2D() [1/3]

template<typename T , template< typename > class F>
olb::BlockCalcF2D< T, F >::BlockCalcF2D ( BlockF2D< T > & f,
BlockF2D< T > & g )

Definition at line 33 of file blockCalcF2D.hh.

34 : BlockF2D<T>(
35 g.getBlockStructure(),
36 f.getTargetDim() > g.getTargetDim() ? f.getTargetDim() : g.getTargetDim()),
37 _f(f), _g(g),
38 _glob{}, _fIsBlock(true), _gIsBlock(true)
39{
40 this->getName() = "(" + f.getName() + F<T>::symbol + g.getName() + ")";
41 std::swap(f._ptrCalcC, this->_ptrCalcC);
42}
const bool _fIsBlock
GenericF< T, int > & _g
const bool _gIsBlock
const int _glob
Optional global cuboid ID for mixed super / block usage.
GenericF< T, int > & _f
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 >::_ptrCalcC, olb::GenericF< T, S >::getName(), and olb::GenericF< T, int >::getName().

+ Here is the call graph for this function:

◆ BlockCalcF2D() [2/3]

template<typename T , template< typename > class F>
olb::BlockCalcF2D< T, F >::BlockCalcF2D ( BlockF2D< T > & f,
GenericF< T, int > & g,
int glob )
Parameters
fBlock functor
gGeneric functor to be restricted to block level
globGlobal cuboid ID to be used to prefix calls to g

Definition at line 45 of file blockCalcF2D.hh.

46 : BlockF2D<T>(
47 f.getBlockStructure(),
48 f.getTargetDim() > g.getTargetDim() ? f.getTargetDim() : g.getTargetDim()),
49 _f(f), _g(g),
50 _glob(glob), _fIsBlock(true), _gIsBlock(false)
51{
52 this->getName() = "(" + f.getName() + F<T>::symbol + g.getName() + ")";
53 std::swap(f._ptrCalcC, this->_ptrCalcC);
54}

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

+ Here is the call graph for this function:

◆ BlockCalcF2D() [3/3]

template<typename T , template< typename > class F>
olb::BlockCalcF2D< T, F >::BlockCalcF2D ( GenericF< T, int > & f,
int glob,
BlockF2D< T > & g )
Parameters
fGeneric functor to be restricted to block level
globGlobal cuboid ID to be used to prefix calls to f
gBlock functor

Definition at line 57 of file blockCalcF2D.hh.

58 : BlockF2D<T>(
59 g.getBlockStructure(),
60 f.getTargetDim() > g.getTargetDim() ? f.getTargetDim() : g.getTargetDim()),
61 _f(f), _g(g),
62 _glob(glob), _fIsBlock(false), _gIsBlock(true)
63{
64 this->getName() = "(" + f.getName() + F<T>::symbol + g.getName() + ")";
65 std::swap(f._ptrCalcC, this->_ptrCalcC);
66}
std::shared_ptr< GenericF< T, S > > _ptrCalcC
memory management, frees resouces (calcClass)
Definition genericF.h:71

Member Function Documentation

◆ operator()()

template<typename T , template< typename > class F>
bool olb::BlockCalcF2D< T, F >::operator() ( T output[],
const int input[] )
overridevirtual

has to be implemented for 'every' derived class

Implements olb::GenericF< T, int >.

Definition at line 69 of file blockCalcF2D.hh.

70{
71 T* outputF = output;
72 T outputG[this->getTargetDim()];
73
74 if ( this->_fIsBlock && this->_gIsBlock ) {
75 this->_f(outputF, input);
76 this->_g(outputG, input);
77 }
78 else {
79 const int superInput[3] = { this->_glob, input[0], input[1] };
80
81 if ( this->_fIsBlock ) {
82 this->_f(outputF, input);
83 this->_g(outputG, superInput);
84 }
85 else {
86 this->_f(outputF, superInput);
87 this->_g(outputG, input);
88 }
89 }
90
91 if ( _f.getTargetDim() == 1 || _g.getTargetDim() == 1 ) {
92 // scalar operation
93 if ( _f.getTargetDim() == 1 ) {
94 // apply the scalar f to possibly multidimensional g
95 for (int i = 1; i < this->getTargetDim(); i++) {
96 outputF[i] = outputF[0];
97 }
98 }
99 else if ( _g.getTargetDim() == 1 ) {
100 // apply scalar g to possibly multidimensional f
101 for (int i = 1; i < this->getTargetDim(); i++) {
102 outputG[i] = outputG[0];
103 }
104 }
105 }
106
107 for (int i = 0; i < this->getTargetDim(); i++) {
108 output[i] = F<T>()(outputF[i], outputG[i]);
109 }
110
111 return true;
112}

Member Data Documentation

◆ _f

template<typename T , template< typename > class F>
GenericF<T,int>& olb::BlockCalcF2D< T, F >::_f
protected

Definition at line 51 of file blockCalcF2D.h.

◆ _fIsBlock

template<typename T , template< typename > class F>
const bool olb::BlockCalcF2D< T, F >::_fIsBlock
protected

Definition at line 56 of file blockCalcF2D.h.

◆ _g

template<typename T , template< typename > class F>
GenericF<T,int>& olb::BlockCalcF2D< T, F >::_g
protected

Definition at line 52 of file blockCalcF2D.h.

◆ _gIsBlock

template<typename T , template< typename > class F>
const bool olb::BlockCalcF2D< T, F >::_gIsBlock
protected

Definition at line 57 of file blockCalcF2D.h.

◆ _glob

template<typename T , template< typename > class F>
const int olb::BlockCalcF2D< T, F >::_glob
protected

Optional global cuboid ID for mixed super / block usage.

Definition at line 55 of file blockCalcF2D.h.


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