25#ifndef SUPER_CALC_F_2D_HH
26#define SUPER_CALC_F_2D_HH
35template <
typename T,
typename W,
template<
typename>
class F>
39 f->getSuperStructure(),
40 f->getTargetDim() > g->getTargetDim() ? f->getTargetDim() : g->getTargetDim()),
45 _f->getTargetDim() ==
_g->getTargetDim() ||
_f->getTargetDim() == 1 ||
_g->getTargetDim() == 1,
46 "Componentwise operation must be well defined.");
48 this->
getName() =
"(" +
_f->getName() + F<T>::symbol +
_g->getName() +
")";
50 std::swap(
_f->_ptrCalcC, this->_ptrCalcC);
54 if (
_f->getBlockFSize() == load.
size() ) {
55 if (
_g->getBlockFSize() == load.
size() ) {
57 for (
int iC = 0; iC < load.
size(); ++iC) {
65 for (
int iC = 0; iC < load.
size(); ++iC) {
72 else if (
_g->getBlockFSize() == load.
size() ) {
74 for (
int iC = 0; iC < load.
size(); ++iC) {
76 new BlockCalcF2D<W,F>(*f, load.
glob(iC),
_g->getBlockF(iC))
82template <
typename T,
typename W,
template<
typename>
class F>
86 std::forward<decltype(g)>(g))
89template <
typename T,
typename W,
template<
typename>
class F>
92 std::forward<decltype(f)>(f),
96template <
typename T,
typename W,
template<
typename>
class F>
99 if ( _f->getTargetDim() == 1 || _g->getTargetDim() == 1 ) {
102 if ( _f->getTargetDim() == 1 ) {
107 for (
int i = 0; i < this->getTargetDim(); i++) {
108 output[i] = F<T>()(scalar, output[i]);
116 for (
int i = 0; i < this->getTargetDim(); i++) {
117 output[i] = F<T>()(output[i], scalar);
124 W outputG[this->getTargetDim()];
129 for (
int i = 0; i < this->getTargetDim(); i++) {
130 output[i] = F<T>()(outputF[i], outputG[i]);
137template <
typename T,
typename W>
140 return std::shared_ptr<SuperF2D<T,W>>(
144template <
typename T,
typename W>
147 return std::shared_ptr<SuperF2D<T,W>>(
151template <
typename T,
typename W>
154 return std::shared_ptr<SuperF2D<T,W>>(
158template <
typename T,
typename W>
161 return std::shared_ptr<SuperF2D<T,W>>(
165template <
typename T,
typename W>
168 return std::shared_ptr<SuperF2D<T,W>>(
172template <
typename T,
typename W>
175 return std::shared_ptr<SuperF2D<T,W>>(
179template <
typename T,
typename W>
182 return std::shared_ptr<SuperF2D<T,W>>(
186template <
typename T,
typename W>
189 return std::shared_ptr<SuperF2D<T,W>>(
193template <
typename T,
typename W>
196 return std::shared_ptr<SuperF2D<T,W>>(
200template <
typename T,
typename W>
203 return std::shared_ptr<SuperF2D<T,W>>(
207template <
typename T,
typename W>
210 return std::shared_ptr<SuperF2D<T,W>>(
214template <
typename T,
typename W>
217 return std::shared_ptr<SuperF2D<T,W>>(
222template <
typename T,
typename W>
225 auto tmp = std::make_shared< SuperCalcPlus2D<T,W> >(*
this,rhs);
226 this->_ptrCalcC = tmp;
230template <
typename T,
typename W>
233 auto tmp = std::make_shared< SuperCalcMinus2D<T,W> >(*
this,rhs);
234 this->_ptrCalcC = tmp;
238template <
typename T,
typename W>
241 auto tmp = std::make_shared< SuperCalcMultiplication2D<T,W> >(*
this,rhs);
242 this->_ptrCalcC = tmp;
246template <
typename T,
typename W>
249 auto tmp = std::make_shared< SuperCalcDivision2D<T,W> >(*
this,rhs);
250 this->_ptrCalcC = tmp;
Block level arithmetic operations for BlockF2D functors.
Smart pointer for managing the various ways of passing functors around.
std::string & getName()
read and write access to name
Base class for all LoadBalancer.
Arithmetic operations for SuperF2D functors.
FunctorPtr< SuperF2D< T, W > > _g
SuperCalcF2D(FunctorPtr< SuperF2D< T, W > > &&f, FunctorPtr< SuperF2D< T, W > > &&g)
bool operator()(W output[], const int input[]) override
has to be implemented for 'every' derived class
FunctorPtr< SuperF2D< T, W > > _f
Functor returning a constant vector for all inputs.
represents all functors that operate on a SuperStructure<T,2> in general
SuperF2D< T, W > & operator-(SuperF2D< T, W > &rhs)
SuperF2D< T, W > & operator+(SuperF2D< T, W > &rhs)
SuperF2D< T, W > & operator*(SuperF2D< T, W > &rhs)
std::vector< std::unique_ptr< BlockF2D< W > > > _blockF
Super functors may consist of several BlockF2D<W> derived functors.
SuperF2D< T, W > & operator/(SuperF2D< T, W > &rhs)
Top level namespace for all of OpenLB.
constexpr meta::enable_if_arithmetic_t< U, Vector< T, D > > operator-(U a, const ScalarVector< T, D, IMPL > &b) any_platform
constexpr meta::enable_if_arithmetic_t< U, Vector< T, D > > operator+(U a, const ScalarVector< T, D, IMPL > &b) any_platform
constexpr meta::enable_if_arithmetic_t< U, Vector< decltype(T{} *U{}), D > > operator*(U a, const ScalarVector< T, D, IMPL > &b) any_platform
constexpr meta::enable_if_arithmetic_t< U, Vector< T, D > > operator/(const ScalarVector< T, D, IMPL > &a, U b) any_platform
#define OLB_ASSERT(COND, MESSAGE)