OpenLB 1.7
Loading...
Searching...
No Matches
olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray > Class Template Reference

#include <analyticalF.h>

+ Inheritance diagram for olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >:
+ Collaboration diagram for olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >:

Public Member Functions

template<typename G >
 AnalyticalConcatenation (AnalyticalF< D, T, S > &f, G g, unsigned targetDim=1)
 concatenate functor f and some lambda expression g.
 
 AnalyticalConcatenation (AnalyticalF< D, T, S > &f, U(*g)(T))
 concatenate functor f and some function g.
 
template<typename wrapped_U >
 AnalyticalConcatenation (AnalyticalF< D, T, S > &f, wrapped_U(*g)(T *), unsigned targetDim=1)
 concatenate functor f and some function g.
 
template<typename wrapped_U >
 AnalyticalConcatenation (AnalyticalF< D, T, S > &f, wrapped_U(*g)(const T *), unsigned targetDim=1)
 concatenate functor f and some function g.
 
bool operator() (U output[], const S x[]) override
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::AnalyticalF< D, U, S >
AnalyticalF< D, U, S > & operator- (AnalyticalF< D, U, S > &rhs)
 
AnalyticalF< D, U, S > & operator+ (AnalyticalF< D, U, S > &rhs)
 
AnalyticalF< D, U, S > & operator* (AnalyticalF< D, U, S > &rhs)
 
AnalyticalF< D, U, S > & operator/ (AnalyticalF< D, U, S > &rhs)
 
- Public Member Functions inherited from olb::GenericF< U, 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
 
bool operator() (U output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (U output[], S input0)
 
bool operator() (U output[], S input0, S input1)
 
bool operator() (U output[], S input0, S input1, S input2)
 
bool operator() (U output[], S input0, S input1, S input2, S input3)
 

Protected Types

using return_type_g = std::conditional_t<ReturnArray,U*,U>
 
using function_t
 

Protected Attributes

AnalyticalF< D, T, S > & _f
 
function_t _g
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< D, U, S >
using identity_functor_type
 
- Public Types inherited from olb::GenericF< U, S >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< U, S >
std::shared_ptr< GenericF< U, S > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Static Public Attributes inherited from olb::AnalyticalF< D, U, S >
static constexpr unsigned dim
 
- Protected Member Functions inherited from olb::AnalyticalF< D, U, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< U, S >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

template<unsigned D, typename U, typename T, typename S, bool ComponentWise, bool ReturnArray>
class olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >

Definition at line 285 of file analyticalF.h.

Member Typedef Documentation

◆ function_t

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
using olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::function_t
protected
Initial value:
std::conditional_t<ComponentWise,
std::function<return_type_g(T)>, std::function<return_type_g(T*)>>
std::conditional_t< ReturnArray, U *, U > return_type_g

Definition at line 288 of file analyticalF.h.

◆ return_type_g

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
using olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::return_type_g = std::conditional_t<ReturnArray,U*,U>
protected

Definition at line 287 of file analyticalF.h.

Constructor & Destructor Documentation

◆ AnalyticalConcatenation() [1/4]

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
template<typename G >
olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::AnalyticalConcatenation ( AnalyticalF< D, T, S > & f,
G g,
unsigned targetDim = 1 )
inline

concatenate functor f and some lambda expression g.

targetDim needs to be specified if g is vector (array)-valued

Definition at line 299 of file analyticalF.h.

300 : AnalyticalF<D,U,S>((ComponentWise) ? f.getTargetDim() : targetDim),
301 _f(f), _g(g) { }
AnalyticalF< D, T, S > & _f

◆ AnalyticalConcatenation() [2/4]

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::AnalyticalConcatenation ( AnalyticalF< D, T, S > & f,
U(* )(T) )
inline

concatenate functor f and some function g.

g maps value to value (no pointer) and is applied component-wise

Definition at line 306 of file analyticalF.h.

307 : AnalyticalF<D,U,S>(f.getTargetDim()), _f(f), _g(g) {
308 static_assert(ComponentWise);
309 static_assert(! std::is_pointer_v<U>);
310 }

◆ AnalyticalConcatenation() [3/4]

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
template<typename wrapped_U >
olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::AnalyticalConcatenation ( AnalyticalF< D, T, S > & f,
wrapped_U(* )(T *),
unsigned targetDim = 1 )
inline

concatenate functor f and some function g.

targetDim needs to be specified if g is vector (array)-valued

Definition at line 317 of file analyticalF.h.

319 : AnalyticalF<D,U,S>(targetDim),
320 _f(f), _g(g) {
321 static_assert(! ComponentWise);
322 }

◆ AnalyticalConcatenation() [4/4]

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
template<typename wrapped_U >
olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::AnalyticalConcatenation ( AnalyticalF< D, T, S > & f,
wrapped_U(* )(const T *),
unsigned targetDim = 1 )
inline

concatenate functor f and some function g.

targetDim needs to be specified if g is vector (array)-valued

Definition at line 329 of file analyticalF.h.

331 : AnalyticalF<D,U,S>(targetDim),
332 _f(f), _g(g) {
333 static_assert(! ComponentWise);
334 }

Member Function Documentation

◆ operator()()

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
bool olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::operator() ( U output[],
const S input[] )
inlineoverridevirtual

has to be implemented for 'every' derived class

Implements olb::GenericF< U, S >.

Definition at line 336 of file analyticalF.h.

336 {
337 T outputTmp[_f.getTargetDim()];
338 _f(outputTmp, x);
339 if constexpr (ComponentWise) {
340 for (int i = 0; i < _f.getTargetDim(); ++i) {
341 output[i] = _g(outputTmp[i]);
342 }
343 } else { // g works on the vector
344 if constexpr (ReturnArray) {
345 for (int i = 0; i < this->getTargetDim(); ++i) {
346 const auto* outputTmp2 = _g(outputTmp);
347 output[i] = outputTmp2[i];
348 }
349 } else { // g returns value
350 output[0] = _g(outputTmp);
351 }
352 }
353 return true;
354 }
int getTargetDim() const
Definition genericF.hh:45

References olb::GenericF< T, S >::getTargetDim().

+ Here is the call graph for this function:

Member Data Documentation

◆ _f

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
AnalyticalF<D,T,S>& olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::_f
protected

Definition at line 291 of file analyticalF.h.

◆ _g

template<unsigned D, typename U , typename T , typename S , bool ComponentWise, bool ReturnArray>
function_t olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::_g
protected

Definition at line 292 of file analyticalF.h.


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