13#ifndef CD_PARTICLEGHOSTMASK_H
14#define CD_PARTICLEGHOSTMASK_H
23#include <BoxIterator.H>
24#include <LayoutData.H>
25#include <RefCountedPtr.H>
30#include <CD_NamespaceHeader.H>
70 define(
const Box& a_box)
noexcept;
113 addTarget(const IntVect& a_iv, const
LevelTiles::BoxIDs& a_target, const Box& a_targetBox) noexcept;
126 box() const noexcept;
134 numTargets(const IntVect& a_iv) const noexcept;
143 target(const IntVect& a_iv, const
int a_i) const noexcept;
161 targetRank(const IntVect& a_iv, const
int a_i) const noexcept;
171 targetBox(const IntVect& a_iv, const
int a_i) const noexcept;
212#include <CD_NamespaceFooter.H>
Declaration of LevelTiles.
Implementation of CD_ParticleGhostMask.H.
Vector< RefCountedPtr< LayoutData< ParticleGhostMask > > > AMRParticleGhostMask
AMR-wide particle ghost-target lookup: one per-box CSR table per level, indexed by SOURCE level.
Definition CD_ParticleGhostMask.H:210
Class for storing the AMR hierarchy as a collection of tiles.
Definition CD_LevelTiles.H:43
Per-box CSR lookup from a source cell to the destination boxes whose ghosted region covers it.
Definition CD_ParticleGhostMask.H:53
void define(const Box &a_box) noexcept
Reset to an empty table over a box (every cell has zero targets).
Definition CD_ParticleGhostMaskImplem.H:21
const Box & box() const noexcept
Get the box that the source cells live on.
Definition CD_ParticleGhostMaskImplem.H:90
unsigned int targetGridIndex(const IntVect &a_iv, const int a_i) const noexcept
Get the destination grid index of the i-th target for a cell.
Definition CD_ParticleGhostMaskImplem.H:116
const Box & targetBox(const IntVect &a_iv, const int a_i) const noexcept
Get the acceptance box of the i-th target for a cell.
Definition CD_ParticleGhostMaskImplem.H:128
ParticleGhostMask()=default
Default constructor. Leaves the table undefined; call define() before use.
int numTargets(const IntVect &a_iv) const noexcept
Get the number of scatter targets for a cell.
Definition CD_ParticleGhostMaskImplem.H:100
void allocate() noexcept
Build step between the passes: turn the per-cell counts into CSR offsets and size the packed target a...
Definition CD_ParticleGhostMaskImplem.H:39
const LevelTiles::BoxIDs & target(const IntVect &a_iv, const int a_i) const noexcept
Get the i-th scatter target for a cell.
Definition CD_ParticleGhostMaskImplem.H:108
unsigned int targetRank(const IntVect &a_iv, const int a_i) const noexcept
Get the receiving rank of the i-th target for a cell.
Definition CD_ParticleGhostMaskImplem.H:122
void allocateTargetBoxes() noexcept
Optional build step: size the per-target acceptance-box array to match the packed target array.
Definition CD_ParticleGhostMaskImplem.H:53
std::vector< LevelTiles::BoxIDs > m_flat
Packed targets, size == sum(m_count).
Definition CD_ParticleGhostMask.H:199
bool hasTargetBoxes() const noexcept
Whether this mask carries per-target acceptance boxes.
Definition CD_ParticleGhostMaskImplem.H:137
~ParticleGhostMask()=default
Destructor.
void addTarget(const IntVect &a_iv, const LevelTiles::BoxIDs &a_target) noexcept
Build pass 2: append one target for cell a_iv.
Definition CD_ParticleGhostMaskImplem.H:59
BaseFab< int > m_start
Per cell: first index into m_flat, or -1 if the cell has no targets.
Definition CD_ParticleGhostMask.H:189
BaseFab< int > m_count
Per cell: number of targets.
Definition CD_ParticleGhostMask.H:194
void finalize() noexcept
Finish the build: rewind m_start (advanced by addTarget) back to the CSR start offsets.
Definition CD_ParticleGhostMaskImplem.H:82
Box m_box
Box that the source cells (and m_start/m_count) live on.
Definition CD_ParticleGhostMask.H:184
void incrementCount(const IntVect &a_iv) noexcept
Build pass 1: register that cell a_iv gains one more target.
Definition CD_ParticleGhostMaskImplem.H:33
std::vector< Box > m_flatBox
Packed per-target acceptance boxes, parallel to m_flat. Empty unless the mask carries them.
Definition CD_ParticleGhostMask.H:204