25#ifndef ANALYTICAL_CALC_F_HH
26#define ANALYTICAL_CALC_F_HH
36template <
unsigned D,
typename T,
typename S,
template<
typename>
class F>
43 OLB_ASSERT(g->getTargetDim() == f->getTargetDim(),
44 "the dimensions of both functors need to be equal");
45 std::swap(f->_ptrCalcC, this->_ptrCalcC);
46 this->
getName() =
"(" +
_f->getName() + F<T>::symbol +
_g->getName() +
")";
49template <
unsigned D,
typename T,
typename S,
template<
typename>
class F>
54 std::forward<decltype(g)>(g))
57template <
unsigned D,
typename T,
typename S,
template<
typename>
class F>
60 std::forward<decltype(f)>(f),
65template <
unsigned D,
typename T,
typename S,
template<
typename>
class F>
68 T outputTmp[this->_g->getTargetDim()];
69 this->_g(outputTmp, input);
70 this->_f(output, input);
71 for (
int i = 0; i < this->_f->getTargetDim(); ++i) {
72 output[i] = F<T>()(output[i], outputTmp[i]);
78template <
unsigned D,
typename T,
typename S>
81 return std::shared_ptr<AnalyticalF<D,T,S>>(
85template <
unsigned D,
typename T,
typename S>
88 return std::shared_ptr<AnalyticalF<D,T,S>>(
92template <
unsigned D,
typename T,
typename S>
95 return std::shared_ptr<AnalyticalF<D,T,S>>(
99template <
unsigned D,
typename T,
typename S>
102 return std::shared_ptr<AnalyticalF<D,T,S>>(
106template <
unsigned D,
typename T,
typename S>
109 return std::shared_ptr<AnalyticalF<D,T,S>>(
113template <
unsigned D,
typename T,
typename S>
116 return std::shared_ptr<AnalyticalF<D,T,S>>(
120template <
unsigned D,
typename T,
typename S>
123 return std::shared_ptr<AnalyticalF<D,T,S>>(
127template <
unsigned D,
typename T,
typename S>
130 return std::shared_ptr<AnalyticalF<D,T,S>>(
134template <
unsigned D,
typename T,
typename S>
137 return std::shared_ptr<AnalyticalF<D,T,S>>(
141template <
unsigned D,
typename T,
typename S>
144 return std::shared_ptr<AnalyticalF<D,T,S>>(
148template <
unsigned D,
typename T,
typename S>
151 return std::shared_ptr<AnalyticalF<D,T,S>>(
155template <
unsigned D,
typename T,
typename S>
158 return std::shared_ptr<AnalyticalF<D,T,S>>(
163template <
unsigned D,
typename T,
typename S>
166 auto tmp = std::make_shared< AnalyticCalcPlus<D,T,S> >(*
this,rhs);
167 this->_ptrCalcC = tmp;
171template <
unsigned D,
typename T,
typename S>
174 auto tmp = std::make_shared< AnalyticCalcMinus<D,T,S> >(*
this,rhs);
175 this->_ptrCalcC = tmp;
179template <
unsigned D,
typename T,
typename S>
182 auto tmp = std::make_shared< AnalyticCalcMultiplication<D,T,S> >(*
this,rhs);
183 this->_ptrCalcC = tmp;
187template <
unsigned D,
typename T,
typename S>
190 auto tmp = std::make_shared< AnalyticCalcDivision<D,T,S> >(*
this,rhs);
191 this->_ptrCalcC = tmp;
arithmetic helper class for analytical functors
AnalyticCalcF(FunctorPtr< AnalyticalF< D, T, S > > &&f, FunctorPtr< AnalyticalF< D, T, S > > &&g)
FunctorPtr< AnalyticalF< D, T, S > > _g
bool operator()(T output[], const S input[]) override
has to be implemented for 'every' derived class
FunctorPtr< AnalyticalF< D, T, S > > _f
AnalyticalConst: DD -> XD, where XD is defined by value.size()
AnalyticalF are applications from DD to XD, where X is set by the constructor.
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)
Smart pointer for managing the various ways of passing functors around.
std::string & getName()
read and write access to name
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)