OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS > Class Template Referencefinal

Application of the collision step on a concrete SISD block. More...

#include <operator.h>

+ Inheritance diagram for olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >:
+ Collaboration diagram for olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >:

Public Member Functions

 ConcreteBlockCollisionO ()
 
std::type_index id () const override
 
std::size_t weight () const override
 Returns number of assigned cells.
 
void set (CellID iCell, bool state, bool overlap) override
 Set whether iCell is covered by the present collision step.
 
Dynamics< T, DESCRIPTOR > * getDynamics () override
 
void setup (ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SISD > &block) override
 
void apply (ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SISD > &block, ConcreteBlockMask< T, Platform::CPU_SISD > &subdomain, CollisionDispatchStrategy strategy) override
 Apply collision on subdomain of block.
 
- Public Member Functions inherited from olb::BlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD >
virtual void setup (ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &block)=0
 Setup collision on block.
 
virtual void apply (ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM > &block, ConcreteBlockMask< T, PLATFORM > &subdomain, CollisionDispatchStrategy strategy)=0
 Apply collision on subdomain of block using strategy.
 
- Public Member Functions inherited from olb::AbstractBlockO
virtual ~AbstractBlockO ()=default
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename DYNAMICS>
class olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >

Application of the collision step on a concrete SISD block.

ConcreteBlockCollisionO::apply allows for applying DYNAMICS on a given cell index or an entire block. The latter option accepts a ConcreteBlockMask instance describing the subset of cells for which DYNAMICS is to be called directly instead of via roundtrip.

Definition at line 125 of file operator.h.

Constructor & Destructor Documentation

◆ ConcreteBlockCollisionO()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::ConcreteBlockCollisionO ( )
inline

Definition at line 227 of file operator.h.

227 :
228 _dynamics(new DYNAMICS()),
229 _parameters(nullptr),
230 _mask(nullptr),
231 _cells(0),
232 _modified(true)
233 { }

Member Function Documentation

◆ apply()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
void olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::apply ( ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SISD > & block,
ConcreteBlockMask< T, Platform::CPU_SISD > & subdomain,
CollisionDispatchStrategy strategy )
inlineoverride

Apply collision on subdomain of block.

This assumes that subdomain is the core mask of BlockDynamicsMap.

Definition at line 281 of file operator.h.

284 {
285 switch (strategy) {
287 return applyDominant(block, subdomain);
289 return applyIndividual(block, subdomain);
290 default:
291 throw std::runtime_error("Invalid collision dispatch strategy");
292 }
293 }
@ Individual
Apply all dynamics individually (async for Platform::GPU_CUDA)
@ Dominant
Apply dominant dynamics using mask and fallback to virtual dispatch for others.

References olb::Dominant, and olb::Individual.

◆ getDynamics()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
Dynamics< T, DESCRIPTOR > * olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::getDynamics ( )
inlineoverridevirtual

Implements olb::AbstractCollisionO< T, DESCRIPTOR >.

Definition at line 259 of file operator.h.

260 {
261 return _dynamics.get();
262 }

◆ id()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
std::type_index olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::id ( ) const
inlineoverridevirtual

Implements olb::AbstractBlockO.

Definition at line 235 of file operator.h.

236 {
237 return typeid(DYNAMICS);
238 }

◆ set()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
void olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::set ( CellID iCell,
bool state,
bool overlap )
inlineoverridevirtual

Set whether iCell is covered by the present collision step.

Parameters
iCellCell index
state(De)activate for this dynamics / collision
overlapCell index in overlap (set dynamics but do not collide)

Only unmask cells that actually do something

Implements olb::AbstractCollisionO< T, DESCRIPTOR >.

Definition at line 245 of file operator.h.

246 {
248 if constexpr (!std::is_same_v<DYNAMICS,NoDynamics<T,DESCRIPTOR>>) {
249 if (!overlap) {
250 _mask->set(iCell, state);
251 }
252 }
253 if (state) {
254 _dynamicsOfCells[iCell] = _concreteDynamics.get();
255 }
256 _modified = true;
257 }
void set(std::size_t i, bool active)
Definition mask.h:47

◆ setup()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
void olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::setup ( ConcreteBlockLattice< T, DESCRIPTOR, Platform::CPU_SISD > & block)
inlineoverride

Definition at line 264 of file operator.h.

265 {
266 _parameters = &block.template getData<OperatorParameters<DYNAMICS>>().parameters;
267 _mask = &block.template getData<DynamicsMask<DYNAMICS>>();
268 if constexpr (dynamics::has_parametrized_momenta_v<DYNAMICS>) {
269 _dynamics->setMomentaParameters(_parameters);
270 }
271
272 _concreteDynamics.reset(new cpu::sisd::ConcreteDynamics<T,DESCRIPTOR,DYNAMICS>(_parameters));
273 // Fetch pointer to concretized dynamic-dispatch field
274 _dynamicsOfCells = block.template getField<cpu::DYNAMICS<T,DESCRIPTOR,Platform::CPU_SISD>>()[0].data();
275 }

◆ weight()

template<typename T , typename DESCRIPTOR , typename DYNAMICS >
std::size_t olb::ConcreteBlockCollisionO< T, DESCRIPTOR, Platform::CPU_SISD, DYNAMICS >::weight ( ) const
inlineoverridevirtual

Returns number of assigned cells.

Used to determine the dominant dynamics to choose e.g. which collision operator to vectorize or to prefer in GPU kernels.

Implements olb::AbstractCollisionO< T, DESCRIPTOR >.

Definition at line 240 of file operator.h.

241 {
242 return _mask->weight();
243 }

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