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

Converts block functors to analytical functors (special) More...

#include <interpolationF3D.h>

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

Public Member Functions

 SpecialAnalyticalFfromBlockF3D (BlockF3D< W > &f, Cuboid3D< T > &cuboid, Vector< T, 3 > delta, T scale=1.)
 trilinear interpolation for rectangular lattice with dimensions delta[i]; if the cuboid is a plane (e.g.
 
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

BlockF3D< W > & _f
 
Cuboid3D< T > & _cuboid
 
Vector< T, 3 > _delta
 
_scale
 

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::SpecialAnalyticalFfromBlockF3D< T, W >

Converts block functors to analytical functors (special)

Definition at line 40 of file interpolationF3D.h.

Constructor & Destructor Documentation

◆ SpecialAnalyticalFfromBlockF3D()

template<typename T , typename W >
olb::SpecialAnalyticalFfromBlockF3D< T, W >::SpecialAnalyticalFfromBlockF3D ( BlockF3D< W > & f,
Cuboid3D< T > & cuboid,
Vector< T, 3 > delta,
T scale = 1. )

trilinear interpolation for rectangular lattice with dimensions delta[i]; if the cuboid is a plane (e.g.

nZ==1) this functor will convert to bilinear interpolation and to linear interpolation for a "line cuboid" (e.g. nY==nZ==1)

Definition at line 40 of file interpolationF3D.hh.

43 : AnalyticalF3D<T,W>(f.getTargetDim()), _f(f), _cuboid(cuboid), _delta(delta), _scale(scale)
44{
45 this->getName() = "fromBlockF";
46}
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::SpecialAnalyticalFfromBlockF3D< T, W >::operator() ( W output[],
const T physC[] )
override

Definition at line 50 of file interpolationF3D.hh.

51{
52 Vector<T,3> origin = _cuboid.getOrigin();
53
54 // scale physC in all 3 dimensions
55 Vector<T,3> physCv;
56 for (int i=0; i<3; i++) {
57 physCv[i] = origin[i] + (physC[i] - origin[i]) * ( _cuboid.getDeltaR() / _delta[i] );
58 }
59
60 int latticeR[3];
61 for (int i=0; i<3; i++) {
62 latticeR[i] = util::max((int)util::floor( (physCv[i] - origin[i])/
63 _cuboid.getDeltaR()), 0);
64 }
65 Vector<T,3> physRiC;
66 Vector<W,3> d, e;
67 W output_tmp[3];
68 Vector<T,3> latticeRv;
69
70 for (int i=0; i<3; i++) {
71 latticeRv[i] = (T) latticeR[i];
72 }
73 physRiC = origin + latticeRv * _cuboid.getDeltaR();
74 T dr = 1. / _cuboid.getDeltaR();
75
76 // compute weights
77 d = (physCv - physRiC) * dr;
78 e = 1. - d;
79
80 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
81 output[iD] = W();
82 output_tmp[iD] = W();
83 }
84
85 //0=1=2=
86 _f(output_tmp, latticeR);
87 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
88 output[iD] += output_tmp[iD] * e[0]*e[1]*e[2];
89 }
90
91 if (_cuboid.getNy() != 1) {
92 latticeR[1]++;
93 }
94
95 //0=1+2=
96 _f(output_tmp, latticeR);
97 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
98 output[iD] += output_tmp[iD] * e[0]*d[1]*e[2];
99 }
100
101 if (_cuboid.getNx() != 1) {
102 latticeR[0]++;
103 }
104 if (_cuboid.getNy() != 1) {
105 latticeR[1]--;
106 }
107 //0+1=2=
108 _f(output_tmp, latticeR);
109 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
110 output[iD] += output_tmp[iD] * d[0]*e[1]*e[2];
111 }
112
113 if (_cuboid.getNy() != 1) {
114 latticeR[1]++;
115 }
116 //0+1+2=
117 _f(output_tmp, latticeR);
118 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
119 output[iD] += output_tmp[iD] * d[0]*d[1]*e[2];
120 }
121
122 if (_cuboid.getNx() != 1) {
123 latticeR[0]--;
124 }
125 if (_cuboid.getNy() != 1) {
126 latticeR[1]--;
127 }
128 if (_cuboid.getNz() != 1) {
129 latticeR[2]++;
130 }
131 //0=1=2+
132 _f(output_tmp, latticeR);
133 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
134 output[iD] += output_tmp[iD] * e[0]*e[1]*d[2];
135 }
136
137 if (_cuboid.getNy() != 1) {
138 latticeR[1]++;
139 }
140 //0=1+2+
141 _f(output_tmp, latticeR);
142 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
143 output[iD] += output_tmp[iD] * e[0]*d[1]*d[2];
144 }
145
146 if (_cuboid.getNx() != 1) {
147 latticeR[0]++;
148 }
149 if (_cuboid.getNy() != 1) {
150 latticeR[1]--;
151 }
152 //0+1=2+
153 _f(output_tmp, latticeR);
154 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
155 output[iD] += output_tmp[iD] * d[0]*e[1]*d[2];
156 }
157
158 if (_cuboid.getNy() != 1) {
159 latticeR[1]++;
160 }
161 //0+1+2+
162 _f(output_tmp, latticeR);
163 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
164 output[iD] += output_tmp[iD] * d[0]*d[1]*d[2];
165 }
166
167 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
168 output[iD] *= _scale;
169 }
170
171 return true;
172}
constexpr int d() any_platform
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130

References olb::util::floor(), and olb::util::max().

+ Here is the call graph for this function:

Member Data Documentation

◆ _cuboid

template<typename T , typename W = T>
Cuboid3D<T>& olb::SpecialAnalyticalFfromBlockF3D< T, W >::_cuboid
protected

Definition at line 43 of file interpolationF3D.h.

◆ _delta

template<typename T , typename W = T>
Vector<T,3> olb::SpecialAnalyticalFfromBlockF3D< T, W >::_delta
protected

Definition at line 44 of file interpolationF3D.h.

◆ _f

template<typename T , typename W = T>
BlockF3D<W>& olb::SpecialAnalyticalFfromBlockF3D< T, W >::_f
protected

Definition at line 42 of file interpolationF3D.h.

◆ _scale

template<typename T , typename W = T>
T olb::SpecialAnalyticalFfromBlockF3D< T, W >::_scale
protected

Definition at line 45 of file interpolationF3D.h.


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