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

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

#include <blockCalcF3D.h>

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

Public Member Functions

 BlockCalcF3D (BlockF3D< T > &f, BlockF3D< T > &g)
 
 BlockCalcF3D (BlockF3D< T > &f, GenericF< T, int > &g, int glob)
 
 BlockCalcF3D (GenericF< T, int > &f, int glob, BlockF3D< T > &g)
 
bool operator() (T output[], const int input[]) override
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::BlockF3D< T >
 ~BlockF3D () override
 virtual destructor for defined behaviour
 
virtual BlockStructureD< 3 > & getBlockStructure () const
 
BlockF3D< T > & operator- (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator+ (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator* (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator/ (BlockF3D< 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::BlockF3D< T >
BlockStructureD< 3 > & _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::BlockF3D< T >
 BlockF3D (BlockStructureD< 3 > &blockStructure, 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::BlockCalcF3D< T, F >

Block level arithmetic operations for BlockF3D functors.

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

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

Definition at line 49 of file blockCalcF3D.h.

Constructor & Destructor Documentation

◆ BlockCalcF3D() [1/3]

template<typename T , template< typename > class F>
olb::BlockCalcF3D< T, F >::BlockCalcF3D ( BlockF3D< T > & f,
BlockF3D< T > & g )

Definition at line 34 of file blockCalcF3D.hh.

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

◆ BlockCalcF3D() [2/3]

template<typename T , template< typename > class F>
olb::BlockCalcF3D< T, F >::BlockCalcF3D ( BlockF3D< 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 46 of file blockCalcF3D.hh.

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

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:

◆ BlockCalcF3D() [3/3]

template<typename T , template< typename > class F>
olb::BlockCalcF3D< T, F >::BlockCalcF3D ( GenericF< T, int > & f,
int glob,
BlockF3D< 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 58 of file blockCalcF3D.hh.

59 : BlockF3D<T>(
60 g.getBlockStructure(),
61 f.getTargetDim() > g.getTargetDim() ? f.getTargetDim() : g.getTargetDim()),
62 _f(f), _g(g),
63 _glob(glob), _fIsBlock(false), _gIsBlock(true)
64{
65 this->getName() = "(" + f.getName() + F<T>::symbol + g.getName() + ")";
66 std::swap(f._ptrCalcC, this->_ptrCalcC);
67}
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::BlockCalcF3D< 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 70 of file blockCalcF3D.hh.

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

Member Data Documentation

◆ _f

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

Definition at line 51 of file blockCalcF3D.h.

◆ _fIsBlock

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

Definition at line 56 of file blockCalcF3D.h.

◆ _g

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

Definition at line 52 of file blockCalcF3D.h.

◆ _gIsBlock

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

Definition at line 57 of file blockCalcF3D.h.

◆ _glob

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

Optional global cuboid ID for mixed super / block usage.

Definition at line 55 of file blockCalcF3D.h.


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