OpenLB 1.8.1
Loading...
Searching...
No Matches
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::AbstractCollisionO< T, DESCRIPTOR >
- 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 267 of file operator.h.

267 :
268 _dynamics(new DYNAMICS()),
269 _parameters(nullptr),
270 _mask(nullptr),
271 _cells(0),
272 _modified(true)
273 { }

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 321 of file operator.h.

324 {
325 switch (strategy) {
327 return applyDominant(block, subdomain);
329 return applyIndividual(block, subdomain);
330 default:
331 throw std::runtime_error("Invalid collision dispatch strategy");
332 }
333 }
@ 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 299 of file operator.h.

300 {
301 return _dynamics.get();
302 }

◆ 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 275 of file operator.h.

276 {
277 return typeid(DYNAMICS);
278 }

◆ 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 285 of file operator.h.

286 {
288 //if constexpr (!std::is_same_v<DYNAMICS,NoDynamics<T,DESCRIPTOR>>) {
289 if (!overlap) {
290 _mask->set(iCell, state);
291 }
292 //}
293 if (state) {
294 _dynamicsOfCells[iCell] = _concreteDynamics.get();
295 }
296 _modified = true;
297 }
void set(std::size_t i, bool active)
Definition mask.h:51

◆ 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 304 of file operator.h.

305 {
306 _parameters = &block.template getData<OperatorParameters<DYNAMICS>>().parameters;
307 _mask = &block.template getData<DynamicsMask<DYNAMICS>>();
308 if constexpr (dynamics::has_parametrized_momenta_v<DYNAMICS>) {
309 _dynamics->setMomentaParameters(_parameters);
310 }
311
312 _concreteDynamics.reset(new cpu::sisd::ConcreteDynamics<T,DESCRIPTOR,DYNAMICS>(_parameters));
313 // Fetch pointer to concretized dynamic-dispatch field
314 _dynamicsOfCells = block.template getField<cpu::DYNAMICS<T,DESCRIPTOR,Platform::CPU_SISD>>()[0].data();
315 }

◆ 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 280 of file operator.h.

281 {
282 return _mask->weight();
283 }

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