chombo-discharge
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
LevelTiles Class Reference

Class for storing the AMR hierarchy as a collection of tiles. More...

#include <CD_LevelTiles.H>

Classes

struct  LevelAndBox
 Result of a point->block query. See findDestination. More...
 
struct  TileHasher
 Hash functor for using IntVect tiles as unordered_map keys. More...
 

Public Types

using BoxIDs = std::pair< unsigned int, unsigned int >
 alias type alias.
 

Public Member Functions

 LevelTiles () noexcept
 Weak constructor. Must subsequently call the define function.
 
 LevelTiles (const DisjointBoxLayout &a_dbl, const int a_minBlockSize) noexcept
 Full constructor - puts object in usable state.
 
virtual ~LevelTiles () noexcept
 Destructor (does nothing)
 
virtual void define (const DisjointBoxLayout &a_dbl, const int a_minBlockSize) noexcept
 Define function. Puts object in usable state.
 
virtual const std::unordered_map< IntVect, unsigned int, TileHasher > & getMyTiles () const noexcept
 Get the tiles owned by this rank.
 
virtual const std::unordered_map< IntVect, BoxIDs, TileHasher > & getOtherTiles () const noexcept
 Get the tiles owned by other ranks.
 
virtual const std::unordered_map< unsigned int, DataIndex > & getMyGrids () const noexcept
 Get the mapping of grid index to DataIndex.
 

Static Public Member Functions

static LevelAndBox findDestination (const RealVect &a_pos, const RealVect &a_probLo, const Vector< RealVect > &a_dx, const int a_minBlockSize, const Vector< RefCountedPtr< LevelTiles > > &a_levelTiles, const int a_finestLevel) noexcept
 Map a physical position to its owning (level, grid index, rank) via the finest containing tile.
 

Protected Attributes

bool m_isDefined
 Is defined or not.
 
std::unordered_map< IntVect, unsigned int, TileHasherm_myTiles
 "Tiles" owned by this rank
 
std::unordered_map< IntVect, BoxIDs, TileHasherm_otherTiles
 Grids owned by other ranks.
 
std::unordered_map< unsigned int, DataIndex > m_myGrids
 Mapping of grid index to DataIndex.
 

Detailed Description

Class for storing the AMR hierarchy as a collection of tiles.

This class decomposes the AMR hierarchy into uniform tiles, each tile being the cells spanned by a minBlockSize^SpaceDim grid patch, and maps each tile to the grid box that contains it. Boxes may be larger than one tile (variable-sized/anisotropic boxes that are unions of aligned minBlockSize tiles): such a box is registered under every tile it covers, so the tile->box map stays uniform and a point->tile->box lookup is O(1). When minBlockSize == maxBlockSize every box is exactly one tile (the one-tile-per-box fast path).

Constructor & Destructor Documentation

◆ LevelTiles()

LevelTiles::LevelTiles ( const DisjointBoxLayout &  a_dbl,
const int  a_minBlockSize 
)
noexcept

Full constructor - puts object in usable state.

Parameters
[in]a_dblGrids
[in]a_minBlockSizeGrid size.

Member Function Documentation

◆ define()

void LevelTiles::define ( const DisjointBoxLayout &  a_dbl,
const int  a_minBlockSize 
)
virtualnoexcept

Define function. Puts object in usable state.

Parameters
[in]a_dblGrids
[in]a_minBlockSizeGrid size.

◆ findDestination()

static LevelAndBox LevelTiles::findDestination ( const RealVect &  a_pos,
const RealVect &  a_probLo,
const Vector< RealVect > &  a_dx,
const int  a_minBlockSize,
const Vector< RefCountedPtr< LevelTiles > > &  a_levelTiles,
const int  a_finestLevel 
)
inlinestaticnoexcept

Map a physical position to its owning (level, grid index, rank) via the finest containing tile.

Shared, header-inlined point->block core used by both ParticleContainer::findDestination (the per-particle remap hot path) and Realm::getLevelAndBox. The position is mapped to a min-block-size tile by integer division, then looked up in each level's tile->box hash, finest level first. It is O(1) per level (a tile computation plus an unordered_map lookup), never a linear scan over patches, and works for variable-sized/anisotropic boxes because every box is registered under all the min tiles it covers.

Parameters
[in]a_posPhysical position to locate.
[in]a_probLoLower-left corner of the domain.
[in]a_dxPer-level grid spacing, indexed [level][dir] (isotropic per level).
[in]a_minBlockSizeTile size in cells (min_block_size).
[in]a_levelTilesPer-level tile->box maps (the single source of truth).
[in]a_finestLevelFinest AMR level to search.
Returns
{level, gridIndex, rank, valid}; valid==false (other fields unspecified) if no tile owns the cell.

◆ getMyGrids()

const std::unordered_map< unsigned int, DataIndex > & LevelTiles::getMyGrids ( ) const
virtualnoexcept

Get the mapping of grid index to DataIndex.

Returns
m_myGrids

◆ getMyTiles()

const std::unordered_map< IntVect, unsigned int, LevelTiles::TileHasher > & LevelTiles::getMyTiles ( ) const
virtualnoexcept

Get the tiles owned by this rank.

Returns
m_myTiles

◆ getOtherTiles()

const std::unordered_map< IntVect, LevelTiles::BoxIDs, LevelTiles::TileHasher > & LevelTiles::getOtherTiles ( ) const
virtualnoexcept

Get the tiles owned by other ranks.

Returns
m_otherTiles

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