OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Attributes | List of all members
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
 
- 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< 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 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< 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, 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< T, 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 262 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 265 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 264 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 276 of file analyticalF.h.

277 : AnalyticalF<D,U,S>((ComponentWise) ? f.getTargetDim() : targetDim),
278 _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) g )
inline

concatenate functor f and some function g.

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

Definition at line 283 of file analyticalF.h.

284 : AnalyticalF<D,U,S>(f.getTargetDim()), _f(f), _g(g) {
285 static_assert(ComponentWise);
286 static_assert(! std::is_pointer_v<U>);
287 }

◆ 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 *) g,
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 294 of file analyticalF.h.

296 : AnalyticalF<D,U,S>(targetDim),
297 _f(f), _g(g) {
298 static_assert(! ComponentWise);
299 }

◆ 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 *) g,
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 306 of file analyticalF.h.

308 : AnalyticalF<D,U,S>(targetDim),
309 _f(f), _g(g) {
310 static_assert(! ComponentWise);
311 }

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 x[] )
inlineoverride

Definition at line 313 of file analyticalF.h.

313 {
314 T outputTmp[_f.getTargetDim()];
315 _f(outputTmp, x);
316 if constexpr (ComponentWise) {
317 for (int i = 0; i < _f.getTargetDim(); ++i) {
318 output[i] = _g(outputTmp[i]);
319 }
320 } else { // g works on the vector
321 if constexpr (ReturnArray) {
322 for (int i = 0; i < this->getTargetDim(); ++i) {
323 const auto* outputTmp2 = _g(outputTmp);
324 output[i] = outputTmp2[i];
325 }
326 } else { // g returns value
327 output[0] = _g(outputTmp);
328 }
329 }
330 return true;
331 }
int getTargetDim() const
read only access to member variable _n
Definition genericF.hh:45

References olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::_f, olb::AnalyticalConcatenation< D, U, T, S, ComponentWise, ReturnArray >::_g, and 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 268 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 269 of file analyticalF.h.


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