OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS > Class Template Reference

#include <derivativeF.h>

+ Inheritance diagram for olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >:
+ Collaboration diagram for olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >:

Public Types

using SAD = util::ADf<S,sourceDIM>
 
using TAD = util::ADf<T,sourceDIM>
 
- Public Types inherited from olb::AnalyticalF< sourceDIM, T, S >
using identity_functor_type
 
- Public Types inherited from olb::GenericF< T, S >
using targetType = T
 
using sourceType = S
 

Public Member Functions

 AnalyticalDerivativeAD (unsigned targetDIM, ARGS &&... args)
 
 AnalyticalDerivativeAD (const F &f)
 
bool operator() (T output[], const S input[]) override
 Computes the partial derivatives of _f and writes them into output.
 
- Public Member Functions inherited from olb::AnalyticalF< sourceDIM, T, S >
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)
 
- 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
 
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 Attributes

F::template exchange_type< TAD, SAD_f
 

Additional Inherited Members

- 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< sourceDIM, T, S >
static constexpr unsigned dim
 
- Protected Member Functions inherited from olb::AnalyticalF< sourceDIM, T, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

template<class F, typename T, typename S, unsigned sourceDIM, typename... ARGS>
class olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >

Definition at line 106 of file derivativeF.h.

Member Typedef Documentation

◆ SAD

template<class F , typename T , typename S , unsigned sourceDIM, typename... ARGS>
using olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::SAD = util::ADf<S,sourceDIM>

Definition at line 109 of file derivativeF.h.

◆ TAD

template<class F , typename T , typename S , unsigned sourceDIM, typename... ARGS>
using olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::TAD = util::ADf<T,sourceDIM>

Definition at line 110 of file derivativeF.h.

Constructor & Destructor Documentation

◆ AnalyticalDerivativeAD() [1/2]

template<class F , typename T , typename S , unsigned sourceDIM, typename... ARGS>
olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::AnalyticalDerivativeAD ( unsigned targetDIM,
ARGS &&... args )
inlineexplicit

Definition at line 116 of file derivativeF.h.

117 : AnalyticalF<sourceDIM,T,S>(targetDIM*sourceDIM), _f(args...) { }
F::template exchange_type< TAD, SAD > _f

◆ AnalyticalDerivativeAD() [2/2]

template<class F , typename T , typename S , unsigned sourceDIM, typename... ARGS>
olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::AnalyticalDerivativeAD ( const F & f)
inlineexplicit

Definition at line 119 of file derivativeF.h.

120 : AnalyticalF<sourceDIM,T,S>(f.getTargetDim()*sourceDIM),
121 _f(f.template copyAs<TAD,SAD>()) { }

Member Function Documentation

◆ operator()()

template<class F , typename T , typename S , unsigned sourceDIM, typename... ARGS>
bool olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::operator() ( T output[],
const S input[] )
inlineoverridevirtual

Computes the partial derivatives of _f and writes them into output.

Returns
output[j*sourceDIM+i] = d/dx_i F_j --> output is an arithmetic array of length targetDIM*sourceDIM

Implements olb::GenericF< T, S >.

Definition at line 127 of file derivativeF.h.

127 {
128 SAD inputAD[sourceDIM];
129 util::copyN(inputAD, input, sourceDIM);
130 util::iniDiagonal(inputAD, sourceDIM);
131 TAD outputAD[_f.getTargetDim()];
132
133 _f(outputAD, inputAD);
134
135 util::copyDerivatives(output, outputAD, _f.getTargetDim());
136
137 return true;
138 }
util::ADf< S, sourceDIM > SAD
util::ADf< T, sourceDIM > TAD
void copyDerivatives(T *target, const TAD *source, int length)
Copy the derivatives from an ADf array into an array.
Definition adHelpers.h:61
void copyN(T c[], const T a[], const unsigned dim) any_platform
void iniDiagonal(SAD *a, int dim)
The variables of an array are set to be the differential variables.
Definition adHelpers.h:42

References olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::_f, olb::util::copyDerivatives(), olb::util::copyN(), and olb::util::iniDiagonal().

+ Here is the call graph for this function:

Member Data Documentation

◆ _f

template<class F , typename T , typename S , unsigned sourceDIM, typename... ARGS>
F::template exchange_type<TAD,SAD> olb::AnalyticalDerivativeAD< F, T, S, sourceDIM, ARGS >::_f
protected

Definition at line 113 of file derivativeF.h.


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