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

Context for the execution of block refinement operators. More...

#include <superLatticeRefinement.h>

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

Public Member Functions

 ConcreteBlockRefinementContextD (ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &cLattice, ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &fLattice, ConcreteBlockD< T, refinement::DATA_DESCRIPTOR< DESCRIPTOR >, PLATFORM > &data)
 
Platform getPlatform () const override
 
void setProcessingContext (ProcessingContext context) override
 
auto & getFineLattice ()
 
auto & getCoarseLattice ()
 
auto & getConcreteData ()
 
BlockRefinementContextD< T, DESCRIPTOR >::DatagetData () override
 Return reference to contextual data.
 
void add (LatticeR< DESCRIPTOR::d > latticeR) override
 Connect the coarse and fine lattice at position latticeR.
 
std::optional< std::size_t > getDataIndex (LatticeR< DESCRIPTOR::d > latticeR) const override
 Return index where contextual data of connection point latticeR is stored.
 
void apply (BlockRefinementOperatorPromise< T, DESCRIPTOR > &&promise) override
 Apply promised algorithm step to the previously added connection points.
 
- Public Member Functions inherited from olb::BlockRefinementContextD< T, DESCRIPTOR >
template<Platform PLATFORM>
auto & asConcrete ()
 

Additional Inherited Members

- Public Types inherited from olb::BlockRefinementContextD< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 
using Data = olb::BlockD<T,refinement::DATA_DESCRIPTOR<DESCRIPTOR>>
 

Detailed Description

template<typename T, typename DESCRIPTOR, Platform PLATFORM>
class olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >

Context for the execution of block refinement operators.

Definition at line 36 of file superLatticeRefinement.h.

Constructor & Destructor Documentation

◆ ConcreteBlockRefinementContextD()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::ConcreteBlockRefinementContextD ( ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > & cLattice,
ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > & fLattice,
ConcreteBlockD< T, refinement::DATA_DESCRIPTOR< DESCRIPTOR >, PLATFORM > & data )
inline

Definition at line 64 of file superLatticeRefinement.h.

67 : _data{data}
68 , _dataIndex{}
69 , _dataIndexChanged{true}
70 , _cLattice{cLattice}
71 , _fLattice{fLattice}
72 {
73 auto size = _data.getCore();
74 size[0] = 0;
75 for (unsigned iD=1; iD < DESCRIPTOR::d; ++iD) {
76 size[iD] = 1;
77 }
78 _data.resize(size);
79 }

References olb::BlockStructureD< D >::getCore(), and olb::ConcreteBlockD< T, DESCRIPTOR, PLATFORM >::resize().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
void olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::add ( LatticeR< DESCRIPTOR::d > latticeR)
inlineoverridevirtual

Connect the coarse and fine lattice at position latticeR.

Implements olb::BlockRefinementContextD< T, DESCRIPTOR >.

Definition at line 105 of file superLatticeRefinement.h.

105 {
106 CellID iCell = _fLattice.getCellId(latticeR);
107 if (_dataIndex.find(iCell) == _dataIndex.end()) {
108 _dataIndexChanged = true;
109 _dataIndex[iCell] = _data.getNcells();
110
111 auto size = _data.getCore();
112 size[0] += 1;
113 _data.resize(size);
114
115 _data.template getField<fields::refinement::CELL_ID_FINE>().set(_dataIndex[iCell], iCell);
116
117 bool coIncident = true;
118 for (unsigned iD=0; iD < DESCRIPTOR::d; ++iD) {
119 coIncident &= latticeR[iD] % 2 == 0;
120 }
121 if (coIncident) {
122 _data.template getField<fields::refinement::CELL_ID_COARSE>().set(
123 _dataIndex[iCell], _cLattice.getCellId(latticeR / 2));
124 } else {
125 _data.template getField<fields::refinement::CELL_ID_COARSE>().set(_dataIndex[iCell], 0);
126 }
127 }
128 }
std::uint32_t CellID
Type for sequential block-local cell indices.

References olb::BlockStructureD< D >::getCellId(), olb::BlockStructureD< D >::getCore(), olb::BlockStructureD< D >::getNcells(), and olb::ConcreteBlockD< T, DESCRIPTOR, PLATFORM >::resize().

+ Here is the call graph for this function:

◆ apply()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
void olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::apply ( BlockRefinementOperatorPromise< T, DESCRIPTOR > && promise)
inlineoverridevirtual

Apply promised algorithm step to the previously added connection points.

Scope of operator must match scope of context

Implements olb::BlockRefinementContextD< T, DESCRIPTOR >.

Definition at line 139 of file superLatticeRefinement.h.

139 {
140 if (_dataIndexChanged && promise.requiresContextNeighborAccess()) {
141 updateContextNeighborIndices();
142 _data.template getField<fields::refinement::CONTEXT_NEIGHBORS>()
143 .setProcessingContext(ProcessingContext::Simulation);
144 _dataIndexChanged = false;
145 }
146 promise.apply(*this);
147 }
@ Simulation
Data available on host for e.g. functor evaluation.

References olb::ConcreteBlockD< T, DESCRIPTOR, PLATFORM >::setProcessingContext(), and olb::Simulation.

+ Here is the call graph for this function:

◆ getCoarseLattice()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
auto & olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::getCoarseLattice ( )
inline

Definition at line 93 of file superLatticeRefinement.h.

93 {
94 return _cLattice;
95 }
+ Here is the caller graph for this function:

◆ getConcreteData()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
auto & olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::getConcreteData ( )
inline

Definition at line 97 of file superLatticeRefinement.h.

97 {
98 return _data;
99 }
+ Here is the caller graph for this function:

◆ getData()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
BlockRefinementContextD< T, DESCRIPTOR >::Data & olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::getData ( )
inlineoverridevirtual

Return reference to contextual data.

Implements olb::BlockRefinementContextD< T, DESCRIPTOR >.

Definition at line 101 of file superLatticeRefinement.h.

101 {
102 return _data;
103 }

◆ getDataIndex()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
std::optional< std::size_t > olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::getDataIndex ( LatticeR< DESCRIPTOR::d > latticeR) const
inlineoverridevirtual

Return index where contextual data of connection point latticeR is stored.

Implements olb::BlockRefinementContextD< T, DESCRIPTOR >.

Definition at line 130 of file superLatticeRefinement.h.

130 {
131 auto iter = _dataIndex.find(_fLattice.getCellId(latticeR));
132 if (iter != _dataIndex.end()) {
133 return std::get<1>(*iter);
134 } else {
135 return std::nullopt;
136 }
137 }

References olb::BlockStructureD< D >::getCellId().

+ Here is the call graph for this function:

◆ getFineLattice()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
auto & olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::getFineLattice ( )
inline

Definition at line 89 of file superLatticeRefinement.h.

89 {
90 return _fLattice;
91 }
+ Here is the caller graph for this function:

◆ getPlatform()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
Platform olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::getPlatform ( ) const
inlineoverridevirtual

Implements olb::BlockRefinementContextD< T, DESCRIPTOR >.

Definition at line 81 of file superLatticeRefinement.h.

81 {
82 return PLATFORM;
83 }

◆ setProcessingContext()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
void olb::ConcreteBlockRefinementContextD< T, DESCRIPTOR, PLATFORM >::setProcessingContext ( ProcessingContext context)
inlineoverridevirtual

Implements olb::BlockRefinementContextD< T, DESCRIPTOR >.

Definition at line 85 of file superLatticeRefinement.h.

85 {
86 _data.setProcessingContext(context);
87 }

References olb::ConcreteBlockD< T, DESCRIPTOR, PLATFORM >::setProcessingContext().

+ Here is the call graph for this function:

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