OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
olb::PostProcessorPromise< T, DESCRIPTOR > Class Template Reference

Factory for instances of a specific POST_PROCESSOR type. More...

#include <blockPostProcessorMap.h>

+ Collaboration diagram for olb::PostProcessorPromise< T, DESCRIPTOR >:

Public Member Functions

template<typename POST_PROCESSOR >
 PostProcessorPromise (meta::id< POST_PROCESSOR > id=meta::id< POST_PROCESSOR >{})
 
std::type_index id () const
 Returns type index of the promised POST_PROCESSOR.
 
int priority () const
 
OperatorScope scope () const
 
template<Platform PLATFORM>
BlockO< T, DESCRIPTOR, PLATFORM > * realize ()
 

Protected Attributes

std::type_index _id
 
int _priority
 
OperatorScope _scope
 
std::function< AbstractBlockO *(Platform)> _constructor
 

Detailed Description

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

Factory for instances of a specific POST_PROCESSOR type.

Factory callable for ConcreteBlockO<POST_PROCESSOR> is constructed at PostProcessorPromise construction time. Recipients accepting such promised post processors are not obligated to actually realize this promise.

Analogously to DynamicsPromise, this structure is needed to bridge the gap between high level virtual interfaces and efficient platform-specific implementations with full type knowledge.

Definition at line 48 of file blockPostProcessorMap.h.

Constructor & Destructor Documentation

◆ PostProcessorPromise()

template<typename T , typename DESCRIPTOR >
template<typename POST_PROCESSOR >
olb::PostProcessorPromise< T, DESCRIPTOR >::PostProcessorPromise ( meta::id< POST_PROCESSOR > id = meta::id<POST_PROCESSOR>{})
inline

Definition at line 57 of file blockPostProcessorMap.h.

57 {}):
58 _id(typeid(POST_PROCESSOR)),
59 _priority(POST_PROCESSOR().getPriority()),
60 _scope(POST_PROCESSOR::scope),
61 _constructor([](Platform platform) -> AbstractBlockO* {
62 switch (platform) {
63 #ifdef PLATFORM_CPU_SISD
65 return new ConcreteBlockO<T,DESCRIPTOR,Platform::CPU_SISD,POST_PROCESSOR,POST_PROCESSOR::scope>();
66 #endif
67 #ifdef PLATFORM_CPU_SIMD
69 return new ConcreteBlockO<T,DESCRIPTOR,Platform::CPU_SIMD,POST_PROCESSOR,POST_PROCESSOR::scope>();
70 #endif
71 #ifdef PLATFORM_GPU_CUDA
73 return new ConcreteBlockO<T,DESCRIPTOR,Platform::GPU_CUDA,POST_PROCESSOR,POST_PROCESSOR::scope>();
74 #endif
75 default:
76 throw std::invalid_argument("Invalid PLATFORM");
77 }
78 })
79 { }
std::function< AbstractBlockO *(Platform)> _constructor
Platform
OpenLB execution targets.
Definition platform.h:36
@ CPU_SIMD
Basic scalar CPU.
@ GPU_CUDA
Vector CPU (AVX2 / AVX-512 collision)

Member Function Documentation

◆ id()

template<typename T , typename DESCRIPTOR >
std::type_index olb::PostProcessorPromise< T, DESCRIPTOR >::id ( ) const
inline

Returns type index of the promised POST_PROCESSOR.

Definition at line 82 of file blockPostProcessorMap.h.

82 {
83 return _id;
84 }

References olb::PostProcessorPromise< T, DESCRIPTOR >::_id.

◆ priority()

template<typename T , typename DESCRIPTOR >
int olb::PostProcessorPromise< T, DESCRIPTOR >::priority ( ) const
inline

Definition at line 86 of file blockPostProcessorMap.h.

86 {
87 return _priority;
88 }

References olb::PostProcessorPromise< T, DESCRIPTOR >::_priority.

◆ realize()

template<typename T , typename DESCRIPTOR >
template<Platform PLATFORM>
BlockO< T, DESCRIPTOR, PLATFORM > * olb::PostProcessorPromise< T, DESCRIPTOR >::realize ( )
inline

Definition at line 95 of file blockPostProcessorMap.h.

95 {
96 return static_cast<BlockO<T,DESCRIPTOR,PLATFORM>*>(
97 _constructor(PLATFORM));
98 };

References olb::PostProcessorPromise< T, DESCRIPTOR >::_constructor.

◆ scope()

template<typename T , typename DESCRIPTOR >
OperatorScope olb::PostProcessorPromise< T, DESCRIPTOR >::scope ( ) const
inline

Definition at line 90 of file blockPostProcessorMap.h.

90 {
91 return _scope;
92 }

References olb::PostProcessorPromise< T, DESCRIPTOR >::_scope.

Member Data Documentation

◆ _constructor

template<typename T , typename DESCRIPTOR >
std::function<AbstractBlockO*(Platform)> olb::PostProcessorPromise< T, DESCRIPTOR >::_constructor
protected

Definition at line 53 of file blockPostProcessorMap.h.

◆ _id

template<typename T , typename DESCRIPTOR >
std::type_index olb::PostProcessorPromise< T, DESCRIPTOR >::_id
protected

Definition at line 50 of file blockPostProcessorMap.h.

◆ _priority

template<typename T , typename DESCRIPTOR >
int olb::PostProcessorPromise< T, DESCRIPTOR >::_priority
protected

Definition at line 51 of file blockPostProcessorMap.h.

◆ _scope

template<typename T , typename DESCRIPTOR >
OperatorScope olb::PostProcessorPromise< T, DESCRIPTOR >::_scope
protected

Definition at line 52 of file blockPostProcessorMap.h.


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