walberla::blockforest::BlockForest Class Reference

#include <BlockForest.h>

+ Inheritance diagram for walberla::blockforest::BlockForest:

Classes

class  BlockInformation
 
class  RefreshCallbackWrappper
 
class  RefreshFunctor
 
class  SnapshotCreationFunctor
 

Public Types

enum  FileIOMode { MPI_PARALLEL, MASTER_SLAVE, SERIALIZED_DISTRIBUTED }
 
using RefreshMinTargetLevelDeterminationFunction = std::function< void(std::vector< std::pair< const Block *, uint_t > > &, std::vector< const Block * > &, const BlockForest &)>
 
using RefreshCallbackFunction = std::function< void(BlockForest &, const PhantomBlockForest &)>
 
using SnapshotCreationFunction = std::function< void(std::vector< uint_t > &, std::vector< uint_t > &)>
 
using SnapshotRestoreFunction = std::function< uint_t(const uint_t)>
 
using SnapshotRestoreCallbackFunction = std::function< void()>
 
- Public Types inherited from walberla::domain_decomposition::BlockStorage
using BlockContainerType = std::map< IBlockID::IDType, IBlock * >
 

Public Member Functions

 BlockForest (const uint_t process, const SetupBlockForest &forest, const bool keepGlobalBlockInformation=false)
 
 BlockForest (const uint_t process, const char *const filename, const bool broadcastFile=true, const bool keepGlobalBlockInformation=false)
 
 ~BlockForest () override=default
 
uint_t getProcess () const
 
uint_t getProcessIdBytes () const
 
uint_t getSize (const uint_t index) const
 
real_t getRootBlockXSize () const
 
real_t getRootBlockYSize () const
 
real_t getRootBlockZSize () const
 
bool storesUniformBlockGrid () const
 
uint_t getTreeIdDigits () const
 
uint_t getBlockIdBytes () const
 
uint_t getDepth () const
 
uint_t getNumberOfLevels () const
 
bool limitedDepth () const
 
bool limitedLevels () const
 
uint_t getMaxDepth () const
 
uint_t getMaxLevels () const
 
uint_t getNumberOfBlocks () const
 
uint_t getNumberOfBlocks (const uint_t level) const
 
const std::map< BlockID, shared_ptr< Block > > & getBlockMap () const
 
void getBlocks (std::vector< const Block * > &blocks, const uint_t level) const
 
void getBlocks (std::vector< Block * > &blocks, const uint_t level)
 
void getBlocksContainedWithinAABB (std::vector< const IBlock * > &blocks, const AABB &aabb) const override
 Calling this function causes all locally allocated blocks that are completely contained within the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'. More...
 
void getBlocksContainedWithinAABB (std::vector< IBlock * > &blocks, const AABB &aabb) override
 Calling this function causes all locally allocated blocks that are completely contained within the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'. More...
 
void getBlocksOverlappedByAABB (std::vector< const IBlock * > &blocks, const AABB &aabb) const override
 Calling this function causes all locally allocated blocks that intersect with the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'. More...
 
void getBlocksOverlappedByAABB (std::vector< IBlock * > &blocks, const AABB &aabb) override
 Calling this function causes all locally allocated blocks that intersect with the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'. More...
 
const BlockgetBlock (const IBlockID &id) const override
 Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!). More...
 
BlockgetBlock (const IBlockID &id) override
 Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!). More...
 
const BlockgetBlock (const real_t x, const real_t y, const real_t z) const override
 Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!). More...
 
BlockgetBlock (const real_t x, const real_t y, const real_t z) override
 Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!). More...
 
const BlockgetRootBlock (const uint_t x, const uint_t y, const uint_t z) const
 
BlockgetRootBlock (const uint_t x, const uint_t y, const uint_t z)
 
bool containsGlobalBlockInformation () const override
 Indicates whether or not information about remote blocks (blocks that reside on other processes) is available. More...
 
void getAllBlocks (std::vector< shared_ptr< IBlockID > > &blocks) const override
 Returns the block ID of every block in the simulation (global and remote). More...
 
bool blockExists (const real_t x, const real_t y, const real_t z) const override
 Returns true if there exists a block at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. More...
 
bool blockExistsLocally (const real_t x, const real_t y, const real_t z) const override
 Returns true if locally there exists a block at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. More...
 
bool blockExistsRemotely (const real_t x, const real_t y, const real_t z) const override
 Returns true if remotely there exists a block at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. More...
 
bool blockExists (const IBlockID &id) const override
 Returns true if there exists a block with block ID 'id'. More...
 
bool blockExistsLocally (const IBlockID &id) const override
 Returns true if locally there exists a block with block ID 'id'. More...
 
bool blockExistsRemotely (const IBlockID &id) const override
 Returns true if remotely there exists a block with block ID 'id'. More...
 
bool rootBlockExists (const uint_t x, const uint_t y, const uint_t z) const
 
bool rootBlockExistsLocally (const uint_t x, const uint_t y, const uint_t z) const
 
bool rootBlockExistsRemotely (const uint_t x, const uint_t y, const uint_t z) const
 
void getBlockID (IBlockID &id, const real_t x, const real_t y, const real_t z) const override
 Returns the block ID that corresponds to the block located at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. More...
 
void getAABB (AABB &aabb, const IBlockID &id) const override
 Returns the axis-aligned bounding box that corresponds to the block with ID 'id'. More...
 
void getState (Set< SUID > &state, const IBlockID &id) const override
 Returns the block state that corresponds to the block with ID 'id'. More...
 
void getProcessRank (uint_t &rank, const IBlockID &id) const override
 Returns the rank of the process the block with ID 'id' resides on. More...
 
void getRootBlockAABB (AABB &aabb, const uint_t x, const uint_t y, const uint_t z) const
 
void getRootBlockState (Set< SUID > &state, const uint_t x, const uint_t y, const uint_t z) const
 
void getRootBlockProcessRank (uint_t &rank, const uint_t x, const uint_t y, const uint_t z) const
 
const BlockInformationgetBlockInformation () const
 
uint_t getLevel (const IBlock &block) const override
 must return the level the block "block" is assigned to (must be an unsigned integer in the range [0,'number-of-levels') ) More...
 
uint_t getLevelFromBlockId (const BlockID &id) const
 
uint_t getAABBFromBlockId (AABB &aabb, const BlockID &id) const
 
AABB getAABBFromBlockId (const BlockID &id) const
 
void getForestCoordinates (uint_t &x, uint_t &y, uint_t &z, const BlockID &id) const
 
void getRootBlockCoordinates (uint_t &x, uint_t &y, uint_t &z, const BlockID &id) const
 
void getRootBlockID (BlockID &id, const uint_t x, const uint_t y, const uint_t z) const
 
bool insertBuffersIntoProcessNetwork () const
 
const std::vector< uint_t > & getNeighborhood () const
 
const std::vector< uint_t > & getNeighboringProcesses () const override
 Returns all neighboring process IDs. More...
 
std::map< uint_t, std::vector< Vector3< real_t > > > getNeighboringProcessOffsets () const override
 For every neighboring process one or more offsets must be returned. More...
 
internal::BlockDataHandlingAdder addBlockData (const std::string &identifier=std::string())
 
template<typename T >
BlockDataID addBlockData (const shared_ptr< T > &dataHandling, const std::string &identifier=std::string(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
template<typename T >
BlockDataID addBlockData (std::function< T *(IBlock *const block) > function, const std::string &identifier=std::string(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
BlockDataID addBlockData (const domain_decomposition::internal::SelectableBlockDataHandlingWrapper &dataHandling, const std::string &identifier=std::string())
 
template<typename T >
BlockDataID loadBlockData (const std::string &file, const shared_ptr< T > &dataHandling, const std::string &identifier=std::string(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
BlockDataID loadBlockData (const std::string &file, const domain_decomposition::internal::SelectableBlockDataHandlingWrapper &dataHandling, const std::string &identifier=std::string())
 
void refresh ()
 Triggers AMR Pipeline. More...
 
RefreshFunctor getRefreshFunctor (const uint_t checkFrequency=uint_t(1))
 Functor that calls refresh with given frequency. More...
 
uint_t getModificationStamp () const
 Modification stamp is changed when refresh moves a block or refines/coarsens at least one block however, stamp may (in rare cases) also change if block structure was not altered i.e. More...
 
const WcTimingPoolgetRefreshTiming () const
 Returns timing pool that contains measurement for sub-steps of AMR pipeline. More...
 
void clearRefreshTiming ()
 
bool recalculateBlockLevelsInRefresh () const
 switches AMR pipeline step 1 on/off More...
 
void recalculateBlockLevelsInRefresh (const bool r)
 
void alwaysRebalanceInRefresh (const bool b)
 by default rebalancing can be skipped if no block level has changed with this switch one can force the execution of the rebalancing step More...
 
bool alwaysRebalanceInRefresh () const
 
void setRefreshMinTargetLevelDeterminationFunction (const RefreshMinTargetLevelDeterminationFunction &f)
 callback for AMR pipeline step 1 guaranteed minimal block level More...
 
bool allowMultipleRefreshCycles () const
 allow multiple AMR passes (possibility to refine more than once within one time step) if true, one all-to-all reduction with a boolean value is performed during refresh More...
 
void allowMultipleRefreshCycles (const bool m)
 
bool reevaluateMinTargetLevelsAfterForcedRefinement () const
 call setRefreshMinTargetLevelDeterminationFunction callback again after AMR internal refinement to keep 2:1 balance if true, one all-to-all reduction with a boolean value is performed during refresh More...
 
void reevaluateMinTargetLevelsAfterForcedRefinement (const bool c)
 
bool checkForEarlyOutInRefresh () const
 exit pipeline after first AMR step if no block level has changed after setRefreshMinTargetLevelDeterminationFunction callback can be overwritten by alwaysRebalanceInRefresh if true, one all-to-all reduction with a boolean value is performed during refresh More...
 
void checkForEarlyOutInRefresh (const bool c)
 
bool checkForLateOutInRefresh () const
 exit pipeline after first AMR step if no block level has changed can be overwritten by alwaysRebalanceInRefresh if true, one all-to-all reduction with a boolean value is performed during refresh More...
 
void checkForLateOutInRefresh (const bool c)
 
bool allowRefreshChangingDepth () const
 maximal depth of block structure is allowed to change? if true, one all-to-all reduction with an unsigned int value is performed after refresh More...
 
void allowRefreshChangingDepth (const bool c)
 
bool checkForEarlyOutAfterLoadBalancing () const
 if true, one all-to-all reduction with a boolean value is performed during refresh More...
 
void checkForEarlyOutAfterLoadBalancing (const bool c)
 
void setRefreshBlockStateDeterminationFunction (const PhantomBlockForest::BlockStateDeterminationFunction &f)
 callback which determines the state id (SUID) of the new block during refinement/coarsening More...
 
void setRefreshPhantomBlockDataAssignmentFunction (const PhantomBlockForest::PhantomBlockDataAssignmentFunction &f)
 callback to assign arbitrary data to a phantom block (used only during load balancing), e.g. weights More...
 
void setRefreshPhantomBlockMigrationPreparationFunction (const PhantomBlockForest::MigrationPreparationFunction &f)
 load balancing algorithm More...
 
void setRefreshPhantomBlockDataPackFunction (const PhantomBlockForest::PhantomBlockDataPackFunction &f)
 
void setRefreshPhantomBlockDataUnpackFunction (const PhantomBlockForest::PhantomBlockDataUnpackFunction &f)
 
bool loadBalancingFunctionRegistered () const
 
uint_t phantomBlockMigrationIterations () const
 get number of "setRefreshPhantomBlockMigrationPreparationFunction" calls More...
 
uint_t addRefreshCallbackFunctionBeforeBlockDataIsPacked (const RefreshCallbackFunction &f)
 
void removeRefreshCallbackFunctionBeforeBlockDataIsPacked (const uint_t handle)
 
uint_t addRefreshCallbackFunctionBeforeBlockDataIsUnpacked (const RefreshCallbackFunction &f)
 
void removeRefreshCallbackFunctionBeforeBlockDataIsUnpacked (const uint_t handle)
 
uint_t addRefreshCallbackFunctionAfterBlockDataIsUnpacked (const RefreshCallbackFunction &f)
 
void removeRefreshCallbackFunctionAfterBlockDataIsUnpacked (const uint_t handle)
 
void createSnapshot (const std::vector< uint_t > &sendTo, const std::vector< uint_t > &recvFrom)
 
void restoreSnapshot (const SnapshotRestoreFunction &processMapping, const bool rebelance=true)
 
SnapshotCreationFunctor getSnapshotCreationFunctor (const SnapshotCreationFunction &function, const uint_t checkFrequency=uint_t(1))
 
uint_t addCallbackFunctionAfterBlockDataIsRestored (const SnapshotRestoreCallbackFunction &f)
 
void removeCallbackFunctionAfterBlockDataIsRestored (const uint_t handle)
 
void saveToFile (const std::string &filename, FileIOMode fileIOMode=MPI_PARALLEL) const
 Block states are reduced using MPI. More...
 
void saveToFile (const std::string &filename, const Set< SUID > &blockStates, FileIOMode fileIOMode=MPI_PARALLEL) const
 Block states are passed by argument (ATTENTION: 'blockStates' must be identical for every process!) More...
 
void checkBlockInformationConsistency (const SetupBlockForest &forest) const
 
void getBlocks (std::vector< const IBlock * > &blocks) const
 inserts all locally allocated blocks into vector 'blocks' More...
 
void getBlocks (std::vector< IBlock * > &blocks)
 inserts all locally allocated blocks into vector 'blocks' More...
 
virtual const IBlockgetBlock (const IBlockID &id) const=0
 Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!). More...
 
const IBlockgetBlock (const IBlockID::IDType &id) const
 
virtual IBlockgetBlock (const IBlockID &id)=0
 Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!). More...
 
IBlockgetBlock (const IBlockID::IDType &id)
 
virtual const IBlockgetBlock (const real_t x, const real_t y, const real_t z) const=0
 Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!). More...
 
const IBlockgetBlock (const Vector3< real_t > &p) const
 
virtual IBlockgetBlock (const real_t x, const real_t y, const real_t z)=0
 Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!). More...
 
IBlockgetBlock (const Vector3< real_t > &p)
 
- Public Member Functions inherited from walberla::domain_decomposition::BlockStorage
bool isXPeriodic () const
 
bool isYPeriodic () const
 
bool isZPeriodic () const
 
bool isPeriodic (const uint_t index) const
 
void mapToPeriodicDomain (real_t &x, real_t &y, real_t &z) const
 For documentation, see documentation of free function 'void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AABB & domain, real_t & x, real_t & y, real_t & z )'. More...
 
void mapToPeriodicDomain (Vector3< real_t > &p) const
 
bool periodicIntersect (const math::AABB &box1, const math::AABB &box2) const
 For documentation, see documentation of free function 'bool periodicIntersect( const std::array< bool, 3 > & periodic, const math::AABB & domain, const math::AABB & box1, const math::AABB & box2 )'. More...
 
bool periodicIntersect (const math::AABB &box1, const math::AABB &box2, const real_t dx) const
 For documentation, see documentation of free function 'bool periodicIntersect( const std::array< bool, 3 > & periodic, const math::AABB & domain, const math::AABB & box1, const math::AABB & box2 )'. More...
 
bool operator== (const BlockStorage &rhs) const
 The following members are not used for checking if two BlockStorage objects are equal: iBlocks_. More...
 
bool operator!= (const BlockStorage &rhs) const
 
iterator begin (const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 iterator for traversing all locally allocated blocks More...
 
const_iterator begin (const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet()) const
 iterator for traversing all locally allocated blocks More...
 
bool empty () const
 
void getBlocks (std::vector< const IBlock * > &blocks) const
 inserts all locally allocated blocks into vector 'blocks' More...
 
void getBlocks (std::vector< IBlock * > &blocks)
 inserts all locally allocated blocks into vector 'blocks' More...
 
const IBlockgetBlock (const IBlockID::IDType &id) const
 
IBlockgetBlock (const IBlockID::IDType &id)
 
const IBlockgetBlock (const Vector3< real_t > &p) const
 
IBlockgetBlock (const Vector3< real_t > &p)
 
bool blockExists (const Vector3< real_t > &p) const
 
bool blockExistsLocally (const Vector3< real_t > &p) const
 
bool blockExistsRemotely (const Vector3< real_t > &p) const
 
void getBlockID (IBlockID &id, const Vector3< real_t > &p) const
 
AABB getAABB (const IBlockID &id) const
 
Set< SUID > getState (const IBlockID &id) const
 
uint_t getProcessRank (const IBlockID &id) const
 
bool atDomainXMinBorder (const IBlock &block) const
 Returns true if the block 'block' is located at the lower x-axis border of the domain. More...
 
bool atDomainXMaxBorder (const IBlock &block) const
 Returns true if the block 'block' is located at the upper x-axis border of the domain. More...
 
bool atDomainYMinBorder (const IBlock &block) const
 Returns true if the block 'block' is located at the lower y-axis border of the domain. More...
 
bool atDomainYMaxBorder (const IBlock &block) const
 Returns true if the block 'block' is located at the upper y-axis border of the domain. More...
 
bool atDomainZMinBorder (const IBlock &block) const
 Returns true if the block 'block' is located at the lower z-axis border of the domain. More...
 
bool atDomainZMaxBorder (const IBlock &block) const
 Returns true if the block 'block' is located at the upper z-axis border of the domain. More...
 
bool atDomainMinBorder (const uint_t index, const IBlock &block) const
 
bool atDomainMaxBorder (const uint_t index, const IBlock &block) const
 
internal::BlockDataHandlingAdder addBlockData (const std::string &identifier=std::string())
 Must be used if multiple block data handling objects with different selection attributes are registered for initializing the same block data "item". More...
 
template<typename T >
BlockDataID addBlockData (const shared_ptr< T > &dataHandling, const std::string &identifier=std::string(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 This function can be used for initializing a new block data "item". More...
 
template<typename T >
BlockDataID addBlockData (std::function< T *(IBlock *const block) > function, const std::string &identifier=std::string(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 This function can be used for initializing a new block data "item". More...
 
BlockDataID addBlockData (const internal::SelectableBlockDataHandlingWrapper &dataHandling, const std::string &identifier=std::string())
 After registering one/multiple block data handling objects, this function is called for actually adding data to the blocks. More...
 
template<typename T >
BlockDataID loadBlockData (const std::string &file, const shared_ptr< T > &dataHandling, const std::string &identifier=std::string(), const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 This function can be used for initializing a new block data "item" by loading the data from file. More...
 
BlockDataID loadBlockData (const std::string &file, const internal::SelectableBlockDataHandlingWrapper &dataHandling, const std::string &identifier=std::string())
 After registering one/multiple block data handling objects, this function is called for actually adding data to the blocks by loading the data from file. More...
 
void saveBlockData (const std::string &file, const BlockDataID &id)
 This function can be used to store the data that corresponds to 'id' to file, so that later (probably when restarting a simulation) the data can be loaded by using the member function 'loadBlockData'. More...
 
void serializeBlockData (const BlockDataID &id, mpi::SendBuffer &buffer)
 This function serializes the block data into a sendbuffer. More...
 
void deserializeBlockData (const BlockDataID &id, mpi::RecvBuffer &buffer)
 Deserializes data form a recv buffer into existing block data Only deserialize data, that has be serialized with serializeBlockData. More...
 
void clearBlockData (const BlockDataID &id)
 This function can be used for removing all data that corresponds to block data ID 'id'. More...
 
uint_t numberOfBlockDataItems () const
 
std::vector< std::string > getBlockDataIdentifiers () const
 
const std::string & getBlockDataIdentifier (const ConstBlockDataID &id) const
 
void rebuildProcessesWithBlocksCommunicator ()
 
MPI_Comm processesWithBlocksCommunicator ()
 Returns a MPI communicator that only contains processes that possess blocks. More...
 

Protected Member Functions

bool equal (const BlockStorage *rhs) const override
 
void addBlockData (IBlock *const block, const BlockDataID &index, domain_decomposition::internal::BlockData *const data)
 
- Protected Member Functions inherited from walberla::domain_decomposition::BlockStorage
 BlockStorage (const AABB &domain, const bool xPeriodic, const bool yPeriodic, const bool zPeriodic)
 Every derived class must call this constructor! More...
 
virtual ~BlockStorage ()
 Must not be made public! No one should be allowed to delete a variable of type 'BlockStorage*'. More...
 
void addBlockData (IBlock *const block, const BlockDataID &index, internal::BlockData *const data)
 

Private Member Functions

void constructBlockInformation (const SetupBlockForest &forest)
 
void constructBlockInformation (const std::vector< BlockID > &ids, const std::vector< shared_ptr< BlockInformation::Node > > &nodes)
 
void constructBlockInformation ()
 
void registerRefreshTimer ()
 
bool determineBlockTargetLevels (bool &additionalRefreshCycleRequired, bool &rerun)
 
void update (PhantomBlockForest &phantomForest)
 
void saveToFile (const std::string &filename, FileIOMode fileIOMode, const std::map< SUID, std::vector< bool > > &suidMap, const uint_t suidBytes) const
 For a description of the file format see BlockForestFile.h. More...
 
void storeFileHeader (std::vector< uint8_t > &data, uint_t &offset) const
 

Private Attributes

uint_t process_
 
uint_t processIdBytes_
 
uint_t size_ [3]
 
uint_t depth_
 
uint_t treeIdDigits_
 
std::map< BlockID, shared_ptr< Block > > blocks_
 
bool insertBuffersIntoProcessNetwork_
 
std::vector< uint_tneighborhood_
 
shared_ptr< BlockInformationblockInformation_
 
uint_t modificationStamp_
 
WcTimingPool refreshTiming_
 
bool recalculateBlockLevelsInRefresh_
 
bool alwaysRebalanceInRefresh_
 
RefreshMinTargetLevelDeterminationFunction refreshMinTargetLevelDeterminationFunction_
 
bool allowMultipleRefreshCycles_
 
bool reevaluateMinTargetLevelsAfterForcedRefinement_
 
bool checkForEarlyOutInRefresh_
 
bool checkForLateOutInRefresh_
 
bool allowChangingDepth_
 
bool checkForEarlyOutAfterLoadBalancing_
 
PhantomBlockForest::BlockStateDeterminationFunction refreshBlockStateDeterminationFunction_
 
PhantomBlockForest::PhantomBlockDataAssignmentFunction refreshPhantomBlockDataAssignmentFunction_
 
PhantomBlockForest::MigrationPreparationFunction refreshPhantomBlockMigrationPreparationFunction_
 
PhantomBlockForest::PhantomBlockDataPackFunction refreshPhantomBlockDataPackFunction_
 
PhantomBlockForest::PhantomBlockDataUnpackFunction refreshPhantomBlockDataUnpackFunction_
 
uint_t phantomBlockMigrationIterations_
 
std::map< uint_t, RefreshCallbackFunctioncallbackBeforeBlockDataIsPacked_
 
std::map< uint_t, RefreshCallbackFunctioncallbackBeforeBlockDataIsUnpacked_
 
std::map< uint_t, RefreshCallbackFunctioncallbackAfterBlockDataIsUnpacked_
 
uint_t nextCallbackBeforeBlockDataIsPackedHandle_
 
uint_t nextCallbackBeforeBlockDataIsUnpackedHandle_
 
uint_t nextCallbackAfterBlockDataIsUnpackedHandle_
 
bool snapshotExists_
 
uint_t snapshotDepth_
 
uint_t snapshotBlockDataItems_
 
std::map< uint_t, mpi::RecvBuffersnapshot_
 
std::map< uint_t, SnapshotRestoreCallbackFunctioncallbackAfterBlockDataIsRestored_
 
uint_t nextCallbackAfterBlockDataIsRestoredHandle_
 

Friends

class BlockInformation
 

Additional Inherited Members

- Protected Attributes inherited from walberla::domain_decomposition::BlockStorage
AABB domain_
 axis-aligned bounding box for the entire simulation space/domain More...
 
bool periodic_ [3]
 periodicity flags More...
 
std::vector< internal::BlockDataItemblockDataItem_
 

Member Typedef Documentation

◆ RefreshCallbackFunction

◆ RefreshMinTargetLevelDeterminationFunction

using walberla::blockforest::BlockForest::RefreshMinTargetLevelDeterminationFunction = std::function<void (std::vector<std::pair<const Block *, uint_t> > &, std::vector<const Block *> &, const BlockForest &)>

◆ SnapshotCreationFunction

using walberla::blockforest::BlockForest::SnapshotCreationFunction = std::function<void (std::vector<uint_t> &, std::vector<uint_t> &)>

◆ SnapshotRestoreCallbackFunction

◆ SnapshotRestoreFunction

Member Enumeration Documentation

◆ FileIOMode

Enumerator
MPI_PARALLEL 
MASTER_SLAVE 
SERIALIZED_DISTRIBUTED 

Constructor & Destructor Documentation

◆ BlockForest() [1/2]

walberla::blockforest::BlockForest::BlockForest ( const uint_t  process,
const SetupBlockForest forest,
const bool  keepGlobalBlockInformation = false 
)

◆ BlockForest() [2/2]

walberla::blockforest::BlockForest::BlockForest ( const uint_t  process,
const char *const  filename,
const bool  broadcastFile = true,
const bool  keepGlobalBlockInformation = false 
)

◆ ~BlockForest()

walberla::blockforest::BlockForest::~BlockForest ( )
overridedefault

Member Function Documentation

◆ addBlockData() [1/5]

BlockDataID walberla::blockforest::BlockForest::addBlockData ( const domain_decomposition::internal::SelectableBlockDataHandlingWrapper dataHandling,
const std::string &  identifier = std::string() 
)
inline

◆ addBlockData() [2/5]

template<typename T >
BlockDataID walberla::blockforest::BlockForest::addBlockData ( const shared_ptr< T > &  dataHandling,
const std::string &  identifier = std::string(),
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

◆ addBlockData() [3/5]

internal::BlockDataHandlingAdder walberla::blockforest::BlockForest::addBlockData ( const std::string &  identifier = std::string())
inline

◆ addBlockData() [4/5]

void walberla::blockforest::BlockForest::addBlockData ( IBlock *const  block,
const BlockDataID index,
domain_decomposition::internal::BlockData *const  data 
)
inlineprotected

◆ addBlockData() [5/5]

template<typename T >
BlockDataID walberla::blockforest::BlockForest::addBlockData ( std::function< T *(IBlock *const block) >  function,
const std::string &  identifier = std::string(),
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

◆ addCallbackFunctionAfterBlockDataIsRestored()

uint_t walberla::blockforest::BlockForest::addCallbackFunctionAfterBlockDataIsRestored ( const SnapshotRestoreCallbackFunction f)
inline

◆ addRefreshCallbackFunctionAfterBlockDataIsUnpacked()

uint_t walberla::blockforest::BlockForest::addRefreshCallbackFunctionAfterBlockDataIsUnpacked ( const RefreshCallbackFunction f)
inline

◆ addRefreshCallbackFunctionBeforeBlockDataIsPacked()

uint_t walberla::blockforest::BlockForest::addRefreshCallbackFunctionBeforeBlockDataIsPacked ( const RefreshCallbackFunction f)
inline

◆ addRefreshCallbackFunctionBeforeBlockDataIsUnpacked()

uint_t walberla::blockforest::BlockForest::addRefreshCallbackFunctionBeforeBlockDataIsUnpacked ( const RefreshCallbackFunction f)
inline

◆ allowMultipleRefreshCycles() [1/2]

bool walberla::blockforest::BlockForest::allowMultipleRefreshCycles ( ) const
inline

allow multiple AMR passes (possibility to refine more than once within one time step) if true, one all-to-all reduction with a boolean value is performed during refresh

◆ allowMultipleRefreshCycles() [2/2]

void walberla::blockforest::BlockForest::allowMultipleRefreshCycles ( const bool  m)
inline

◆ allowRefreshChangingDepth() [1/2]

bool walberla::blockforest::BlockForest::allowRefreshChangingDepth ( ) const
inline

maximal depth of block structure is allowed to change? if true, one all-to-all reduction with an unsigned int value is performed after refresh

◆ allowRefreshChangingDepth() [2/2]

void walberla::blockforest::BlockForest::allowRefreshChangingDepth ( const bool  c)
inline

◆ alwaysRebalanceInRefresh() [1/2]

bool walberla::blockforest::BlockForest::alwaysRebalanceInRefresh ( ) const
inline

◆ alwaysRebalanceInRefresh() [2/2]

void walberla::blockforest::BlockForest::alwaysRebalanceInRefresh ( const bool  b)
inline

by default rebalancing can be skipped if no block level has changed with this switch one can force the execution of the rebalancing step

◆ blockExists() [1/2]

bool walberla::blockforest::BlockForest::blockExists ( const IBlockID id) const
inlineoverridevirtual

Returns true if there exists a block with block ID 'id'.

This member function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'.

Implements walberla::domain_decomposition::BlockStorage.

◆ blockExists() [2/2]

bool walberla::blockforest::BlockForest::blockExists ( const real_t  x,
const real_t  y,
const real_t  z 
) const
inlineoverridevirtual

Returns true if there exists a block at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

]. This member function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'.

Implements walberla::domain_decomposition::BlockStorage.

◆ blockExistsLocally() [1/2]

bool walberla::blockforest::BlockForest::blockExistsLocally ( const IBlockID id) const
inlineoverridevirtual

Returns true if locally there exists a block with block ID 'id'.

This member function is always guaranteed to work properly, even if 'containsGlobalBlockInformation() == false'.

Implements walberla::domain_decomposition::BlockStorage.

◆ blockExistsLocally() [2/2]

bool walberla::blockforest::BlockForest::blockExistsLocally ( const real_t  x,
const real_t  y,
const real_t  z 
) const
inlineoverridevirtual

Returns true if locally there exists a block at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

]. This member function is always guaranteed to work properly, even if 'containsGlobalBlockInformation() == false'.

Implements walberla::domain_decomposition::BlockStorage.

◆ blockExistsRemotely() [1/2]

bool walberla::blockforest::BlockForest::blockExistsRemotely ( const IBlockID id) const
inlineoverridevirtual

Returns true if remotely there exists a block with block ID 'id'.

This member function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'.

Implements walberla::domain_decomposition::BlockStorage.

◆ blockExistsRemotely() [2/2]

bool walberla::blockforest::BlockForest::blockExistsRemotely ( const real_t  x,
const real_t  y,
const real_t  z 
) const
inlineoverridevirtual

Returns true if remotely there exists a block at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

]. This member function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'.

Implements walberla::domain_decomposition::BlockStorage.

◆ checkBlockInformationConsistency()

void walberla::blockforest::BlockForest::checkBlockInformationConsistency ( const SetupBlockForest forest) const

◆ checkForEarlyOutAfterLoadBalancing() [1/2]

bool walberla::blockforest::BlockForest::checkForEarlyOutAfterLoadBalancing ( ) const
inline

if true, one all-to-all reduction with a boolean value is performed during refresh

◆ checkForEarlyOutAfterLoadBalancing() [2/2]

void walberla::blockforest::BlockForest::checkForEarlyOutAfterLoadBalancing ( const bool  c)
inline

◆ checkForEarlyOutInRefresh() [1/2]

bool walberla::blockforest::BlockForest::checkForEarlyOutInRefresh ( ) const
inline

exit pipeline after first AMR step if no block level has changed after setRefreshMinTargetLevelDeterminationFunction callback can be overwritten by alwaysRebalanceInRefresh if true, one all-to-all reduction with a boolean value is performed during refresh

◆ checkForEarlyOutInRefresh() [2/2]

void walberla::blockforest::BlockForest::checkForEarlyOutInRefresh ( const bool  c)
inline

◆ checkForLateOutInRefresh() [1/2]

bool walberla::blockforest::BlockForest::checkForLateOutInRefresh ( ) const
inline

exit pipeline after first AMR step if no block level has changed can be overwritten by alwaysRebalanceInRefresh if true, one all-to-all reduction with a boolean value is performed during refresh

◆ checkForLateOutInRefresh() [2/2]

void walberla::blockforest::BlockForest::checkForLateOutInRefresh ( const bool  c)
inline

◆ clearRefreshTiming()

void walberla::blockforest::BlockForest::clearRefreshTiming ( )
inline

◆ constructBlockInformation() [1/3]

void walberla::blockforest::BlockForest::constructBlockInformation ( )
private

◆ constructBlockInformation() [2/3]

void walberla::blockforest::BlockForest::constructBlockInformation ( const SetupBlockForest forest)
private

◆ constructBlockInformation() [3/3]

void walberla::blockforest::BlockForest::constructBlockInformation ( const std::vector< BlockID > &  ids,
const std::vector< shared_ptr< BlockInformation::Node > > &  nodes 
)
private

◆ containsGlobalBlockInformation()

bool walberla::blockforest::BlockForest::containsGlobalBlockInformation ( ) const
inlineoverridevirtual

Indicates whether or not information about remote blocks (blocks that reside on other processes) is available.

This information includes the process rank, the state, and the axis-aligned bounding box of any block (local or remote).

Implements walberla::domain_decomposition::BlockStorage.

◆ createSnapshot()

void walberla::blockforest::BlockForest::createSnapshot ( const std::vector< uint_t > &  sendTo,
const std::vector< uint_t > &  recvFrom 
)

◆ determineBlockTargetLevels()

bool walberla::blockforest::BlockForest::determineBlockTargetLevels ( bool &  additionalRefreshCycleRequired,
bool &  rerun 
)
private

◆ equal()

bool walberla::blockforest::BlockForest::equal ( const BlockStorage rhs) const
overrideprotectedvirtual

◆ getAABB()

void walberla::blockforest::BlockForest::getAABB ( AABB &  aabb,
const IBlockID id 
) const
overridevirtual

Returns the axis-aligned bounding box that corresponds to the block with ID 'id'.

For local blocks, this function is always guaranteed to work. For remote blocks, this function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'. If the request cannot be satisfied, the simulation must be aborted and the call to this function must not return!

Implements walberla::domain_decomposition::BlockStorage.

◆ getAABBFromBlockId() [1/2]

uint_t walberla::blockforest::BlockForest::getAABBFromBlockId ( AABB &  aabb,
const BlockID id 
) const
inline

◆ getAABBFromBlockId() [2/2]

AABB walberla::blockforest::BlockForest::getAABBFromBlockId ( const BlockID id) const
inline

◆ getAllBlocks()

void walberla::blockforest::BlockForest::getAllBlocks ( std::vector< shared_ptr< IBlockID > > &  blocks) const
inlineoverridevirtual

Returns the block ID of every block in the simulation (global and remote).

This member function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'.

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlock() [1/12]

const Block * walberla::blockforest::BlockForest::getBlock ( const IBlockID id) const
inlineoverridevirtual

Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( const_iterator block = begin(); block != end(); ++block )
if( block->getId() == id ) return *block;
return NULL;

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlock() [2/12]

virtual const IBlock* walberla::domain_decomposition::BlockStorage::getBlock

Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( const_iterator block = begin(); block != end(); ++block )
if( block->getId() == id ) return *block;
return NULL;

◆ getBlock() [3/12]

Block * walberla::blockforest::BlockForest::getBlock ( const IBlockID id)
inlineoverridevirtual

Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( iterator block = begin(); block != end(); ++block )
if( block->getId() == id ) return *block;
return NULL;

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlock() [4/12]

virtual IBlock* walberla::domain_decomposition::BlockStorage::getBlock

Returns the block associated with block ID 'id' (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( iterator block = begin(); block != end(); ++block )
if( block->getId() == id ) return *block;
return NULL;

◆ getBlock() [5/12]

IBlock* walberla::domain_decomposition::BlockStorage::getBlock
inline

◆ getBlock() [6/12]

const IBlock* walberla::domain_decomposition::BlockStorage::getBlock
inline

◆ getBlock() [7/12]

const Block * walberla::blockforest::BlockForest::getBlock ( const real_t  x,
const real_t  y,
const real_t  z 
) const
inlineoverridevirtual

Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( const_iterator block = begin(); block != end(); ++block )
if( block->getAABB().contains(x,y,z) ) return *block;
return NULL;

Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlock() [8/12]

virtual const IBlock* walberla::domain_decomposition::BlockStorage::getBlock

Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( const_iterator block = begin(); block != end(); ++block )
if( block->getAABB().contains(x,y,z) ) return *block;
return NULL;

Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

◆ getBlock() [9/12]

Block * walberla::blockforest::BlockForest::getBlock ( const real_t  x,
const real_t  y,
const real_t  z 
)
inlineoverridevirtual

Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( iterator block = begin(); block != end(); ++block )
if( block->getAABB().contains(x,y,z) ) return *block;
return NULL;

Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlock() [10/12]

virtual IBlock* walberla::domain_decomposition::BlockStorage::getBlock

Returns the block located at position (x,y,z) (returns 'NULL' if the block doesn't exist locally!).

The behavior of this function is identical to:

for( iterator block = begin(); block != end(); ++block )
if( block->getAABB().contains(x,y,z) ) return *block;
return NULL;

Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

◆ getBlock() [11/12]

IBlock* walberla::domain_decomposition::BlockStorage::getBlock
inline

◆ getBlock() [12/12]

const IBlock* walberla::domain_decomposition::BlockStorage::getBlock
inline

◆ getBlockID()

void walberla::blockforest::BlockForest::getBlockID ( IBlockID id,
const real_t  x,
const real_t  y,
const real_t  z 
) const
overridevirtual

Returns the block ID that corresponds to the block located at position (x,y,z) [Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'.

]. For local blocks, this function is always guaranteed to work. For remote blocks, this function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'. If the request cannot be satisfied (for example if no block exists at location (x,y,z)), the simulation must be aborted and the call to this function must not return!

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlockIdBytes()

uint_t walberla::blockforest::BlockForest::getBlockIdBytes ( ) const
inline

◆ getBlockInformation()

const BlockInformation& walberla::blockforest::BlockForest::getBlockInformation ( ) const
inline

◆ getBlockMap()

const std::map< BlockID, shared_ptr< Block > >& walberla::blockforest::BlockForest::getBlockMap ( ) const
inline

◆ getBlocks() [1/4]

void walberla::blockforest::BlockForest::getBlocks ( std::vector< Block * > &  blocks,
const uint_t  level 
)
inline

◆ getBlocks() [2/4]

void walberla::blockforest::BlockForest::getBlocks ( std::vector< const Block * > &  blocks,
const uint_t  level 
) const
inline

◆ getBlocks() [3/4]

void walberla::domain_decomposition::BlockStorage::getBlocks
inline

inserts all locally allocated blocks into vector 'blocks'

◆ getBlocks() [4/4]

void walberla::domain_decomposition::BlockStorage::getBlocks
inline

inserts all locally allocated blocks into vector 'blocks'

◆ getBlocksContainedWithinAABB() [1/2]

void walberla::blockforest::BlockForest::getBlocksContainedWithinAABB ( std::vector< const IBlock * > &  blocks,
const AABB &  aabb 
) const
inlineoverridevirtual

Calling this function causes all locally allocated blocks that are completely contained within the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'.

The behavior of this function is identical to:

for( const_iterator block = begin(); block != end(); ++block )
if( aabb.contains( block->getAABB() ) ) blocks.push_back( *block );

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlocksContainedWithinAABB() [2/2]

void walberla::blockforest::BlockForest::getBlocksContainedWithinAABB ( std::vector< IBlock * > &  blocks,
const AABB &  aabb 
)
inlineoverridevirtual

Calling this function causes all locally allocated blocks that are completely contained within the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'.

The behavior of this function is identical to:

for( iterator block = begin(); block != end(); ++block )
if( aabb.contains( block->getAABB() ) ) blocks.push_back( *block );

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlocksOverlappedByAABB() [1/2]

void walberla::blockforest::BlockForest::getBlocksOverlappedByAABB ( std::vector< const IBlock * > &  blocks,
const AABB &  aabb 
) const
inlineoverridevirtual

Calling this function causes all locally allocated blocks that intersect with the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'.

The behavior of this function is identical to:

for( const_iterator block = begin(); block != end(); ++block )
if( aabb.intersects( block->getAABB() ) ) blocks.push_back( *block );

Implements walberla::domain_decomposition::BlockStorage.

◆ getBlocksOverlappedByAABB() [2/2]

void walberla::blockforest::BlockForest::getBlocksOverlappedByAABB ( std::vector< IBlock * > &  blocks,
const AABB &  aabb 
)
inlineoverridevirtual

Calling this function causes all locally allocated blocks that intersect with the axis-aligned bounding box 'aabb' to be inserted at the end of vector 'blocks'.

The behavior of this function is identical to:

for( iterator block = begin(); block != end(); ++block )
if( aabb.intersects( block->getAABB() ) ) blocks.push_back( *block );

Implements walberla::domain_decomposition::BlockStorage.

◆ getDepth()

uint_t walberla::blockforest::BlockForest::getDepth ( ) const
inline

◆ getForestCoordinates()

void walberla::blockforest::BlockForest::getForestCoordinates ( uint_t x,
uint_t y,
uint_t z,
const BlockID id 
) const

◆ getLevel()

uint_t walberla::blockforest::BlockForest::getLevel ( const IBlock ) const
inlineoverridevirtual

must return the level the block "block" is assigned to (must be an unsigned integer in the range [0,'number-of-levels') )

Reimplemented from walberla::domain_decomposition::BlockStorage.

◆ getLevelFromBlockId()

uint_t walberla::blockforest::BlockForest::getLevelFromBlockId ( const BlockID id) const
inline

◆ getMaxDepth()

uint_t walberla::blockforest::BlockForest::getMaxDepth ( ) const
inline

◆ getMaxLevels()

uint_t walberla::blockforest::BlockForest::getMaxLevels ( ) const
inline

◆ getModificationStamp()

uint_t walberla::blockforest::BlockForest::getModificationStamp ( ) const
inline

Modification stamp is changed when refresh moves a block or refines/coarsens at least one block however, stamp may (in rare cases) also change if block structure was not altered i.e.

if modification stamp stays the same the block structure was not changed (no block movements, no level changes)

◆ getNeighborhood()

const std::vector< uint_t >& walberla::blockforest::BlockForest::getNeighborhood ( ) const
inline

◆ getNeighboringProcesses()

const std::vector< uint_t >& walberla::blockforest::BlockForest::getNeighboringProcesses ( ) const
inlineoverridevirtual

Returns all neighboring process IDs.

Implements walberla::domain_decomposition::BlockStorage.

◆ getNeighboringProcessOffsets()

std::map< uint_t, std::vector< Vector3< real_t > > > walberla::blockforest::BlockForest::getNeighboringProcessOffsets ( ) const
overridevirtual

For every neighboring process one or more offsets must be returned.

Normally, for every neighboring process exactly one offset is returned: (0,0,0). Only in case of periodicity this offset can be different from (0,0,0)! If the offset is different from (0,0,0), the x-component must be identical to either 0 or +/- the x-width of the domain. The same applies for y and z. What this offset is supposed to do: Each block in 3D has 26 neighborhood regions. Suppose we leave block A in direction (-1,0,0) and enter the neighboring block B, which is stored on another process. If A is located at the x-min border of the domain and the simulation is only periodic in x-direction, block B must be located at the x-max border of the domain and the corresponding offset to block B - or more precisely to the process storing block B - is (+ x-width of the domain, 0, 0). Since each process can store multiple blocks and a simulation can be periodic in more than just one direction, there may be multiple offsets to another process - hence the std::vector. For an actual implementation of "getNeighboringProcessOffsets()" see BlockForest.cpp.

Implements walberla::domain_decomposition::BlockStorage.

◆ getNumberOfBlocks() [1/2]

uint_t walberla::blockforest::BlockForest::getNumberOfBlocks ( ) const
inline

◆ getNumberOfBlocks() [2/2]

uint_t walberla::blockforest::BlockForest::getNumberOfBlocks ( const uint_t  level) const
inline

◆ getNumberOfLevels()

uint_t walberla::blockforest::BlockForest::getNumberOfLevels ( ) const
inline

◆ getProcess()

uint_t walberla::blockforest::BlockForest::getProcess ( ) const
inline

◆ getProcessIdBytes()

uint_t walberla::blockforest::BlockForest::getProcessIdBytes ( ) const
inline

◆ getProcessRank()

void walberla::blockforest::BlockForest::getProcessRank ( uint_t rank,
const IBlockID id 
) const
overridevirtual

Returns the rank of the process the block with ID 'id' resides on.

For local blocks, this function is always guaranteed to work. For remote blocks, this function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'. If the request cannot be satisfied, the simulation must be aborted and the call to this function must not return!

Implements walberla::domain_decomposition::BlockStorage.

◆ getRefreshFunctor()

RefreshFunctor walberla::blockforest::BlockForest::getRefreshFunctor ( const uint_t  checkFrequency = uint_t(1))
inline

Functor that calls refresh with given frequency.

◆ getRefreshTiming()

const WcTimingPool& walberla::blockforest::BlockForest::getRefreshTiming ( ) const
inline

Returns timing pool that contains measurement for sub-steps of AMR pipeline.

◆ getRootBlock() [1/2]

Block * walberla::blockforest::BlockForest::getRootBlock ( const uint_t  x,
const uint_t  y,
const uint_t  z 
)
inline

◆ getRootBlock() [2/2]

const Block * walberla::blockforest::BlockForest::getRootBlock ( const uint_t  x,
const uint_t  y,
const uint_t  z 
) const
inline

◆ getRootBlockAABB()

void walberla::blockforest::BlockForest::getRootBlockAABB ( AABB &  aabb,
const uint_t  x,
const uint_t  y,
const uint_t  z 
) const

◆ getRootBlockCoordinates()

void walberla::blockforest::BlockForest::getRootBlockCoordinates ( uint_t x,
uint_t y,
uint_t z,
const BlockID id 
) const
inline

◆ getRootBlockID()

void walberla::blockforest::BlockForest::getRootBlockID ( BlockID id,
const uint_t  x,
const uint_t  y,
const uint_t  z 
) const
inline

◆ getRootBlockProcessRank()

void walberla::blockforest::BlockForest::getRootBlockProcessRank ( uint_t rank,
const uint_t  x,
const uint_t  y,
const uint_t  z 
) const

◆ getRootBlockState()

void walberla::blockforest::BlockForest::getRootBlockState ( Set< SUID > &  state,
const uint_t  x,
const uint_t  y,
const uint_t  z 
) const

◆ getRootBlockXSize()

real_t walberla::blockforest::BlockForest::getRootBlockXSize ( ) const
inline

◆ getRootBlockYSize()

real_t walberla::blockforest::BlockForest::getRootBlockYSize ( ) const
inline

◆ getRootBlockZSize()

real_t walberla::blockforest::BlockForest::getRootBlockZSize ( ) const
inline

◆ getSize()

uint_t walberla::blockforest::BlockForest::getSize ( const uint_t  index) const
inline

◆ getSnapshotCreationFunctor()

SnapshotCreationFunctor walberla::blockforest::BlockForest::getSnapshotCreationFunctor ( const SnapshotCreationFunction function,
const uint_t  checkFrequency = uint_t(1) 
)
inline

◆ getState()

void walberla::blockforest::BlockForest::getState ( Set< SUID > &  state,
const IBlockID id 
) const
overridevirtual

Returns the block state that corresponds to the block with ID 'id'.

For local blocks, this function is always guaranteed to work. For remote blocks, this function is guaranteed to work properly only if 'containsGlobalBlockInformation() == true'. If the request cannot be satisfied, the simulation must be aborted and the call to this function must not return!

Implements walberla::domain_decomposition::BlockStorage.

◆ getTreeIdDigits()

uint_t walberla::blockforest::BlockForest::getTreeIdDigits ( ) const
inline

◆ insertBuffersIntoProcessNetwork()

bool walberla::blockforest::BlockForest::insertBuffersIntoProcessNetwork ( ) const
inline

◆ limitedDepth()

bool walberla::blockforest::BlockForest::limitedDepth ( ) const
inline

◆ limitedLevels()

bool walberla::blockforest::BlockForest::limitedLevels ( ) const
inline

◆ loadBalancingFunctionRegistered()

bool walberla::blockforest::BlockForest::loadBalancingFunctionRegistered ( ) const
inline

◆ loadBlockData() [1/2]

BlockDataID walberla::blockforest::BlockForest::loadBlockData ( const std::string &  file,
const domain_decomposition::internal::SelectableBlockDataHandlingWrapper dataHandling,
const std::string &  identifier = std::string() 
)
inline

◆ loadBlockData() [2/2]

template<typename T >
BlockDataID walberla::blockforest::BlockForest::loadBlockData ( const std::string &  file,
const shared_ptr< T > &  dataHandling,
const std::string &  identifier = std::string(),
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

◆ phantomBlockMigrationIterations()

uint_t walberla::blockforest::BlockForest::phantomBlockMigrationIterations ( ) const
inline

get number of "setRefreshPhantomBlockMigrationPreparationFunction" calls

◆ recalculateBlockLevelsInRefresh() [1/2]

bool walberla::blockforest::BlockForest::recalculateBlockLevelsInRefresh ( ) const
inline

switches AMR pipeline step 1 on/off

◆ recalculateBlockLevelsInRefresh() [2/2]

void walberla::blockforest::BlockForest::recalculateBlockLevelsInRefresh ( const bool  r)
inline

◆ reevaluateMinTargetLevelsAfterForcedRefinement() [1/2]

bool walberla::blockforest::BlockForest::reevaluateMinTargetLevelsAfterForcedRefinement ( ) const
inline

call setRefreshMinTargetLevelDeterminationFunction callback again after AMR internal refinement to keep 2:1 balance if true, one all-to-all reduction with a boolean value is performed during refresh

◆ reevaluateMinTargetLevelsAfterForcedRefinement() [2/2]

void walberla::blockforest::BlockForest::reevaluateMinTargetLevelsAfterForcedRefinement ( const bool  c)
inline

◆ refresh()

void walberla::blockforest::BlockForest::refresh ( )

Triggers AMR Pipeline.

◆ registerRefreshTimer()

void walberla::blockforest::BlockForest::registerRefreshTimer ( )
private

◆ removeCallbackFunctionAfterBlockDataIsRestored()

void walberla::blockforest::BlockForest::removeCallbackFunctionAfterBlockDataIsRestored ( const uint_t  handle)
inline

◆ removeRefreshCallbackFunctionAfterBlockDataIsUnpacked()

void walberla::blockforest::BlockForest::removeRefreshCallbackFunctionAfterBlockDataIsUnpacked ( const uint_t  handle)
inline

◆ removeRefreshCallbackFunctionBeforeBlockDataIsPacked()

void walberla::blockforest::BlockForest::removeRefreshCallbackFunctionBeforeBlockDataIsPacked ( const uint_t  handle)
inline

◆ removeRefreshCallbackFunctionBeforeBlockDataIsUnpacked()

void walberla::blockforest::BlockForest::removeRefreshCallbackFunctionBeforeBlockDataIsUnpacked ( const uint_t  handle)
inline

◆ restoreSnapshot()

void walberla::blockforest::BlockForest::restoreSnapshot ( const SnapshotRestoreFunction processMapping,
const bool  rebelance = true 
)

◆ rootBlockExists()

bool walberla::blockforest::BlockForest::rootBlockExists ( const uint_t  x,
const uint_t  y,
const uint_t  z 
) const
inline

◆ rootBlockExistsLocally()

bool walberla::blockforest::BlockForest::rootBlockExistsLocally ( const uint_t  x,
const uint_t  y,
const uint_t  z 
) const
inline

◆ rootBlockExistsRemotely()

bool walberla::blockforest::BlockForest::rootBlockExistsRemotely ( const uint_t  x,
const uint_t  y,
const uint_t  z 
) const
inline

◆ saveToFile() [1/3]

void walberla::blockforest::BlockForest::saveToFile ( const std::string &  filename,
const Set< SUID > &  blockStates,
FileIOMode  fileIOMode = MPI_PARALLEL 
) const

Block states are passed by argument (ATTENTION: 'blockStates' must be identical for every process!)

ATTENTION: 'blockStates' must be identical for every process!

◆ saveToFile() [2/3]

void walberla::blockforest::BlockForest::saveToFile ( const std::string &  filename,
FileIOMode  fileIOMode,
const std::map< SUID, std::vector< bool > > &  suidMap,
const uint_t  suidBytes 
) const
private

For a description of the file format see BlockForestFile.h.

Attention
'suidMap' and 'suidBytes' must be identical for every process!
See also
BlockForestFile.h

◆ saveToFile() [3/3]

void walberla::blockforest::BlockForest::saveToFile ( const std::string &  filename,
FileIOMode  fileIOMode = MPI_PARALLEL 
) const

Block states are reduced using MPI.

◆ setRefreshBlockStateDeterminationFunction()

void walberla::blockforest::BlockForest::setRefreshBlockStateDeterminationFunction ( const PhantomBlockForest::BlockStateDeterminationFunction f)
inline

callback which determines the state id (SUID) of the new block during refinement/coarsening

◆ setRefreshMinTargetLevelDeterminationFunction()

void walberla::blockforest::BlockForest::setRefreshMinTargetLevelDeterminationFunction ( const RefreshMinTargetLevelDeterminationFunction f)
inline

callback for AMR pipeline step 1 guaranteed minimal block level

◆ setRefreshPhantomBlockDataAssignmentFunction()

void walberla::blockforest::BlockForest::setRefreshPhantomBlockDataAssignmentFunction ( const PhantomBlockForest::PhantomBlockDataAssignmentFunction f)
inline

callback to assign arbitrary data to a phantom block (used only during load balancing), e.g. weights

◆ setRefreshPhantomBlockDataPackFunction()

void walberla::blockforest::BlockForest::setRefreshPhantomBlockDataPackFunction ( const PhantomBlockForest::PhantomBlockDataPackFunction f)
inline

◆ setRefreshPhantomBlockDataUnpackFunction()

void walberla::blockforest::BlockForest::setRefreshPhantomBlockDataUnpackFunction ( const PhantomBlockForest::PhantomBlockDataUnpackFunction f)
inline

◆ setRefreshPhantomBlockMigrationPreparationFunction()

void walberla::blockforest::BlockForest::setRefreshPhantomBlockMigrationPreparationFunction ( const PhantomBlockForest::MigrationPreparationFunction f)
inline

load balancing algorithm

◆ storeFileHeader()

void walberla::blockforest::BlockForest::storeFileHeader ( std::vector< uint8_t > &  data,
uint_t offset 
) const
private

◆ storesUniformBlockGrid()

bool walberla::blockforest::BlockForest::storesUniformBlockGrid ( ) const
inline

◆ update()

void walberla::blockforest::BlockForest::update ( PhantomBlockForest phantomForest)
private

Friends And Related Function Documentation

◆ BlockInformation

friend class BlockInformation
friend

Member Data Documentation

◆ allowChangingDepth_

bool walberla::blockforest::BlockForest::allowChangingDepth_
private

◆ allowMultipleRefreshCycles_

bool walberla::blockforest::BlockForest::allowMultipleRefreshCycles_
private

◆ alwaysRebalanceInRefresh_

bool walberla::blockforest::BlockForest::alwaysRebalanceInRefresh_
private

◆ blockInformation_

shared_ptr< BlockInformation > walberla::blockforest::BlockForest::blockInformation_
private

◆ blocks_

std::map< BlockID, shared_ptr< Block > > walberla::blockforest::BlockForest::blocks_
private

◆ callbackAfterBlockDataIsRestored_

std::map< uint_t, SnapshotRestoreCallbackFunction > walberla::blockforest::BlockForest::callbackAfterBlockDataIsRestored_
private

◆ callbackAfterBlockDataIsUnpacked_

std::map< uint_t, RefreshCallbackFunction > walberla::blockforest::BlockForest::callbackAfterBlockDataIsUnpacked_
private

◆ callbackBeforeBlockDataIsPacked_

std::map< uint_t, RefreshCallbackFunction > walberla::blockforest::BlockForest::callbackBeforeBlockDataIsPacked_
private

◆ callbackBeforeBlockDataIsUnpacked_

std::map< uint_t, RefreshCallbackFunction > walberla::blockforest::BlockForest::callbackBeforeBlockDataIsUnpacked_
private

◆ checkForEarlyOutAfterLoadBalancing_

bool walberla::blockforest::BlockForest::checkForEarlyOutAfterLoadBalancing_
private

◆ checkForEarlyOutInRefresh_

bool walberla::blockforest::BlockForest::checkForEarlyOutInRefresh_
private

◆ checkForLateOutInRefresh_

bool walberla::blockforest::BlockForest::checkForLateOutInRefresh_
private

◆ depth_

uint_t walberla::blockforest::BlockForest::depth_
private

◆ insertBuffersIntoProcessNetwork_

bool walberla::blockforest::BlockForest::insertBuffersIntoProcessNetwork_
private

◆ modificationStamp_

uint_t walberla::blockforest::BlockForest::modificationStamp_
private

◆ neighborhood_

std::vector< uint_t > walberla::blockforest::BlockForest::neighborhood_
private

◆ nextCallbackAfterBlockDataIsRestoredHandle_

uint_t walberla::blockforest::BlockForest::nextCallbackAfterBlockDataIsRestoredHandle_
private

◆ nextCallbackAfterBlockDataIsUnpackedHandle_

uint_t walberla::blockforest::BlockForest::nextCallbackAfterBlockDataIsUnpackedHandle_
private

◆ nextCallbackBeforeBlockDataIsPackedHandle_

uint_t walberla::blockforest::BlockForest::nextCallbackBeforeBlockDataIsPackedHandle_
private

◆ nextCallbackBeforeBlockDataIsUnpackedHandle_

uint_t walberla::blockforest::BlockForest::nextCallbackBeforeBlockDataIsUnpackedHandle_
private

◆ phantomBlockMigrationIterations_

uint_t walberla::blockforest::BlockForest::phantomBlockMigrationIterations_
private

◆ process_

uint_t walberla::blockforest::BlockForest::process_
private

◆ processIdBytes_

uint_t walberla::blockforest::BlockForest::processIdBytes_
private

◆ recalculateBlockLevelsInRefresh_

bool walberla::blockforest::BlockForest::recalculateBlockLevelsInRefresh_
private

◆ reevaluateMinTargetLevelsAfterForcedRefinement_

bool walberla::blockforest::BlockForest::reevaluateMinTargetLevelsAfterForcedRefinement_
private

◆ refreshBlockStateDeterminationFunction_

PhantomBlockForest::BlockStateDeterminationFunction walberla::blockforest::BlockForest::refreshBlockStateDeterminationFunction_
private

◆ refreshMinTargetLevelDeterminationFunction_

RefreshMinTargetLevelDeterminationFunction walberla::blockforest::BlockForest::refreshMinTargetLevelDeterminationFunction_
private

◆ refreshPhantomBlockDataAssignmentFunction_

PhantomBlockForest::PhantomBlockDataAssignmentFunction walberla::blockforest::BlockForest::refreshPhantomBlockDataAssignmentFunction_
private

◆ refreshPhantomBlockDataPackFunction_

PhantomBlockForest::PhantomBlockDataPackFunction walberla::blockforest::BlockForest::refreshPhantomBlockDataPackFunction_
private

◆ refreshPhantomBlockDataUnpackFunction_

PhantomBlockForest::PhantomBlockDataUnpackFunction walberla::blockforest::BlockForest::refreshPhantomBlockDataUnpackFunction_
private

◆ refreshPhantomBlockMigrationPreparationFunction_

PhantomBlockForest::MigrationPreparationFunction walberla::blockforest::BlockForest::refreshPhantomBlockMigrationPreparationFunction_
private

◆ refreshTiming_

WcTimingPool walberla::blockforest::BlockForest::refreshTiming_
private

◆ size_

uint_t walberla::blockforest::BlockForest::size_[3]
private

◆ snapshot_

std::map< uint_t, mpi::RecvBuffer > walberla::blockforest::BlockForest::snapshot_
private

◆ snapshotBlockDataItems_

uint_t walberla::blockforest::BlockForest::snapshotBlockDataItems_
private

◆ snapshotDepth_

uint_t walberla::blockforest::BlockForest::snapshotDepth_
private

◆ snapshotExists_

bool walberla::blockforest::BlockForest::snapshotExists_
private

◆ treeIdDigits_

uint_t walberla::blockforest::BlockForest::treeIdDigits_
private

The documentation for this class was generated from the following files:
iterator begin(const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
iterator for traversing all locally allocated blocks
Definition: BlockStorage.h:193
Iterator end()
Definition: Create.h:71