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

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

#include <blockPostProcessorMap.h>

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

Public Member Functions

template<typename OPERATOR >
 PostProcessorPromise (meta::id< OPERATOR > id=meta::id< OPERATOR >{})
 
std::type_index id () const
 Returns type index of the promised OPERATOR.
 
std::string name () const
 
int priority () const
 
OperatorScope scope () const
 
std::set< FieldTypePromise< T, DESCRIPTOR > > accessedFields () const
 
bool hasOptimizedVersion () const
 
std::optional< std::size_t > getArithmeticOperationCount () const
 
std::optional< bool > isOptimizable () const
 
bool operator< (const PostProcessorPromise< T, DESCRIPTOR > &rhs) const
 
template<Platform PLATFORM>
BlockO< T, DESCRIPTOR, PLATFORM > * realize ()
 

Protected Attributes

const std::type_index _id
 
const int _priority
 
const OperatorScope _scope
 
const std::string _name
 
std::function< AbstractBlockO *(Platform)> _constructor
 
std::function< std::set< FieldTypePromise< T, DESCRIPTOR > >()> _accessedFields
 Returns the set of all accessed fields.
 
const bool _isOptimizationAvailable
 
std::function< std::optional< std::size_t >()> _inspectArithmeticOperationCount
 
std::function< std::optional< bool >()> _inspectOptimizability
 

Detailed Description

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

Factory for instances of a specific OPERATOR type.

Factory callable for ConcreteBlockO<OPERATOR> 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 61 of file blockPostProcessorMap.h.

Constructor & Destructor Documentation

◆ PostProcessorPromise()

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

Definition at line 78 of file blockPostProcessorMap.h.

78 {}):
79 _id(typeid(OPERATOR)),
80 _priority(OPERATOR().getPriority()),
82 _name{fields::name<OPERATOR>()},
83 _constructor([](Platform platform) -> AbstractBlockO* {
84 if constexpr (operators::is_cse_optimized<OPERATOR,DESCRIPTOR>::value) {
86 } else {
88 }
89 }),
90 _accessedFields([]() -> std::set<FieldTypePromise<T,DESCRIPTOR>> {
91 if constexpr (!std::is_same_v<T,Expr>) {
93 } else {
94 throw std::domain_error("Can not introspect the introspection");
95 }
96 }),
97 _isOptimizationAvailable{operators::is_cse_optimized<OPERATOR,DESCRIPTOR>::value},
98 _inspectArithmeticOperationCount([]() -> std::optional<std::size_t> {
99#ifdef FEATURE_INSPECT_POST_PROCESSORS
100 if constexpr (!std::is_same_v<T,Expr>) {
101 if constexpr (operators::is_cse_optimized<OPERATOR,DESCRIPTOR>::value) {
103 } else {
105 }
106 } else {
107 throw std::domain_error("Can not introspect the introspection - we, sadly, are not in LISP land.");
108 }
109#endif // FEATURE_INSPECT_POST_PROCESSORS
110 return std::nullopt;
111 }),
112 _inspectOptimizability([]() -> std::optional<bool> {
113#ifdef FEATURE_INSPECT_POST_PROCESSORS
114 if constexpr (!std::is_same_v<T,Expr>) {
116 } else {
117 return false;
118 }
119#else
120 return std::nullopt;
121#endif // FEATURE_INSPECT_POST_PROCESSORS
122 })
123 { }
#define OPERATOR(OP, rhs)
Definition aDiffTape.h:64
std::function< std::optional< bool >()> _inspectOptimizability
std::function< AbstractBlockO *(Platform)> _constructor
std::function< std::set< FieldTypePromise< T, DESCRIPTOR > >()> _accessedFields
Returns the set of all accessed fields.
std::function< std::optional< std::size_t >()> _inspectArithmeticOperationCount
std::optional< std::size_t > getArithmeticOperationCount()
std::set< FieldTypePromise< T, DESCRIPTOR > > getFieldsAccessedByOperator()
Platform
OpenLB execution targets.
Definition platform.h:35
CONCRETIZABLE::base_t * constructUsingConcretePlatform(Platform platform, ARGS &&... args)
Definition dispatch.h:107

Member Function Documentation

◆ accessedFields()

template<typename T , typename DESCRIPTOR >
std::set< FieldTypePromise< T, DESCRIPTOR > > olb::PostProcessorPromise< T, DESCRIPTOR >::accessedFields ( ) const
inline

Definition at line 142 of file blockPostProcessorMap.h.

142 {
143 return _accessedFields();
144 }

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

◆ getArithmeticOperationCount()

template<typename T , typename DESCRIPTOR >
std::optional< std::size_t > olb::PostProcessorPromise< T, DESCRIPTOR >::getArithmeticOperationCount ( ) const
inline

◆ hasOptimizedVersion()

template<typename T , typename DESCRIPTOR >
bool olb::PostProcessorPromise< T, DESCRIPTOR >::hasOptimizedVersion ( ) const
inline

◆ id()

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

Returns type index of the promised OPERATOR.

Definition at line 126 of file blockPostProcessorMap.h.

126 {
127 return _id;
128 }

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

+ Here is the caller graph for this function:

◆ isOptimizable()

template<typename T , typename DESCRIPTOR >
std::optional< bool > olb::PostProcessorPromise< T, DESCRIPTOR >::isOptimizable ( ) const
inline

◆ name()

template<typename T , typename DESCRIPTOR >
std::string olb::PostProcessorPromise< T, DESCRIPTOR >::name ( ) const
inline

Definition at line 130 of file blockPostProcessorMap.h.

130 {
131 return _name;
132 }

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

◆ operator<()

template<typename T , typename DESCRIPTOR >
bool olb::PostProcessorPromise< T, DESCRIPTOR >::operator< ( const PostProcessorPromise< T, DESCRIPTOR > & rhs) const
inline

Definition at line 158 of file blockPostProcessorMap.h.

158 {
159 return id() < rhs.id();
160 }
std::type_index id() const
Returns type index of the promised OPERATOR.

References olb::PostProcessorPromise< T, DESCRIPTOR >::id().

+ Here is the call graph for this function:

◆ priority()

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

Definition at line 134 of file blockPostProcessorMap.h.

134 {
135 return _priority;
136 }

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 163 of file blockPostProcessorMap.h.

163 {
164 return static_cast<BlockO<T,DESCRIPTOR,PLATFORM>*>(
165 _constructor(PLATFORM));
166 };

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

◆ scope()

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

Definition at line 138 of file blockPostProcessorMap.h.

138 {
139 return _scope;
140 }

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

Member Data Documentation

◆ _accessedFields

template<typename T , typename DESCRIPTOR >
std::function<std::set<FieldTypePromise<T,DESCRIPTOR> >()> olb::PostProcessorPromise< T, DESCRIPTOR >::_accessedFields
protected

Returns the set of all accessed fields.

Definition at line 70 of file blockPostProcessorMap.h.

◆ _constructor

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

Definition at line 68 of file blockPostProcessorMap.h.

◆ _id

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

Definition at line 63 of file blockPostProcessorMap.h.

◆ _inspectArithmeticOperationCount

template<typename T , typename DESCRIPTOR >
std::function<std::optional<std::size_t>()> olb::PostProcessorPromise< T, DESCRIPTOR >::_inspectArithmeticOperationCount
protected

Definition at line 73 of file blockPostProcessorMap.h.

◆ _inspectOptimizability

template<typename T , typename DESCRIPTOR >
std::function<std::optional<bool>()> olb::PostProcessorPromise< T, DESCRIPTOR >::_inspectOptimizability
protected

Definition at line 74 of file blockPostProcessorMap.h.

◆ _isOptimizationAvailable

template<typename T , typename DESCRIPTOR >
const bool olb::PostProcessorPromise< T, DESCRIPTOR >::_isOptimizationAvailable
protected

Definition at line 72 of file blockPostProcessorMap.h.

◆ _name

template<typename T , typename DESCRIPTOR >
const std::string olb::PostProcessorPromise< T, DESCRIPTOR >::_name
protected

Definition at line 66 of file blockPostProcessorMap.h.

◆ _priority

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

Definition at line 64 of file blockPostProcessorMap.h.

◆ _scope

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

Definition at line 65 of file blockPostProcessorMap.h.


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