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

Converts super functors to analytical functors. More...

#include <interpolationF3D.h>

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

Public Member Functions

 AnalyticalFfromSuperF3D (SuperF3D< T, W > &f, bool communicateToAll=false, bool communicateOverlap=true)
 
bool operator() (W output[], const T physC[]) override
 
int getBlockFSize () const
 
AnalyticalFfromBlockF3D< 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
 
SuperF3D< T, W > & _f
 
CuboidGeometry3D< T > & _cuboidGeometry
 
std::vector< std::unique_ptr< AnalyticalFfromBlockF3D< 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::AnalyticalFfromSuperF3D< T, W >

Converts super functors to analytical functors.

Definition at line 64 of file interpolationF3D.h.

Constructor & Destructor Documentation

◆ AnalyticalFfromSuperF3D()

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

Definition at line 294 of file interpolationF3D.hh.

296 : AnalyticalF3D<T,W>(f.getTargetDim()),
297 _communicateToAll(communicateToAll),
298 _communicateOverlap(communicateOverlap),
299 _f(f),
301{
302 this->getName() = "fromSuperF";
303
304 LoadBalancer<T>& load = _f.getSuperStructure().getLoadBalancer();
305 for (int iC = 0; iC < load.size(); ++iC) {
306 this->_blockF.emplace_back(
307 new AnalyticalFfromBlockF3D<T>(_f.getBlockF(iC),
308 _cuboidGeometry.get(load.glob(iC)))
309 );
310 }
311}
CuboidGeometry3D< T > & _cuboidGeometry
std::vector< std::unique_ptr< AnalyticalFfromBlockF3D< T, W > > > _blockF
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
SuperStructure< T, 3 > & getSuperStructure()
BlockF3D< W > & getBlockF(int iCloc)
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.

References olb::AnalyticalFfromSuperF3D< T, W >::_blockF, olb::AnalyticalFfromSuperF3D< T, W >::_cuboidGeometry, olb::AnalyticalFfromSuperF3D< T, W >::_f, olb::SuperF3D< T, W >::getBlockF(), olb::SuperStructure< T, D >::getLoadBalancer(), olb::GenericF< T, S >::getName(), olb::SuperF3D< T, W >::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 >
AnalyticalFfromBlockF3D< T, W > & olb::AnalyticalFfromSuperF3D< T, W >::getBlockF ( int iCloc)
Returns
_blockF[iCloc]

Definition at line 379 of file interpolationF3D.hh.

380{
381 OLB_ASSERT(iCloc < int(_blockF.size()) && iCloc >= 0,
382 "block functor index within bounds");
383 return *(_blockF[iCloc]);
384}
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References OLB_ASSERT.

◆ getBlockFSize()

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

Definition at line 371 of file interpolationF3D.hh.

372{
373 OLB_ASSERT(_blockF.size() < INT32_MAX,
374 "it is safe to cast std::size_t to int");
375 return _blockF.size();
376}

References OLB_ASSERT.

◆ operator()()

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

Definition at line 314 of file interpolationF3D.hh.

315{
316 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
317 output[iD] = W();
318 }
319
320 int latticeR[4];
321 if (!_cuboidGeometry.getLatticeR(latticeR, physC)) {
322 return false;
323 }
324
327 }
328
329 int dataSize = 0;
330 int dataFound = 0;
331
332 LoadBalancer<T>& load = _f.getSuperStructure().getLoadBalancer();
333 for (int iC = 0; iC < load.size(); ++iC) {
334 if (_blockF[iC]->operator()(output, physC)) {
335 dataSize += _f.getTargetDim();
336 ++dataFound;
337 }
338 }
339
340 if (_communicateToAll) {
341#ifdef PARALLEL_MODE_MPI
342 singleton::mpi().reduceAndBcast(dataFound, MPI_SUM);
343 singleton::mpi().reduceAndBcast(dataSize, MPI_SUM);
344#endif
345 dataSize /= dataFound;
346#ifdef PARALLEL_MODE_MPI
347 for (int iD = 0; iD < dataSize; ++iD) {
348 singleton::mpi().reduceAndBcast(output[iD], MPI_SUM);
349 }
350#endif
351 for (int iD = 0; iD < dataSize; ++iD) {
352 output[iD]/=dataFound;
353 }
354 }
355 else {
356 if (dataFound!=0) {
357 dataSize /= dataFound;
358 for (int iD = 0; iD < dataSize; ++iD) {
359 output[iD]/=dataFound;
360 }
361 }
362 }
363
364 if (dataFound>0) {
365 return true;
366 }
367 return false;
368}
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<AnalyticalFfromBlockF3D<T,W> > > olb::AnalyticalFfromSuperF3D< T, W >::_blockF
protected

Definition at line 72 of file interpolationF3D.h.

◆ _communicateOverlap

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

Definition at line 67 of file interpolationF3D.h.

◆ _communicateToAll

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

Definition at line 66 of file interpolationF3D.h.

◆ _cuboidGeometry

template<typename T , typename W = T>
CuboidGeometry3D<T>& olb::AnalyticalFfromSuperF3D< T, W >::_cuboidGeometry
protected

Definition at line 70 of file interpolationF3D.h.

◆ _f

template<typename T , typename W = T>
SuperF3D<T,W>& olb::AnalyticalFfromSuperF3D< T, W >::_f
protected

Definition at line 69 of file interpolationF3D.h.


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