OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::AnalyticalFfromSuperF2D< T, W > Class Template Referencefinal

Converts super functions to analytical functions. More...

#include <interpolationF2D.h>

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

Public Member Functions

 AnalyticalFfromSuperF2D (SuperF2D< T > &f, bool communicateToAll=false, bool communicateOverlap=true)
 
bool operator() (T output[], const T physC[]) override
 
int getBlockFSize () const
 
AnalyticalFfromBlockF2D< T, W > & getBlockF (int iCloc)
 
- 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

const bool _communicateToAll
 
const bool _communicateOverlap
 
SuperF2D< T > & _f
 
CuboidDecomposition< T, 2 > & _cuboidDecomposition
 
std::vector< std::unique_ptr< AnalyticalFfromBlockF2D< T, W > > > _blockF
 

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

Converts super functions to analytical functions.

Definition at line 63 of file interpolationF2D.h.

Constructor & Destructor Documentation

◆ AnalyticalFfromSuperF2D()

template<typename T , typename W >
olb::AnalyticalFfromSuperF2D< T, W >::AnalyticalFfromSuperF2D ( SuperF2D< T > & f,
bool communicateToAll = false,
bool communicateOverlap = true )

Definition at line 198 of file interpolationF2D.hh.

200 : AnalyticalF2D<T,W>(f.getTargetDim()),
201 _communicateToAll(communicateToAll),
202 _communicateOverlap(communicateOverlap),
203 _f(f),
205{
206 this->getName() = "fromSuperF("+ f.getName()+")";
207
208 LoadBalancer<T>& load = _f.getSuperStructure().getLoadBalancer();
209 for (int iC = 0; iC < load.size(); ++iC) {
210 this->_blockF.emplace_back(
211 new AnalyticalFfromBlockF2D<T>(_f.getBlockF(iC),
212 _cuboidDecomposition.get(load.glob(iC)))
213 );
214 }
215}
CuboidDecomposition< T, 2 > & _cuboidDecomposition
std::vector< std::unique_ptr< AnalyticalFfromBlockF2D< T, W > > > _blockF
const Cuboid< T, D > & get(int iC) const
Read access to a single cuboid.
std::string & getName()
read and write access to name
Definition genericF.hh:51
SuperStructure< T, 2 > & getSuperStructure()
BlockF2D< W > & getBlockF(int iCloc)
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
CuboidDecomposition< T, D > & getCuboidDecomposition()
Read and write access to cuboid geometry.
AnalyticalF< 2, T, S > AnalyticalF2D

References olb::AnalyticalFfromSuperF2D< T, W >::_blockF, olb::AnalyticalFfromSuperF2D< T, W >::_cuboidDecomposition, olb::AnalyticalFfromSuperF2D< T, W >::_f, olb::CuboidDecomposition< T, D >::get(), olb::SuperF2D< T, U >::getBlockF(), olb::SuperStructure< T, D >::getLoadBalancer(), olb::GenericF< T, S >::getName(), olb::SuperF2D< T, U >::getSuperStructure(), olb::LoadBalancer< T >::glob(), and olb::LoadBalancer< T >::size().

+ Here is the call graph for this function:

Member Function Documentation

◆ getBlockF()

template<typename T , typename W >
AnalyticalFfromBlockF2D< T, W > & olb::AnalyticalFfromSuperF2D< T, W >::getBlockF ( int iCloc)
Returns
_blockF[iCloc]

Definition at line 277 of file interpolationF2D.hh.

278{
279 OLB_ASSERT(size_t(iCloc) < _blockF.size() && iCloc >= 0,
280 "block functor index within bounds");
281 return *(_blockF[iCloc]);
282}
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References OLB_ASSERT.

◆ getBlockFSize()

template<typename T , typename W >
int olb::AnalyticalFfromSuperF2D< T, W >::getBlockFSize ( ) const
Returns
Size of _blockF vector

Definition at line 269 of file interpolationF2D.hh.

270{
271 OLB_ASSERT(_blockF.size() < UINT32_MAX,
272 "it is safe to cast std::size_t to int");
273 return _blockF.size();
274}

References OLB_ASSERT.

◆ operator()()

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

Definition at line 218 of file interpolationF2D.hh.

219{
220 const auto targetDim = _f.getTargetDim();
221 for (int iD = 0; iD < targetDim; ++iD) {
222 output[iD] = W();
223 }
224 Vector<T,2> physCV(physC);
225 auto latticeR = _cuboidDecomposition.getLatticeR(physCV);
226 if (!latticeR) {
227 return false;
228 }
229
232 }
233
234 int dataFound = 0;
235
236 const LoadBalancer<T>& load = _f.getSuperStructure().getLoadBalancer();
237 for (int iC = 0; iC < load.size(); ++iC) {
238 if (_blockF[iC]->operator()(output, physC)) {
239 ++dataFound;
240 }
241 }
242
243 if (_communicateToAll) {
244#ifdef PARALLEL_MODE_MPI
245 singleton::mpi().reduceAndBcast(dataFound, MPI_SUM);
246 for (int iD = 0; iD < targetDim; ++iD) {
247 singleton::mpi().reduceAndBcast(output[iD], MPI_SUM);
248 }
249#endif
250 for (int iD = 0; iD < targetDim; ++iD) {
251 output[iD]/=dataFound;
252 }
253 }
254 else {
255 if (dataFound!=0) {
256 for (int iD = 0; iD < targetDim; ++iD) {
257 output[iD]/=dataFound;
258 }
259 }
260 }
261
262 if (dataFound>0) {
263 return true;
264 }
265 return false;
266}
std::optional< LatticeR< D+1 > > getLatticeR(Vector< T, D > physR) const
Returns lattice position for given physical position if it exists.
int getTargetDim() const
read only access to member variable _n
Definition genericF.hh:45
virtual void communicate()
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
MpiManager & mpi()

References olb::singleton::mpi(), olb::singleton::MpiManager::reduceAndBcast(), and olb::LoadBalancer< T >::size().

+ Here is the call graph for this function:

Member Data Documentation

◆ _blockF

template<typename T , typename W = T>
std::vector<std::unique_ptr<AnalyticalFfromBlockF2D<T,W> > > olb::AnalyticalFfromSuperF2D< T, W >::_blockF
protected

Definition at line 71 of file interpolationF2D.h.

◆ _communicateOverlap

template<typename T , typename W = T>
const bool olb::AnalyticalFfromSuperF2D< T, W >::_communicateOverlap
protected

Definition at line 66 of file interpolationF2D.h.

◆ _communicateToAll

template<typename T , typename W = T>
const bool olb::AnalyticalFfromSuperF2D< T, W >::_communicateToAll
protected

Definition at line 65 of file interpolationF2D.h.

◆ _cuboidDecomposition

template<typename T , typename W = T>
CuboidDecomposition<T,2>& olb::AnalyticalFfromSuperF2D< T, W >::_cuboidDecomposition
protected

Definition at line 69 of file interpolationF2D.h.

◆ _f

template<typename T , typename W = T>
SuperF2D<T>& olb::AnalyticalFfromSuperF2D< T, W >::_f
protected

Definition at line 68 of file interpolationF2D.h.


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