OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
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
 
CuboidGeometry2D< T > & _cuboidGeometry
 
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 51 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 111 of file interpolationF2D.hh.

113 : AnalyticalF2D<T,W>(f.getTargetDim()),
114 _communicateToAll(communicateToAll),
115 _communicateOverlap(communicateOverlap),
116 _f(f),
117 _cuboidGeometry(_f.getSuperStructure().getCuboidGeometry())
118{
119 this->getName() = "fromSuperF";
120
121 LoadBalancer<T>& load = _f.getSuperStructure().getLoadBalancer();
122 for (int iC = 0; iC < load.size(); ++iC) {
123 this->_blockF.emplace_back(
124 new AnalyticalFfromBlockF2D<T>(_f.getBlockF(iC),
125 _cuboidGeometry.get(load.glob(iC)))
126 );
127 }
128}
CuboidGeometry2D< T > & _cuboidGeometry
std::vector< std::unique_ptr< AnalyticalFfromBlockF2D< T, W > > > _blockF
std::string & getName()
read and write access to name
Definition genericF.hh:51

References olb::AnalyticalFfromSuperF2D< T, W >::_blockF, olb::AnalyticalFfromSuperF2D< T, W >::_cuboidGeometry, olb::AnalyticalFfromSuperF2D< T, W >::_f, olb::GenericF< T, S >::getName(), 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 196 of file interpolationF2D.hh.

197{
198 OLB_ASSERT(size_t(iCloc) < _blockF.size() && iCloc >= 0,
199 "block functor index within bounds");
200 return *(_blockF[iCloc]);
201}
#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 188 of file interpolationF2D.hh.

189{
190 OLB_ASSERT(_blockF.size() < UINT32_MAX,
191 "it is safe to cast std::size_t to int");
192 return _blockF.size();
193}

References OLB_ASSERT.

◆ operator()()

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

Definition at line 131 of file interpolationF2D.hh.

132{
133 for (int iD = 0; iD < _f.getTargetDim(); ++iD) {
134 output[iD] = W();
135 }
136
137 int latticeR[3];
138 if (!_cuboidGeometry.getLatticeR(latticeR, physC)) {
139 return false;
140 }
141
143 _f.getSuperStructure().communicate();
144 }
145
146 int dataSize = 0;
147 int dataFound = 0;
148
149 LoadBalancer<T>& load = _f.getSuperStructure().getLoadBalancer();
150 for (int iC = 0; iC < load.size(); ++iC) {
151 if (_blockF[iC]->operator()(output, physC)) {
152 dataSize += _f.getTargetDim();
153 ++dataFound;
154 }
155 }
156
157 if (_communicateToAll) {
158#ifdef PARALLEL_MODE_MPI
159 singleton::mpi().reduceAndBcast(dataFound, MPI_SUM);
160 singleton::mpi().reduceAndBcast(dataSize, MPI_SUM);
161#endif
162 dataSize /= dataFound;
163#ifdef PARALLEL_MODE_MPI
164 for (int iD = 0; iD < dataSize; ++iD) {
165 singleton::mpi().reduceAndBcast(output[iD], MPI_SUM);
166 }
167#endif
168 for (int iD = 0; iD < dataSize; ++iD) {
169 output[iD]/=dataFound;
170 }
171 }
172 else {
173 if (dataFound!=0) {
174 dataSize /= dataFound;
175 for (int iD = 0; iD < dataSize; ++iD) {
176 output[iD]/=dataFound;
177 }
178 }
179 }
180
181 if (dataFound>0) {
182 return true;
183 }
184 return false;
185}
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 59 of file interpolationF2D.h.

◆ _communicateOverlap

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

Definition at line 54 of file interpolationF2D.h.

◆ _communicateToAll

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

Definition at line 53 of file interpolationF2D.h.

◆ _cuboidGeometry

template<typename T , typename W = T>
CuboidGeometry2D<T>& olb::AnalyticalFfromSuperF2D< T, W >::_cuboidGeometry
protected

Definition at line 57 of file interpolationF2D.h.

◆ _f

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

Definition at line 56 of file interpolationF2D.h.


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