25#ifndef SUPER_BASE_F_3D_HH
26#define SUPER_BASE_F_3D_HH
33template <
typename T,
typename W>
35 :
GenericF<W,int>(targetDim,4), _superStructure(superStructure) { }
37template <
typename T,
typename W>
40 return _superStructure;
43template <
typename T,
typename W>
47 "cast from std::size_t to int unsafe");
48 return _blockF.size();
51template <
typename T,
typename W>
54 OLB_ASSERT(iCloc <
int(_blockF.size()) && iCloc >= 0,
55 "block functor index outside bounds");
56 return *(_blockF[iCloc]);
59template <
typename T,
typename W>
66 const int loc = load.
loc(input[0]);
68 return this->getBlockF(loc)(output, &input[1]);
77template <
typename T,
typename BaseType>
82 for (
int iC = 0; iC < _superData.getLoadBalancer().size(); ++iC) {
87template <
typename T,
typename BaseType>
90 const auto& load = _superData.getLoadBalancer();
92 return this->getBlockF(load.loc(input[0]))(output, &input[1]);
99template <
typename T,
typename BaseType>
107template <
typename T,
typename W>
109 :
SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()),
114 for (
int iC = 0; iC <
_f->getBlockFSize(); ++iC) {
120template <
typename T,
typename W>
123 return _f(output, input);
128template <
typename T,
typename W>
131 :
SuperF3D<T,W>(f->getSuperStructure(), 1),
133 _extractDim(extractDim)
137 for (
int iC = 0; iC <
_f->getBlockFSize(); ++iC) {
143template <
typename T,
typename W>
149template <
typename T,
typename W>
152 std::vector<T> outTmp(_f->getTargetDim(), T{});
153 _f(outTmp.data(), input);
154 output[0] = outTmp[_extractDim];
159template <
typename T,
typename W>
164 _indicatorF(std::move(indicatorF))
166 this->
getName() = f->getName();
168 for (
int iC = 0; iC < f->getBlockFSize(); ++iC) {
171 f->getBlockF(iC), extractDim,
177template <
typename T,
typename W>
181 if (_indicatorF(input)) {
188template <
typename T,
typename W>
192 :
SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()),
194 _indicatorF(std::move(indicatorF))
196 this->getName() = _f->
getName();
198 for (
int iC = 0; iC < f->getBlockFSize(); ++iC) {
199 this->_blockF.emplace_back(
202 _indicatorF->getBlockIndicatorF(iC))
207template <
typename T,
typename W>
210 for (
int i = 0; i < this->getTargetDim(); ++i) {
213 if (_indicatorF(input)) {
220template <
typename T,
typename W,
typename W2>
223 :
SuperF3D<T,W>(f->getSuperStructure(), f->getTargetDim()),
228 for (
int iC = 0; iC < f->getBlockFSize(); ++iC) {
236template <
typename T,
typename W,
typename W2>
239 W2 result[this->getTargetDim()];
241 for (
int i = 0; i < this->getTargetDim(); ++i) {
242 output[i] =
static_cast<W
>(result[i]);
248template <
typename T,
typename W>
252 :
SuperF3D<T,W>(f.getSuperStructure(),f.getTargetDim() ),
254 _indicatorF(indicatorF),
255 _defaultValue(defaultValue)
261template <
typename T,
typename W>
265 _indicatorF(&indic, input);
270 for (
int i=0; i<_f.getTargetDim(); i++) {
271 output[i] = _defaultValue;
278template <
typename T,
typename DESCRIPTOR>
281 :
SuperF3D<T,T>(superLattice, targetDim), _sLattice(superLattice) { }
283template <
typename T,
typename DESCRIPTOR>
289template<
typename T,
typename DESCRIPTOR>
291 T output[],
const int input[])
295 if (load.isLocal(input[0])) {
296 const int loc = load.loc(input[0]);
298 return this->getBlockF(loc)(output, &input[1]);
305template <
typename T,
typename DESCRIPTOR>
308 :
SuperLatticeF3D<T,DESCRIPTOR>(f->getSuperLattice(), f->getTargetDim()),
311 this->
getName() =
"Id(" +
_f->getName() +
")";
313 for (
int iC = 0; iC <
_f->getBlockFSize(); ++iC) {
320template <
typename T,
typename DESCRIPTOR>
323 return _f(output, input);
326template <
typename T,
typename DESCRIPTOR>
330 :
SuperLatticeF3D<T,DESCRIPTOR>(sLattice, targetDim), _converter(converter) { }
332template <
typename T,
typename DESCRIPTOR>
335 return this->_converter;
337template <
typename T,
typename DESCRIPTOR,
typename TDESCRIPTOR>
341 :
SuperLatticeF3D<T,TDESCRIPTOR>(sLattice, targetDim), _converter(converter) { }
343template <
typename T,
typename DESCRIPTOR,
typename TDESCRIPTOR>
346 return this->_converter;
349template <
typename T,
typename DESCRIPTOR>
353 :
SuperLatticeF3D<T,DESCRIPTOR>(f0.getSuperLattice(), 3), _f0(f0), _f1(f1), _f2(f2)
355 this->
getName() =
"composedSuperLatticeF3D";
358template <
typename T,
typename DESCRIPTOR>
BlockDataF3D can store data of any BlockFunctor3D.
represents all functors that operate on a cuboid in general, mother class of BlockLatticeF,...
represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(),...
perform explicit typecast from output type T2 to T
bool operator()(T output[], const int x[]) override
ComposedSuperLatticeF3D(SuperLatticeF3D< T, DESCRIPTOR > &f0, SuperLatticeF3D< T, DESCRIPTOR > &f1, SuperLatticeF3D< T, DESCRIPTOR > &f2)
Smart pointer for managing the various ways of passing functors around.
GenericF is a base class, that can represent continuous as well as discrete functions.
std::shared_ptr< GenericF< T, S > > _ptrCalcC
memory management, frees resouces (calcClass)
std::string & getName()
read and write access to name
Base class for all LoadBalancer.
bool isLocal(const int &glob)
returns whether glob is on this process
SuperDataF3D(SuperData< 3, T, BaseType > &superData)
Constructor from SuperData3D - stores _superData reference.
bool operator()(BaseType output[], const int input[])
Operator for this functor - copies data from _superData object into output.
SuperData< 3, T, BaseType > & getSuperData()
Getter for _superData
represents all functors that operate on a SuperStructure<T,3> in general
SuperStructure< T, 3 > & getSuperStructure()
int getBlockFSize() const
BlockF3D< W > & getBlockF(int iCloc)
SuperF3D(SuperStructure< T, 3 > &superStructure, int targetDim)
bool operator()(W output[], const int input[])
std::vector< std::unique_ptr< BlockF3D< W > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
identity functor for memory management
FunctorPtr< SuperF3D< T, W > > _f
bool operator()(W output[], const int input[]) override
SuperIdentity3D(FunctorPtr< SuperF3D< T, W > > &&f)
SuperIdentityOnSuperIndicatorF3D(SuperF3D< T, W > &f, SuperIndicatorF3D< T > &indicatorF, W defaultValue=0.)
SuperIndicatorF3D< T > & _indicatorF
bool operator()(W output[], const int input[])
Base indicator functor (discrete)
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
SuperLattice< T, DESCRIPTOR > & getSuperLattice()
SuperLatticeF3D(SuperLattice< T, DESCRIPTOR > &superLattice, int targetDim)
bool operator()(T output[], const int input[])
FunctorPtr< SuperLatticeF3D< T, DESCRIPTOR > > _f
bool operator()(T output[], const int input[]) override
SuperLatticeIdentity3D(FunctorPtr< SuperLatticeF3D< T, DESCRIPTOR > > &&f)
UnitConverter< T, DESCRIPTOR > const & getConverter() const
SuperLatticePhysF3D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter, int targetDim)
ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > const & getConverter() const
SuperLatticeThermalPhysF3D(SuperLattice< T, TDESCRIPTOR > &sLattice, const ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > &converter, int targetDim)
Super class maintaining block lattices for a cuboid decomposition.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
perform explicit typecast from output type W2 to W
FunctorPtr< SuperF3D< T, W2 > > _f
bool operator()(W output[], const int input[])
has to be implemented for 'every' derived class
Conversion between physical and lattice units, as well as discretization specialized for thermal appl...
Conversion between physical and lattice units, as well as discretization.
int getRank() const
Returns the process ID.
Top level namespace for all of OpenLB.
typename util::BaseTypeHelper< T >::type BaseType
#define OLB_ASSERT(COND, MESSAGE)