walberla::domain_decomposition::IBlock Class Referenceabstract

Detailed Description

Base class for blocks (blocks are used to partition the simulation space: blocks are rectangular parts of the simulation space that manage all the data that is assigned to their part of the simulation space)

The class 'IBlock' already provides some basic functionality that every type of block will possess - regardless of the actual implementation of any derived block class. Every block ...

  • ... has a well defined state - that is a set of SUIDs that describes certain attributes related to this block. The state of a block can be used to determine what kind of data is assigned to this block and what kind of operations/computations are performed with this block.
  • ... possesses an axis-aligned bounding box that defines the exact part of the simulation space that is assigned to this block.
  • ... can hold any kind of data, which means every block can hold any number of dynamically allocated objects of any type. This "block data" is assigned via block data initialization functions which are managed by the block storage data structure that governs this block. For more information on this procedure refer to 'BlockStorage'. Data stored within a block can be retrieved by calling the member functions 'getData'.

'IBlock' also acts as an interface class which requires every derived class to implement a member function 'getId()' that returns a block ID of type 'IBlockID' (see classes 'IBlockID' and 'BlockStorage') which can be used to uniquely identify a block within its governing block storage data structure.

#include <IBlock.h>

+ Inheritance diagram for walberla::domain_decomposition::IBlock:

Public Types

using BlockData = internal::BlockData
 

Public Member Functions

virtual const IBlockIDgetId () const =0
 
bool operator== (const IBlock &rhs) const
 The following members are not used for checking if two IBlock objects are equal: storage_ & storageIndex_. More...
 
bool operator!= (const IBlock &rhs) const
 
const Set< SUID > & getState () const
 
void setState (const Set< SUID > &state)
 
void addState (const Set< SUID > &state)
 
void addState (const SUID &state)
 
void clearState ()
 
const AABB & getAABB () const
 
bool isBlockDataAllocated (const ConstBlockDataID &index) const
 Returns true if block data is allocated on this block at index "index". More...
 
template<typename T >
const T * getData (const ConstBlockDataID &index) const
 For documentation of this function see "const T* IBlock::getData( const BlockDataID index ) const". More...
 
template<typename T >
const T * getData (const BlockDataID &index) const
 Function for retrieving data - data that was previously added by the governing block storage data structure class (see class 'BlockStorage') via block data initialization functions. More...
 
template<typename T >
T * getData (const BlockDataID &index)
 For documentation of this function see "const T* IBlock::getData( const BlockDataID index ) const". More...
 
void deleteData (const BlockDataID &index)
 Function for removing all data that corresponds to block data ID 'index'. More...
 
template<typename T >
bool isDataOfType (const ConstBlockDataID &index) const
 Returns true if and only if the data stored at position "index" is of type T. More...
 
template<typename T >
bool isDataClassOrSubclassOf (const ConstBlockDataID &index) const
 Returns true if the data stored at position "index" is of type T or if it is a subclass of T. More...
 
template<typename T >
bool isDataSubclassOf (const ConstBlockDataID &index) const
 Returns true if and only if the type of the data stored at position "index" is a subclass of T. More...
 
bool isDataOfSameType (const ConstBlockDataID &indexA, const ConstBlockDataID &indexB) const
 Returns true if the type of the data stored at position "indexA" is equal to the type of the data stored at position "indexB". More...
 
template<typename T >
const T * uncheckedFastGetData (const ConstBlockDataID &index) const
 For documentation of this function see "const T* IBlock::uncheckedFastGetData( const BlockDataID index ) const". More...
 
template<typename T >
const T * uncheckedFastGetData (const BlockDataID &index) const
 Identical to "getData", however only works if type T is identical (!) to the type that was once added. More...
 
template<typename T >
T * uncheckedFastGetData (const BlockDataID &index)
 For documentation of this function see "const T* IBlock::uncheckedFastGetData( const BlockDataID index ) const". More...
 

Protected Member Functions

 IBlock (BlockStorage &storage, const AABB &aabb, const IBlockID::IDType &id, const bool local=true)
 Every derived class must call this constructor and pass a reference to the governing block storage data structure as well as a reference to an axis-aligned bounding box that defines the exact part of the simulation space that is assigned to this block. More...
 
virtual ~IBlock ()
 Must not be made public! No one should be allowed to delete a variable of type 'IBlock*'. More...
 
virtual bool equal (const IBlock *rhs) const =0
 

Protected Attributes

AABB aabb_
 an axis-aligned bounding box that defines the exact part of the simulation space that is assigned to this block More...
 

Private Member Functions

 IBlock ()
 Must not be made public or protected! Derived classes must call one of the available public/protected constructors. More...
 
void addData (const BlockDataID &index, BlockData *const data)
 helper function for assigning data to this block (called by 'BlockStorage'), must not be made public or protected! More...
 
- Private Member Functions inherited from walberla::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Attributes

Set< SUID > state_
 a set of SUIDs the describes the current state of this block More...
 
std::vector< BlockData * > data_
 the data assigned to this block More...
 
BlockStoragestorage_
 governing block storage data structure More...
 
int storageIndex_
 used internally by 'IBlock' and 'BlockStorage' in order to (quite easily) allow iterators for 'BlockStorage' More...
 

Friends

class BlockStorage
 
class StructuredBlockStorage
 

Member Typedef Documentation

◆ BlockData

Constructor & Destructor Documentation

◆ IBlock() [1/2]

walberla::domain_decomposition::IBlock::IBlock ( BlockStorage storage,
const AABB &  aabb,
const IBlockID::IDType id,
const bool  local = true 
)
protected

Every derived class must call this constructor and pass a reference to the governing block storage data structure as well as a reference to an axis-aligned bounding box that defines the exact part of the simulation space that is assigned to this block.

If the third parameter 'local' is set to false ('local' is set to true by default), the caller indicates that this block is NOT a normal, local block; Normal, local blocks contain all the block data that is required by the simulation. Setting 'local' to false might be useful in many situations, for example, if a temporary object of type 'IBlock' must be created, or if the governing block storage data structure also allocates remote blocks for whatever reason (remote blocks are "empty shells": blocks that reside on other processes and hence store no local block data).

◆ ~IBlock()

walberla::domain_decomposition::IBlock::~IBlock ( )
protectedvirtual

Must not be made public! No one should be allowed to delete a variable of type 'IBlock*'.

◆ IBlock() [2/2]

walberla::domain_decomposition::IBlock::IBlock ( )
private

Must not be made public or protected! Derived classes must call one of the available public/protected constructors.

Member Function Documentation

◆ addData()

void walberla::domain_decomposition::IBlock::addData ( const BlockDataID index,
BlockData *const  data 
)
inlineprivate

helper function for assigning data to this block (called by 'BlockStorage'), must not be made public or protected!

◆ addState() [1/2]

void walberla::domain_decomposition::IBlock::addState ( const Set< SUID > &  state)
inline

◆ addState() [2/2]

void walberla::domain_decomposition::IBlock::addState ( const SUID &  state)
inline

◆ clearState()

void walberla::domain_decomposition::IBlock::clearState ( )
inline

◆ deleteData()

void walberla::domain_decomposition::IBlock::deleteData ( const BlockDataID index)
inline

Function for removing all data that corresponds to block data ID 'index'.

Further calls to "getData" with 'index' will return NULL.

◆ equal()

virtual bool walberla::domain_decomposition::IBlock::equal ( const IBlock rhs) const
protectedpure virtual

◆ getAABB()

const AABB& walberla::domain_decomposition::IBlock::getAABB ( ) const
inline

◆ getData() [1/3]

template<typename T >
T * walberla::domain_decomposition::IBlock::getData ( const BlockDataID index)
inline

For documentation of this function see "const T* IBlock::getData( const BlockDataID index ) const".

◆ getData() [2/3]

template<typename T >
const T * walberla::domain_decomposition::IBlock::getData ( const BlockDataID index) const
inline

Function for retrieving data - data that was previously added by the governing block storage data structure class (see class 'BlockStorage') via block data initialization functions.

Data cannot be added manually by for example calling 'addData', but must be added through the governing block storage data structure that keeps track of assigning BlockDataIDs (BlockDataIDs are required for accessing/retrieving data stored within blocks). Retrieving data will fail if T is neither the same type nor a base class of the data that was added.

◆ getData() [3/3]

template<typename T >
const T * walberla::domain_decomposition::IBlock::getData ( const ConstBlockDataID index) const
inline

For documentation of this function see "const T* IBlock::getData( const BlockDataID index ) const".

◆ getId()

virtual const IBlockID& walberla::domain_decomposition::IBlock::getId ( ) const
pure virtual

◆ getState()

const Set<SUID>& walberla::domain_decomposition::IBlock::getState ( ) const
inline

◆ isBlockDataAllocated()

bool walberla::domain_decomposition::IBlock::isBlockDataAllocated ( const ConstBlockDataID index) const
inline

Returns true if block data is allocated on this block at index "index".

◆ isDataClassOrSubclassOf()

template<typename T >
bool walberla::domain_decomposition::IBlock::isDataClassOrSubclassOf ( const ConstBlockDataID index) const
inline

Returns true if the data stored at position "index" is of type T or if it is a subclass of T.

◆ isDataOfSameType()

bool walberla::domain_decomposition::IBlock::isDataOfSameType ( const ConstBlockDataID indexA,
const ConstBlockDataID indexB 
) const
inline

Returns true if the type of the data stored at position "indexA" is equal to the type of the data stored at position "indexB".

◆ isDataOfType()

template<typename T >
bool walberla::domain_decomposition::IBlock::isDataOfType ( const ConstBlockDataID index) const
inline

Returns true if and only if the data stored at position "index" is of type T.

This function will return false if the type of the data is a subclass of T! For polymorphic type checking see member functions "isDataClassOrSubclassOf" and "isDataSubclassOf".

◆ isDataSubclassOf()

template<typename T >
bool walberla::domain_decomposition::IBlock::isDataSubclassOf ( const ConstBlockDataID index) const
inline

Returns true if and only if the type of the data stored at position "index" is a subclass of T.

This function will return false if the type of the data stored at position "index" is equal to T!

◆ operator!=()

bool walberla::domain_decomposition::IBlock::operator!= ( const IBlock rhs) const
inline

◆ operator==()

bool walberla::domain_decomposition::IBlock::operator== ( const IBlock rhs) const

The following members are not used for checking if two IBlock objects are equal: storage_ & storageIndex_.

◆ setState()

void walberla::domain_decomposition::IBlock::setState ( const Set< SUID > &  state)
inline

◆ uncheckedFastGetData() [1/3]

template<typename T >
T * walberla::domain_decomposition::IBlock::uncheckedFastGetData ( const BlockDataID index)
inline

For documentation of this function see "const T* IBlock::uncheckedFastGetData( const BlockDataID index ) const".

◆ uncheckedFastGetData() [2/3]

template<typename T >
const T * walberla::domain_decomposition::IBlock::uncheckedFastGetData ( const BlockDataID index) const
inline

Identical to "getData", however only works if type T is identical (!) to the type that was once added.

If type T is a base class of the class that was once added, this function will lead to undefined behavior of your program! Use with extreme caution!

◆ uncheckedFastGetData() [3/3]

template<typename T >
const T * walberla::domain_decomposition::IBlock::uncheckedFastGetData ( const ConstBlockDataID index) const
inline

For documentation of this function see "const T* IBlock::uncheckedFastGetData( const BlockDataID index ) const".

Friends And Related Function Documentation

◆ BlockStorage

friend class BlockStorage
friend

◆ StructuredBlockStorage

friend class StructuredBlockStorage
friend

Member Data Documentation

◆ aabb_

AABB walberla::domain_decomposition::IBlock::aabb_
protected

an axis-aligned bounding box that defines the exact part of the simulation space that is assigned to this block

◆ data_

std::vector< BlockData* > walberla::domain_decomposition::IBlock::data_
private

the data assigned to this block

◆ state_

Set<SUID> walberla::domain_decomposition::IBlock::state_
private

a set of SUIDs the describes the current state of this block

◆ storage_

BlockStorage& walberla::domain_decomposition::IBlock::storage_
private

governing block storage data structure

◆ storageIndex_

int walberla::domain_decomposition::IBlock::storageIndex_
private

used internally by 'IBlock' and 'BlockStorage' in order to (quite easily) allow iterators for 'BlockStorage'


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