Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
lm::rdme::ByteLatticeExtended Class Reference

Extended ByteLattice with particle size awareness. More...

#include <ByteLatticeExtended.h>

Inheritance diagram for lm::rdme::ByteLatticeExtended:
[legend]
Collaboration diagram for lm::rdme::ByteLatticeExtended:
[legend]

Public Member Functions

 ByteLatticeExtended (lattice_coord_t size, si_dist_t spacing, uint particlesPerSite, bool enableSizeChecking=true)
 Constructor with particle size support.
 ByteLatticeExtended (lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, si_dist_t spacing, uint particlesPerSite, bool enableSizeChecking=true)
 Constructor with particle size support.
virtual ~ByteLatticeExtended ()=default
 Destructor.
void setParticleSize (particle_t particleType, uint32_t size)
 Set the size for a particle type.
uint32_t getParticleSize (particle_t particleType) const
 Get the size for a particle type.
uint32_t getSizeBasedOccupancy (lattice_size_t x, lattice_size_t y, lattice_size_t z) const
 Get current occupancy considering particle sizes.
uint32_t getSizeBasedOccupancy (lattice_size_t subvolume) const
 Get current occupancy considering particle sizes.
bool canAddParticle (lattice_size_t x, lattice_size_t y, lattice_size_t z, particle_t particle) const
 Check if particle can be added without exceeding capacity.
bool canAddParticle (lattice_size_t subvolume, particle_t particle) const
 Check if particle can be added without exceeding capacity.
virtual void addParticleWithSizeCheck (lattice_size_t x, lattice_size_t y, lattice_size_t z, particle_t particle)
 Add particle with size validation.
virtual void addParticleWithSizeCheck (lattice_size_t subvolume, particle_t particle)
 Add particle with size validation.
uint32_t getMaxParticleCount (lattice_size_t x, lattice_size_t y, lattice_size_t z, particle_t particleType) const
 Get maximum number of particles of a type that can fit.
uint32_t getMaxParticleCount (lattice_size_t subvolume, particle_t particleType) const
 Get maximum number of particles of a type that can fit.
void setSizeCheckingEnabled (bool enable)
 Enable or disable size checking.
bool isSizeCheckingEnabled () const
 Check if size checking is enabled.
const ParticleSizeManagergetParticleSizeManager () const
 Get the particle size manager.
void validateSizeConstraints () const
 Validate entire lattice for size constraints.
std::map< uint32_t, uint32_t > getSizeBasedOccupancyStats () const
 Get occupancy statistics considering particle sizes.
Public Member Functions inherited from lm::rdme::ByteLattice
virtual site_t getMaxSiteType () const
 Get the maximum number of site types possible in the lattice.
virtual particle_t getMaxParticle () const
 Get the maximum number of particle types possible in the lattice.
virtual site_size_t getMaxOccupancy () const
 Get the maximum number of particles that can live in a site.
 ByteLattice (lattice_coord_t size, si_dist_t spacing, uint particlesPerSite)
 ByteLattice (lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, si_dist_t spacing, uint particlesPerSite)
virtual ~ByteLattice ()
virtual void getNeighboringSites (lattice_size_t index, lattice_size_t *neighboringIndices)
 Get the sites that are neighbor to the indicated site.
virtual site_t getSiteType (lattice_size_t x, lattice_size_t y, lattice_size_t z) const
 Get the site type at the specified location.
virtual site_t getSiteType (lattice_size_t subvolume) const
 Get the site type at the specified location.
virtual void setSiteType (lattice_size_t x, lattice_size_t y, lattice_size_t z, site_t siteType)
 Set the site type at the specified location.
virtual void setSiteType (lattice_size_t subvolume, site_t site)
 Set the site type at the specified location.
void copySites (void *destBuffer, size_t latticeSize)
virtual site_size_t getOccupancy (lattice_size_t x, lattice_size_t y, lattice_size_t z) const
 Get the number of particles in the specified lattice site.
virtual site_size_t getOccupancy (lattice_size_t subvolume) const
 Get the number of particles in the specified lattice site.
virtual particle_t getParticle (lattice_size_t x, lattice_size_t y, lattice_size_t z, site_size_t particleIndex) const
 Get the particle at the specified site with at the specified number in the particle list.
virtual particle_t getParticle (lattice_size_t subvolume, site_size_t particleIndex) const
 Get the particle at the specified site with at the specified number in the particle list.
virtual void addParticle (lattice_size_t x, lattice_size_t y, lattice_size_t z, particle_t particle)
 Add a particle to the specified site.
virtual void addParticle (lattice_size_t subvolume, particle_t particle)
 Add a particle to the specified site.
virtual void removeParticles (lattice_size_t x, lattice_size_t y, lattice_size_t z)
 Remove a particle to the specified site.
virtual void removeParticles (lattice_size_t subvolume)
 Remove a particle to the specified site.
virtual void removeAllParticles ()
 Empty all particles from the specified site.
virtual std::map< particle_t, uintgetParticleCounts ()
 Get the number of each particle type in the lattice.
virtual std::vector< particle_loc_tfindParticles (particle_t minParticleType, particle_t maxParticleType)
 Get the number of the specified particles types in the lattice.
virtual void setFromRowMajorByteData (void *buffer, size_t bufferSize)
virtual void setSitesFromRowMajorByteData (void *buffer, size_t bufferSize)
virtual void getParticleLatticeView (uint8_t **particleLattice, int *Nw, int *Nz, int *Ny, int *Nx, int *Np)
virtual void getSiteLatticeView (uint8_t **siteLattice, int *Nz, int *Ny, int *Nx)
virtual size_t getLatticeMemorySize () const
Public Member Functions inherited from lm::rdme::Lattice
 Lattice (lattice_coord_t size, si_dist_t spacing)
 Create a Lattice object.
 Lattice (lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, si_dist_t spacing)
 Create a Lattice object.
virtual ~Lattice ()
 Destroy the Lattice object.
virtual lattice_coord_t getSize () const
 Get size of the Lattice.
virtual lattice_size_t getXSize () const
 Get x dimension of the Lattice.
virtual lattice_size_t getYSize () const
 Get y dimension of the Lattice.
virtual lattice_size_t getZSize () const
 Get z dimension of the Lattice.
virtual lattice_size_t getNumberSites () const
 Get total number of sites in the Lattice.
virtual si_dist_t getSpacing () const
 Get spacing between lattice sites.
std::vector< lattice_coord_tgetNearbySites (lattice_size_t xc, lattice_size_t yc, lattice_size_t zc, uint minDistance, uint maxDistance)
 Get a list of sites near the specified site within a certain distance.
virtual void print () const
 Print the lattice to the console.

Protected Member Functions

site_size_t getParticlesAtSite (lattice_size_t subvolume, particle_t *particles, site_size_t maxCount) const
 Get particles at a site for size calculation.
Protected Member Functions inherited from lm::rdme::ByteLattice
virtual void allocateMemory ()
virtual void deallocateMemory ()
virtual uint32_t * getParticlesMemory ()
virtual uint8_t * getSitesMemory ()

Protected Attributes

std::unique_ptr< ParticleSizeManagersizeManager_
 Particle size manager.
bool sizeCheckingEnabled_
 Enable size validation.
uint32_t maxSiteCapacity_
 Maximum site capacity.
Protected Attributes inherited from lm::rdme::ByteLattice
size_t wordsPerSite
uint32_t * particles
uint8_t * siteTypes
Protected Attributes inherited from lm::rdme::Lattice
lattice_coord_t size
lattice_size_t numberSites
si_dist_t spacing

Additional Inherited Members

Static Public Member Functions inherited from lm::rdme::ByteLattice
static void nativeSerialize (void *destBuffer, void *lattice, size_t latticeSize)
static void nativeSerializeSites (void *destBuffer, void *lattice, size_t latticeSize)
static void copyNativeToRowMajorByte (void *destBuffer, void *sourceBuffer, lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, uint particlesPerSite, size_t bufferSize)
static void copyRowMajorByteToNative (void *destBuffer, void *sourceBuffer, lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, uint particlesPerSite, size_t bufferSize)
static void copySitesRowMajorByteToNative (void *destBuffer, void *sourceBuffer, lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, size_t bufferSize)
static void copySitesNativeToRowMajorByte (void *destBuffer, void *sourceBuffer, lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, size_t bufferSize)
Static Public Member Functions inherited from lm::rdme::Lattice
static void rowMajorByteSerialize (void *destBuffer, void *lattice, size_t bufferSize)
static void rowMajorIntSerialize (void *destBuffer, void *lattice, size_t bufferSize)
static void rowMajorByteSerializeSites (void *destBuffer, void *lattice, size_t bufferSize)

Detailed Description

Extended ByteLattice with particle size awareness.

This class extends the standard ByteLattice to support particles with different sizes, providing capacity validation and overflow prevention.

Constructor & Destructor Documentation

◆ ByteLatticeExtended() [1/2]

lm::rdme::ByteLatticeExtended::ByteLatticeExtended ( lattice_coord_t size,
si_dist_t spacing,
uint particlesPerSite,
bool enableSizeChecking = true )

Constructor with particle size support.

Parameters
sizeLattice dimensions
spacingLattice spacing
particlesPerSiteMaximum particles per site
enableSizeCheckingEnable particle size validation (default: true)
Here is the call graph for this function:

◆ ByteLatticeExtended() [2/2]

lm::rdme::ByteLatticeExtended::ByteLatticeExtended ( lattice_size_t xSize,
lattice_size_t ySize,
lattice_size_t zSize,
si_dist_t spacing,
uint particlesPerSite,
bool enableSizeChecking = true )

Constructor with particle size support.

Parameters
xSizeX dimension
ySizeY dimension
zSizeZ dimension
spacingLattice spacing
particlesPerSiteMaximum particles per site
enableSizeCheckingEnable particle size validation (default: true)
Here is the call graph for this function:

◆ ~ByteLatticeExtended()

virtual lm::rdme::ByteLatticeExtended::~ByteLatticeExtended ( )
virtualdefault

Destructor.

Member Function Documentation

◆ addParticleWithSizeCheck() [1/2]

void lm::rdme::ByteLatticeExtended::addParticleWithSizeCheck ( lattice_size_t subvolume,
particle_t particle )
virtual

Add particle with size validation.

Parameters
subvolumeSubvolume index
particleParticle type to add
Exceptions
ParticleSizeExceptionif adding would exceed capacity
Here is the call graph for this function:

◆ addParticleWithSizeCheck() [2/2]

void lm::rdme::ByteLatticeExtended::addParticleWithSizeCheck ( lattice_size_t x,
lattice_size_t y,
lattice_size_t z,
particle_t particle )
virtual

Add particle with size validation.

Parameters
xX coordinate
yY coordinate
zZ coordinate
particleParticle type to add
Exceptions
ParticleSizeExceptionif adding would exceed capacity
Here is the call graph for this function:

◆ canAddParticle() [1/2]

bool lm::rdme::ByteLatticeExtended::canAddParticle ( lattice_size_t subvolume,
particle_t particle ) const

Check if particle can be added without exceeding capacity.

Parameters
subvolumeSubvolume index
particleParticle type to add
Returns
True if particle can be added
Here is the call graph for this function:

◆ canAddParticle() [2/2]

bool lm::rdme::ByteLatticeExtended::canAddParticle ( lattice_size_t x,
lattice_size_t y,
lattice_size_t z,
particle_t particle ) const

Check if particle can be added without exceeding capacity.

Parameters
xX coordinate
yY coordinate
zZ coordinate
particleParticle type to add
Returns
True if particle can be added
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxParticleCount() [1/2]

uint32_t lm::rdme::ByteLatticeExtended::getMaxParticleCount ( lattice_size_t subvolume,
particle_t particleType ) const

Get maximum number of particles of a type that can fit.

Parameters
subvolumeSubvolume index
particleTypeParticle type
Returns
Maximum number of particles that can fit
Here is the call graph for this function:

◆ getMaxParticleCount() [2/2]

uint32_t lm::rdme::ByteLatticeExtended::getMaxParticleCount ( lattice_size_t x,
lattice_size_t y,
lattice_size_t z,
particle_t particleType ) const

Get maximum number of particles of a type that can fit.

Parameters
xX coordinate
yY coordinate
zZ coordinate
particleTypeParticle type
Returns
Maximum number of particles that can fit
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParticlesAtSite()

site_size_t lm::rdme::ByteLatticeExtended::getParticlesAtSite ( lattice_size_t subvolume,
particle_t * particles,
site_size_t maxCount ) const
protected

Get particles at a site for size calculation.

Parameters
subvolumeSubvolume index
particlesOutput array for particles
maxCountMaximum particles to retrieve
Returns
Number of particles retrieved
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParticleSize()

uint32_t lm::rdme::ByteLatticeExtended::getParticleSize ( particle_t particleType) const

Get the size for a particle type.

Parameters
particleTypeParticle type ID
Returns
Size of the particle (default: 1)

◆ getParticleSizeManager()

const ParticleSizeManager & lm::rdme::ByteLatticeExtended::getParticleSizeManager ( ) const

Get the particle size manager.

Returns
Reference to the particle size manager

◆ getSizeBasedOccupancy() [1/2]

uint32_t lm::rdme::ByteLatticeExtended::getSizeBasedOccupancy ( lattice_size_t subvolume) const

Get current occupancy considering particle sizes.

Parameters
subvolumeSubvolume index
Returns
Total size of particles at the site
Here is the call graph for this function:

◆ getSizeBasedOccupancy() [2/2]

uint32_t lm::rdme::ByteLatticeExtended::getSizeBasedOccupancy ( lattice_size_t x,
lattice_size_t y,
lattice_size_t z ) const

Get current occupancy considering particle sizes.

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
Total size of particles at the site
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSizeBasedOccupancyStats()

std::map< uint32_t, uint32_t > lm::rdme::ByteLatticeExtended::getSizeBasedOccupancyStats ( ) const

Get occupancy statistics considering particle sizes.

Returns
Map of site occupancy -> count of sites
Here is the call graph for this function:

◆ isSizeCheckingEnabled()

bool lm::rdme::ByteLatticeExtended::isSizeCheckingEnabled ( ) const

Check if size checking is enabled.

Returns
True if size checking is enabled

◆ setParticleSize()

void lm::rdme::ByteLatticeExtended::setParticleSize ( particle_t particleType,
uint32_t size )

Set the size for a particle type.

Parameters
particleTypeParticle type ID
sizeSize of the particle (must be > 0)

◆ setSizeCheckingEnabled()

void lm::rdme::ByteLatticeExtended::setSizeCheckingEnabled ( bool enable)

Enable or disable size checking.

Parameters
enableTrue to enable size checking
Here is the call graph for this function:

◆ validateSizeConstraints()

void lm::rdme::ByteLatticeExtended::validateSizeConstraints ( ) const

Validate entire lattice for size constraints.

Exceptions
ParticleSizeExceptionif any site violates size constraints
Here is the call graph for this function:

Member Data Documentation

◆ maxSiteCapacity_

uint32_t lm::rdme::ByteLatticeExtended::maxSiteCapacity_
protected

Maximum site capacity.

◆ sizeCheckingEnabled_

bool lm::rdme::ByteLatticeExtended::sizeCheckingEnabled_
protected

Enable size validation.

◆ sizeManager_

std::unique_ptr<ParticleSizeManager> lm::rdme::ByteLatticeExtended::sizeManager_
protected

Particle size manager.


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