OpenLB 1.7
|
Implementation of BlockLattice on a concrete PLATFORM. More...
#include <blockLattice.h>
Public Types | |
using | value_t = T |
using | descriptor_t = DESCRIPTOR |
Public Member Functions | |
ConcreteBlockLattice (Vector< int, DESCRIPTOR::d > size, int padding=0) | |
void | setProcessingContext (ProcessingContext context) override |
Set processing context. | |
template<typename FIELD_TYPE > | |
bool | hasData () const |
template<typename FIELD_TYPE > | |
const auto & | getData () const |
template<typename FIELD_TYPE > | |
auto & | getData () |
template<typename FIELD > | |
const auto & | getField (FIELD field=FIELD()) const |
template<typename FIELD > | |
auto & | getField (FIELD field=FIELD()) |
bool | hasCommunicatable (std::type_index field) const override |
Communicatable & | getCommunicatable (std::type_index field) override |
void | collide () override |
Apply collision step of non-overlap interior. | |
void | stream () override |
Perform propagation step on the whole block. | |
void | setCollisionO (std::function< void(ConcreteBlockLattice &)> &&op) |
Replace default collision logic of BlockDynamicsMap. | |
BlockDynamicsMap< T, DESCRIPTOR, PLATFORM > & | getDynamicsMap () |
Dynamics< T, DESCRIPTOR > * | getDynamics (DynamicsPromise< T, DESCRIPTOR > &&promise) override |
Return pointer to dynamics yielded by promise. | |
Dynamics< T, DESCRIPTOR > * | getDynamics (CellID iCell) override |
Get reference to dynamics of cell by index. | |
void | setDynamics (CellID iCell, DynamicsPromise< T, DESCRIPTOR > &&promise) override |
Set dynamics at iCell to promised dynamics. | |
void | setDynamics (CellID iCell, Dynamics< T, DESCRIPTOR > *dynamics) override |
template<typename FIELD > | |
void | setParameter (FieldD< T, DESCRIPTOR, FIELD > value) |
template<typename PARAMETER , Platform _PLATFORM, typename FIELD > | |
void | setParameter (FieldArrayD< T, DESCRIPTOR, _PLATFORM, FIELD > &fieldArray) |
template<typename PARAMETER , typename FIELD > | |
void | setParameter (AbstractFieldArrayD< T, DESCRIPTOR, FIELD > &abstractFieldArray) |
bool | hasPostProcessor (std::type_index stage, PostProcessorPromise< T, DESCRIPTOR > &&promise) override |
Returns true if stage contains post processor. | |
void | addPostProcessor (std::type_index stage, LatticeR< DESCRIPTOR::d > latticeR, PostProcessorPromise< T, DESCRIPTOR > &&promise) override |
Schedule post processor for application to latticeR in stage. | |
void | addPostProcessor (std::type_index stage, BlockIndicatorF< T, DESCRIPTOR::d > &indicator, PostProcessorPromise< T, DESCRIPTOR > &&promise) override |
Schedule post processor for application to indicated cells in stage. | |
void | addPostProcessor (std::type_index stage, PostProcessorPromise< T, DESCRIPTOR > &&promise) override |
Schedule post processor for application to entire block in stage. | |
void | addPostProcessor (std::type_index stage, PostProcessor< T, DESCRIPTOR > *postProcessor) override |
Schedule legacy post processor for application in stage. | |
void | addPostProcessor (std::type_index stage, const PostProcessorGenerator< T, DESCRIPTOR > &ppGen) override |
Schedule legacy post processor in stage. | |
void | addPostProcessor (std::type_index stage, BlockIndicatorF< T, DESCRIPTOR::d > &indicator, const PostProcessorGenerator< T, DESCRIPTOR > &ppGen) override |
Schedule legacy post processor for application to indicated cells in stage. | |
void | postProcess (std::type_index stage) override |
Execute post processors of stage. | |
Vector< T *, DESCRIPTOR::q > | getPopulationPointers (CellID iCell) override |
Return pointers to population values of cell index iCell. | |
auto & | getDataRegistry () |
Return reference to Data's FieldTypeRegistry. | |
std::size_t | getNblock () const override |
Number of data blocks for the serializable interface. | |
std::size_t | getSerializableSize () const override |
Binary size for the serializer. | |
bool * | getBlock (std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override |
Return a pointer to the memory of the current block and its size for the serializable interface. | |
void | postLoad () override |
Reinit population structure after deserialization. | |
Public Member Functions inherited from olb::BlockLattice< T, DESCRIPTOR > | |
BlockLattice (Vector< int, DESCRIPTOR::d > size, int padding, Platform platform) | |
virtual | ~BlockLattice () |
Platform | getPlatform () const |
Return platform used to process lattice. | |
template<typename FIELD_TYPE > | |
bool | hasData () |
Return whether FIELD_TYPE is available / has been allocated. | |
template<typename FIELD_TYPE > | |
const auto & | getData (FIELD_TYPE field=FIELD_TYPE{}) const |
Return abstract interface for concrete FIELD_TYPE data. | |
template<typename FIELD_TYPE > | |
auto & | getData (FIELD_TYPE field=FIELD_TYPE{}) |
Return abstract interface for concrete FIELD_TYPE data. | |
template<typename FIELD > | |
const auto & | getField (FIELD field=FIELD{}) const |
Return abstract interface for FIELD array. | |
template<typename FIELD > | |
auto & | getField (FIELD field=FIELD{}) |
Return abstract interface for FIELD array. | |
Cell< T, DESCRIPTOR > | get (CellID iCell) |
Get Cell interface for index iCell. | |
ConstCell< T, DESCRIPTOR > | get (CellID iCell) const |
Get ConstCell interface for index iCell. | |
Cell< T, DESCRIPTOR > | get (LatticeR< DESCRIPTOR::d > loc) |
Get Cell interface for location loc. | |
ConstCell< T, DESCRIPTOR > | get (LatticeR< DESCRIPTOR::d > loc) const |
Get ConstCell interface for location loc. | |
template<typename... R> | |
std::enable_if_t< sizeof...(R)==DESCRIPTOR::d, Cell< T, DESCRIPTOR > > | get (R... latticeR) |
Get Cell interface for componentwise location latticeR. | |
template<typename... R> | |
std::enable_if_t< sizeof...(R)==DESCRIPTOR::d, ConstCell< T, DESCRIPTOR > > | get (R... latticeR) const |
Get ConstCell interface for componentwise location latticeR. | |
void | initialize () |
Initialize the lattice cells to become ready for simulation. | |
bool | statisticsEnabled () const |
void | setStatisticsEnabled (bool state) |
template<typename DYNAMICS > | |
Dynamics< T, DESCRIPTOR > * | getDynamics () |
Return pointer to DYNAMICS (legacy) | |
template<typename... R> | |
std::enable_if_t< sizeof...(R)==DESCRIPTOR::d, Dynamics< T, DESCRIPTOR > * > | getDynamics (R... latticeR) |
Return pointer to dynamics assigned to latticeR. | |
void | defineDynamics (LatticeR< DESCRIPTOR::d > latticeR, DynamicsPromise< T, DESCRIPTOR > &&promise) |
Assign promised DYNAMICS to latticeR. | |
template<template< typename, typename > typename DYNAMICS> | |
void | defineDynamics (LatticeR< DESCRIPTOR::d > latticeR) |
Assign DYNAMICS to latticeR. | |
void | defineDynamics (LatticeR< DESCRIPTOR::d > latticeR, Dynamics< T, DESCRIPTOR > *dynamics) |
Assign dynamics to latticeR via pointer (legacy) | |
void | defineDynamics (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, Dynamics< T, DESCRIPTOR > *dynamics) |
Define the dynamics on a domain described by an indicator. | |
template<typename DYNAMICS > | |
void | defineDynamics (BlockIndicatorF< T, DESCRIPTOR::d > &indicator) |
Define DYNAMICS on a domain described by an indicator. | |
void | defineDynamics (Dynamics< T, DESCRIPTOR > *dynamics) |
Define the same dynamics on all cells. | |
template<typename FIELD > | |
void | setParameter (FieldD< T, DESCRIPTOR, FIELD > value) |
Set value of parameter FIELD for any dynamics that provide it. | |
template<typename PARAMETER , typename FIELD > | |
void | setParameter (AbstractFieldArrayD< T, DESCRIPTOR, FIELD > &fieldArray) |
template<typename PARAMETER , Platform PLATFORM, typename FIELD > | |
void | setParameter (FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD > &fieldArray) |
template<typename STAGE = stage::PostStream> | |
void | addPostProcessor (PostProcessor< T, DESCRIPTOR > *postProcessor) |
Schedule legacy post processor for application in STAGE. | |
template<typename STAGE = stage::PostStream> | |
void | addPostProcessor (const PostProcessorGenerator< T, DESCRIPTOR > &ppGen) |
Schedule legacy post processor for application in STAGE. | |
template<typename STAGE = stage::PostStream> | |
void | addPostProcessor (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, const PostProcessorGenerator< T, DESCRIPTOR > &ppGen) |
Schedule legacy post processor for application to indicated cells in STAGE. | |
template<typename STAGE > | |
void | postProcess () |
Execute post processors of STAGE. | |
template<typename FIELD > | |
void | defineField (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &field) |
Define a field on a domain described by an indicator. | |
template<typename FIELD > | |
void | defineField (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, BlockF< T, DESCRIPTOR::d > &field) |
Define a field on a domain described by an indicator. | |
template<typename FIELD > | |
void | defineField (BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, IndicatorF< T, DESCRIPTOR::d > &indicatorF, AnalyticalF< DESCRIPTOR::d, T, T > &field) |
Define a field on a domain described by an analytical indicator. | |
void | defineRho (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &rho) |
Define rho on a domain described by an indicator. | |
void | defineU (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &u) |
Define u on a domain described by an indicator. | |
void | defineRhoU (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &rho, AnalyticalF< DESCRIPTOR::d, T, T > &u) |
Define rho and u on a domain described by an indicator. | |
void | definePopulations (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &Pop) |
Define a population on a domain described by an indicator. | |
void | definePopulations (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, BlockF< T, DESCRIPTOR::d > &Pop) |
void | iniEquilibrium (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &rho, AnalyticalF< DESCRIPTOR::d, T, T > &u) |
Initialize by equilibrium on a domain described by an indicator. | |
void | iniEquilibrium (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &rho, BlockF< T, DESCRIPTOR::d > &u) |
void | iniRegularized (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, AnalyticalF< DESCRIPTOR::d, T, T > &rho, AnalyticalF< DESCRIPTOR::d, T, T > &u, AnalyticalF< DESCRIPTOR::d, T, T > &pi) |
Initialize by non- and equilibrium on a domain described by an indicator. | |
void | stripeOffDensityOffset (T offset) |
Subtract the given offset from all densities. | |
void | addLatticeCoupling (LatticeCouplingGenerator< T, DESCRIPTOR > const &lcGen, std::vector< BlockStructureD< DESCRIPTOR::d > * > partners) |
Add a non-local post-processing step (legacy) | |
void | addLatticeCoupling (BlockIndicatorF< T, DESCRIPTOR::d > &indicator, LatticeCouplingGenerator< T, DESCRIPTOR > const &lcGen, std::vector< BlockStructureD< DESCRIPTOR::d > * > partners) |
void | executeCoupling () |
Execute couplings steps (legacy) | |
LatticeStatistics< T > & | getStatistics () |
Return a handle to the LatticeStatistics object. | |
LatticeStatistics< T > const & | getStatistics () const |
Return a constant handle to the LatticeStatistics object. | |
Public Member Functions inherited from olb::BlockStructureD< D > | |
BlockStructureD (Vector< int, D > size, int padding=0) | |
BlockStructureD () | |
int | getNx () const |
Read only access to block width. | |
int | getNy () const |
Read only access to block height. | |
int | getNz () const |
Read only access to block height. | |
LatticeR< D > | getExtent () const |
int | getPadding () const |
Read only access to padding. | |
std::size_t | getNcells () const |
Get number of cells. | |
CellID | getCellId (LatticeR< D > latticeR) const |
Get 1D cell ID. | |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, CellID > | getCellId (L... latticeR) const |
CellDistance | getNeighborDistance (LatticeR< D > dir) const |
Get 1D neighbor distance. | |
bool | isInside (LatticeR< D > latticeR) const |
Return whether location is valid. | |
bool | isInsideCore (LatticeR< D > latticeR) const |
Return whether location is inside core. | |
bool | isPadding (LatticeR< D > latticeR) const |
Return whether location is valid. | |
template<typename... L> | |
std::enable_if_t< sizeof...(L)==D, bool > | isInside (L... latticeR) const |
CellDistance | getNeighborhoodRadius (LatticeR< D > latticeR) const |
Return maximum valid neighborhood sphere radius w.r.t. latticeR. | |
template<typename F > | |
void | forSpatialLocations (F f) const |
template<typename F > | |
void | forSpatialLocationsParallel (F f) const |
template<typename F > | |
void | forSpatialLocations (LatticeR< D > min, LatticeR< D > max, F f) const |
template<typename F > | |
void | forCoreSpatialLocations (F f) const |
template<typename F > | |
void | forCellIndices (F f) const |
Public Member Functions inherited from olb::Serializable | |
virtual | ~Serializable ()=default |
template<bool includeLogOutputDir = true> | |
bool | save (std::string fileName="", const bool enforceUint=false) |
Save Serializable into file fileName | |
template<bool includeLogOutputDir = true> | |
bool | load (std::string fileName="", const bool enforceUint=false) |
Load Serializable from file fileName | |
bool | save (std::uint8_t *buffer) |
Save Serializable into buffer of length getSerializableSize | |
bool | load (const std::uint8_t *buffer) |
Load Serializable from buffer of length getSerializableSize | |
Static Public Attributes | |
static constexpr Platform | platform = PLATFORM |
Additional Inherited Members | |
Protected Member Functions inherited from olb::Serializable | |
template<typename DataType > | |
void | registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const |
Register primitive data types (int , double , ...) or arrays of those. | |
template<typename DataType > | |
void | registerSerializableOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false) |
Register Serializable object of constant size. | |
template<typename DataType > | |
void | registerSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false) |
Register an array of Serializable objects of constant size. | |
Protected Attributes inherited from olb::BlockLattice< T, DESCRIPTOR > | |
const Platform | _platform |
bool | _statisticsEnabled |
LatticeStatistics< T > * | _statistics |
Protected Attributes inherited from olb::BlockStructureD< D > | |
LatticeR< D > | _core |
LatticeR< D > | _size |
LatticeR< D > | _projection |
int | _padding |
Implementation of BlockLattice on a concrete PLATFORM.
Definition at line 464 of file blockLattice.h.
using olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::descriptor_t = DESCRIPTOR |
Definition at line 485 of file blockLattice.h.
using olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::value_t = T |
Definition at line 484 of file blockLattice.h.
olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::ConcreteBlockLattice | ( | Vector< int, DESCRIPTOR::d > | size, |
int | padding = 0 ) |
Definition at line 416 of file blockLattice.hh.
|
overridevirtual |
Schedule legacy post processor for application to indicated cells in stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 522 of file blockLattice.hh.
|
inlineoverridevirtual |
Schedule post processor for application to indicated cells in stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 625 of file blockLattice.h.
References olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::addPostProcessor(), and olb::BlockStructureD< D >::forCoreSpatialLocations().
|
overridevirtual |
Schedule legacy post processor in stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 515 of file blockLattice.hh.
|
inlineoverridevirtual |
Schedule post processor for application to latticeR in stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 614 of file blockLattice.h.
References olb::BlockStructureD< D >::isPadding().
|
overridevirtual |
Schedule legacy post processor for application in stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 507 of file blockLattice.hh.
|
inlineoverridevirtual |
Schedule post processor for application to entire block in stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 636 of file blockLattice.h.
References olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::addPostProcessor(), olb::BlockStructureD< D >::forCoreSpatialLocations(), and olb::PerBlock.
|
overridevirtual |
Apply collision step of non-overlap interior.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 293 of file blockLattice.hh.
References olb::Dominant, olb::Individual, and olb::isPlatformCPU().
|
overridevirtual |
Return a pointer to the memory of the current block and its size for the serializable interface.
Implements olb::Serializable.
Definition at line 559 of file blockLattice.hh.
|
inlineoverridevirtual |
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 518 of file blockLattice.h.
auto & olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::getData | ( | ) |
Definition at line 458 of file blockLattice.hh.
const auto & olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::getData | ( | ) | const |
Definition at line 449 of file blockLattice.hh.
|
inline |
Return reference to Data's FieldTypeRegistry.
Only of interest for implementing specific device support
Definition at line 673 of file blockLattice.h.
References olb::Data< T, DESCRIPTOR, PLATFORM >::getRegistry().
|
inlineoverridevirtual |
Get reference to dynamics of cell by index.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 554 of file blockLattice.h.
References olb::BlockDynamicsMap< T, DESCRIPTOR, PLATFORM >::get().
|
inlineoverridevirtual |
Return pointer to dynamics yielded by promise.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 549 of file blockLattice.h.
References olb::BlockDynamicsMap< T, DESCRIPTOR, PLATFORM >::get().
|
inline |
Definition at line 545 of file blockLattice.h.
auto & olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::getField | ( | FIELD | field = FIELD() | ) |
Definition at line 484 of file blockLattice.hh.
const auto & olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::getField | ( | FIELD | field = FIELD() | ) | const |
Definition at line 496 of file blockLattice.hh.
|
overridevirtual |
Number of data blocks for the serializable interface.
Implements olb::Serializable.
Definition at line 547 of file blockLattice.hh.
|
inlineoverridevirtual |
Return pointers to population values of cell index iCell.
Performance optimization for access via virtual Cell
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 662 of file blockLattice.h.
|
overridevirtual |
Binary size for the serializer.
Implements olb::Serializable.
Definition at line 553 of file blockLattice.hh.
|
inlineoverridevirtual |
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 515 of file blockLattice.h.
bool olb::ConcreteBlockLattice< T, DESCRIPTOR, PLATFORM >::hasData | ( | ) | const |
Definition at line 442 of file blockLattice.hh.
|
inlineoverridevirtual |
Returns true if stage contains post processor.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 606 of file blockLattice.h.
|
overridevirtual |
Reinit population structure after deserialization.
Reimplemented from olb::Serializable.
Definition at line 570 of file blockLattice.hh.
|
overridevirtual |
Execute post processors of stage.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 539 of file blockLattice.hh.
|
inline |
Replace default collision logic of BlockDynamicsMap.
May be used to inject domain knowledge for improving performance by e.g. reducing the need to use virtual dispatching for non-dominant dynamics. This is necessarily platform specific.
Definition at line 541 of file blockLattice.h.
|
inlineoverridevirtual |
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 565 of file blockLattice.h.
|
inlineoverridevirtual |
Set dynamics at iCell to promised dynamics.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 559 of file blockLattice.h.
References olb::BlockLattice< T, DESCRIPTOR >::get(), and olb::BlockLattice< T, DESCRIPTOR >::getDynamics().
|
inline |
Definition at line 600 of file blockLattice.h.
|
inline |
Definition at line 583 of file blockLattice.h.
References olb::ColumnVector< COLUMN, D >::d, and olb::GPU_CUDA.
|
inline |
Definition at line 571 of file blockLattice.h.
References olb::Simulation.
|
inlineoverridevirtual |
Set processing context.
This is currently used to trigger data transfers between host and GPU data for Platform::GPU_CUDA.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 499 of file blockLattice.h.
References olb::Data< T, DESCRIPTOR, PLATFORM >::setProcessingContext().
|
overridevirtual |
Perform propagation step on the whole block.
Rotates the cyclic arrays storing the POPULATION field to perform implicit propagation using the PS pattern.
Implements olb::BlockLattice< T, DESCRIPTOR >.
Definition at line 307 of file blockLattice.hh.
References olb::GPU_CUDA.
|
staticconstexpr |
Definition at line 492 of file blockLattice.h.