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

Converts block functors to analytical functors. More...

#include <interpolationF2D.h>

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

Public Member Functions

 AnalyticalFfromBlockF2D (BlockF2D< W > &f, Cuboid2D< T > &cuboid)
 
bool operator() (W output[], const T physC[]) override
 
- Public Member Functions inherited from olb::AnalyticalF< D, T, S >
AnalyticalF< D, T, S > & operator- (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator+ (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator* (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator/ (AnalyticalF< D, T, S > &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
 
Cuboid2D< T > & _cuboid
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< D, T, S >
using identity_functor_type = AnalyticalIdentity<D,T,S>
 
- 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)
 
- Static Public Attributes inherited from olb::AnalyticalF< D, T, S >
static constexpr unsigned dim = D
 
- Protected Member Functions inherited from olb::AnalyticalF< D, T, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

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

Converts block functors to analytical functors.

Definition at line 40 of file interpolationF2D.h.

Constructor & Destructor Documentation

◆ AnalyticalFfromBlockF2D()

template<typename T , typename W >
olb::AnalyticalFfromBlockF2D< T, W >::AnalyticalFfromBlockF2D ( BlockF2D< W > & f,
Cuboid2D< T > & cuboid )

Definition at line 36 of file interpolationF2D.hh.

38 : AnalyticalF2D<T,W>(f.getTargetDim()),
39 _f(f), _cuboid(cuboid)
40{
41 this->getName() = "fromBlockF";
42}
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().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename W >
bool olb::AnalyticalFfromBlockF2D< T, W >::operator() ( W output[],
const T physC[] )
override

Definition at line 45 of file interpolationF2D.hh.

46{
47 int latticeC[2];
48 int latticeR[2];
49 _cuboid.getFloorLatticeR(latticeR, physC);
50
51 auto& block = _f.getBlockStructure();
52 auto padding = std::min(1, block.getPadding());
53
54 if (LatticeR<2>(latticeR) >= -padding && LatticeR<2>(latticeR) < block.getExtent()+padding-1) {
55 const int& locX = latticeR[0];
56 const int& locY = latticeR[1];
57
58 Vector<T,2> physRiC;
59 Vector<T,2> physCv(physC);
60 _cuboid.getPhysR(physRiC.data(), {locX, locY});
61
62 // compute weights
63 Vector<W,2> d = (physCv - physRiC) * (1. / _cuboid.getDeltaR());
64 Vector<W,2> e = 1. - d;
65
66 T output_tmp[_f.getTargetDim()];
67 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
68 output_tmp[iD] = T();
69 }
70
71 latticeC[0] = locX;
72 latticeC[1] = locY;
73 _f(output_tmp,latticeC);
74 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
75 output[iD] += output_tmp[iD] * e[0] * e[1];
76 output_tmp[iD] = T();
77 }
78
79 latticeC[0] = locX;
80 latticeC[1] = locY + 1;
81 _f(output_tmp,latticeC);
82 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
83 output[iD] += output_tmp[iD] * e[0] * d[1];
84 output_tmp[iD] = T();
85 }
86
87 latticeC[0] = locX + 1;
88 latticeC[1] = locY;
89 _f(output_tmp,latticeC);
90 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
91 output[iD] += output_tmp[iD] * d[0] * e[1];
92 output_tmp[iD] = T();
93 }
94
95 latticeC[0] = locX + 1;
96 latticeC[1] = locY + 1;
97 _f(output_tmp,latticeC);
98 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
99 output[iD] += output_tmp[iD] * d[0] * d[1];
100 output_tmp[iD] = T();
101 }
102
103 return true;
104 }
105 else {
106 return false;
107 }
108}
virtual BlockStructureD< 2 > & getBlockStructure()
virtual destructor for defined behaviour
constexpr int d() any_platform

References olb::Vector< T, D >::data().

+ Here is the call graph for this function:

Member Data Documentation

◆ _cuboid

template<typename T , typename W = T>
Cuboid2D<T>& olb::AnalyticalFfromBlockF2D< T, W >::_cuboid
protected

Definition at line 43 of file interpolationF2D.h.

◆ _f

template<typename T , typename W = T>
BlockF2D<W>& olb::AnalyticalFfromBlockF2D< T, W >::_f
protected

Definition at line 42 of file interpolationF2D.h.


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