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

Manages particle sizes and validates site occupancy constraints. More...

#include <ParticleSizeManager.h>

Public Member Functions

 ParticleSizeManager (uint32_t maxParticleTypes=256)
 Constructor with maximum particle types.
 ~ParticleSizeManager ()=default
 Destructor.
void setParticleSize (particle_t particleType, uint32_t size)
 Set the size for a specific particle type.
uint32_t getParticleSize (particle_t particleType) const
 Get the size for a specific particle type.
uint32_t calculateSiteOccupancy (const particle_t *particles, site_size_t count) const
 Calculate total size of particles at a site.
bool canAddParticle (const particle_t *particles, site_size_t count, particle_t newParticle, uint32_t maxCapacity) const
 Check if adding a particle would exceed capacity.
bool canAddParticles (const particle_t *particles, site_size_t count, const particle_t *newParticles, site_size_t newCount, uint32_t maxCapacity) const
 Check if particles can be added without exceeding capacity.
uint32_t getMaxParticleCount (particle_t particleType, uint32_t currentOccupancy, uint32_t maxCapacity) const
 Get maximum number of particles of a type that can fit.
void validateConfiguration () const
 Validate particle size configuration.
const std::vector< uint32_t > & getParticleSizes () const
 Get all configured particle sizes.
void clear ()
 Clear all particle size configurations.
size_t getConfiguredParticleCount () const
 Get number of configured particle types.
void setParticleSizesFromDict (const std::map< particle_t, uint32_t > &sizeDict)
 Set particle sizes from a dictionary/map.
std::map< particle_t, uint32_t > getParticleSizesDict () const
 Get particle sizes as a dictionary/map.

Detailed Description

Manages particle sizes and validates site occupancy constraints.

This class provides efficient particle size tracking and capacity validation for RDME simulations. It ensures that particles with different sizes don't exceed the maximum occupancy limit of lattice sites.

Constructor & Destructor Documentation

◆ ParticleSizeManager()

lm::rdme::ParticleSizeManager::ParticleSizeManager ( uint32_t maxParticleTypes = 256)
explicit

Constructor with maximum particle types.

Parameters
maxParticleTypesMaximum number of particle types to support

◆ ~ParticleSizeManager()

lm::rdme::ParticleSizeManager::~ParticleSizeManager ( )
default

Destructor.

Member Function Documentation

◆ calculateSiteOccupancy()

uint32_t lm::rdme::ParticleSizeManager::calculateSiteOccupancy ( const particle_t * particles,
site_size_t count ) const

Calculate total size of particles at a site.

Parameters
particlesArray of particle types at the site
countNumber of particles at the site
Returns
Total size of all particles
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canAddParticle()

bool lm::rdme::ParticleSizeManager::canAddParticle ( const particle_t * particles,
site_size_t count,
particle_t newParticle,
uint32_t maxCapacity ) const

Check if adding a particle would exceed capacity.

Parameters
particlesCurrent particles at the site
countCurrent number of particles
newParticleParticle type to add
maxCapacityMaximum capacity of the site
Returns
True if particle can be added without exceeding capacity
Here is the call graph for this function:

◆ canAddParticles()

bool lm::rdme::ParticleSizeManager::canAddParticles ( const particle_t * particles,
site_size_t count,
const particle_t * newParticles,
site_size_t newCount,
uint32_t maxCapacity ) const

Check if particles can be added without exceeding capacity.

Parameters
particlesCurrent particles at the site
countCurrent number of particles
newParticlesArray of particle types to add
newCountNumber of new particles to add
maxCapacityMaximum capacity of the site
Returns
True if all particles can be added without exceeding capacity
Here is the call graph for this function:

◆ clear()

void lm::rdme::ParticleSizeManager::clear ( )

Clear all particle size configurations.

◆ getConfiguredParticleCount()

size_t lm::rdme::ParticleSizeManager::getConfiguredParticleCount ( ) const

Get number of configured particle types.

Returns
Number of particle types with configured sizes

◆ getMaxParticleCount()

uint32_t lm::rdme::ParticleSizeManager::getMaxParticleCount ( particle_t particleType,
uint32_t currentOccupancy,
uint32_t maxCapacity ) const

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

Parameters
particleTypeThe particle type
currentOccupancyCurrent site occupancy
maxCapacityMaximum site capacity
Returns
Maximum number of particles that can fit
Here is the call graph for this function:

◆ getParticleSize()

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

Get the size for a specific particle type.

Parameters
particleTypeThe particle type ID
Returns
The size of the particle (default is 1 if not set)
Here is the caller graph for this function:

◆ getParticleSizes()

const std::vector< uint32_t > & lm::rdme::ParticleSizeManager::getParticleSizes ( ) const

Get all configured particle sizes.

Returns
Vector of particle sizes indexed by particle type

◆ getParticleSizesDict()

std::map< particle_t, uint32_t > lm::rdme::ParticleSizeManager::getParticleSizesDict ( ) const

Get particle sizes as a dictionary/map.

Returns
Map of particle type to size for all configured particles

◆ setParticleSize()

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

Set the size for a specific particle type.

Parameters
particleTypeThe particle type ID
sizeThe size of the particle (must be > 0)
Exceptions
InvalidArgExceptionif size is 0 or particleType is invalid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setParticleSizesFromDict()

void lm::rdme::ParticleSizeManager::setParticleSizesFromDict ( const std::map< particle_t, uint32_t > & sizeDict)

Set particle sizes from a dictionary/map.

Parameters
sizeDictMap of particle type to size
Here is the call graph for this function:

◆ validateConfiguration()

void lm::rdme::ParticleSizeManager::validateConfiguration ( ) const

Validate particle size configuration.

Exceptions
InvalidArgExceptionif configuration is invalid

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