OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::BlockLatticeFfromCallableF< T, DESCRIPTOR > Class Template Referencefinal

Generate a BlockLatticeF from an arbitrary function. More...

#include <blockBaseF3D.h>

+ Inheritance diagram for olb::BlockLatticeFfromCallableF< T, DESCRIPTOR >:
+ Collaboration diagram for olb::BlockLatticeFfromCallableF< T, DESCRIPTOR >:

Public Member Functions

template<typename F >
 BlockLatticeFfromCallableF (BlockLattice< T, DESCRIPTOR > &blockLattice, unsigned iC, F &&f)
 Generate a BlockLatticeF from an arbitrary function.
 
bool operator() (T output[], const int input[]) override
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::BlockLatticeFfromCallableF< T, DESCRIPTOR >

Generate a BlockLatticeF from an arbitrary function.

Template Parameters
Tfloating point type

Definition at line 216 of file blockBaseF3D.h.

Constructor & Destructor Documentation

◆ BlockLatticeFfromCallableF()

template<typename T , typename DESCRIPTOR >
template<typename F >
olb::BlockLatticeFfromCallableF< T, DESCRIPTOR >::BlockLatticeFfromCallableF ( BlockLattice< T, DESCRIPTOR > & blockLattice,
unsigned iC,
F && f )
inline

Generate a BlockLatticeF from an arbitrary function.

Template Parameters
Ffunction type
Parameters
iClocal cuboid number
fsome function, e.g. lambda expression The following types of f are accepted: void(T* output, auto cell) void(T* output, auto cell, int iC, const int* localCoordinates) void(T* output, int iC, const int* localCoordinates)

Definition at line 234 of file blockBaseF3D.h.

235 : BlockLatticeF<T,DESCRIPTOR>(blockLattice, 1), _iC(iC),
236 _f([&,f](T* output, const int* input) -> bool {
237 auto cell = blockLattice.get(input);
238 if constexpr (std::is_invocable_v<F, T*, decltype(cell)>) {
239 f(output, cell);
240 } else if constexpr (std::is_invocable_v<F, T*, decltype(cell), int, const int*>) {
241 f(output, cell, _iC, input);
242 } else {
243 f(output, _iC, input);
244 }
245 return true;
246 })
247 { }
std::conditional_t< DESCRIPTOR::d==2, BlockLatticeF2D< T, DESCRIPTOR >, BlockLatticeF3D< T, DESCRIPTOR > > BlockLatticeF
Definition aliases.h:147

Member Function Documentation

◆ operator()()

template<typename T , typename DESCRIPTOR >
bool olb::BlockLatticeFfromCallableF< T, DESCRIPTOR >::operator() ( T output[],
const int input[] )
inlineoverride

Definition at line 249 of file blockBaseF3D.h.

249 {
250 return _f(output, input);
251 }

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