Class jalansim::map::MapCollection

template <typename T>

ClassList > jalansim > map > MapCollection

Collection of maps for random sampling in batch simulations. More...

  • #include <map_collection.hpp>

Public Functions

Type Name
MapCollection (int initial_capacity=10)
Constructor with initial capacity allocation.
MapCollection (const MapCollection &) = delete
JALANSIM_HOST_DEVICE void add_map (Map< T > * map_to_add)
Add a map to the collection.
JALANSIM_HOST_DEVICE Map< T > * get (int idx) const
Get a map by index.
JALANSIM_HOST_DEVICE int get_capacity () const
Get the maximum capacity of the collection.
JALANSIM_HOST_DEVICE int get_count () const
Get the current number of maps in the collection.
MapCollection & operator= (const MapCollection &) = delete
JALANSIM_HOST_DEVICE Map< T > * sample (unsigned int & rng_seed)
Sample a random map using provided RNG seed.
Map< T > * sample ()
Sample a random map using system RNG (CPU only).
~MapCollection ()
Destructor cleans up allocated memory.

Detailed Description

Manages a dynamic array of Map pointers that can be randomly sampled for use in batch simulations. Supports both CPU and GPU execution with appropriate memory allocation (CUDA managed memory when available). Provides deterministic random sampling using XOR-shift PRNG for reproducible results across CPU/GPU platforms.

Template parameters:

  • T Numeric type used by the contained maps (float, double)

Public Functions Documentation

function MapCollection [1/2]

Constructor with initial capacity allocation.

inline explicit jalansim::map::MapCollection::MapCollection (
    int initial_capacity=10
) 

Parameters:

  • initial_capacity Maximum number of maps to store (default: 10)

function MapCollection [2/2]

jalansim::map::MapCollection::MapCollection (
    const MapCollection &
) = delete

function add_map

Add a map to the collection.

inline JALANSIM_HOST_DEVICE void jalansim::map::MapCollection::add_map (
    Map < T > * map_to_add
) 

Parameters:

  • map_to_add Pointer to map to add (ignored if null or capacity full)

function get

Get a map by index.

inline JALANSIM_HOST_DEVICE Map < T > * jalansim::map::MapCollection::get (
    int idx
) const

Parameters:

  • idx Index of map to retrieve

Returns:

Pointer to map at index, or nullptr if index invalid


function get_capacity

Get the maximum capacity of the collection.

inline JALANSIM_HOST_DEVICE int jalansim::map::MapCollection::get_capacity () const

Returns:

Maximum number of maps that can be stored


function get_count

Get the current number of maps in the collection.

inline JALANSIM_HOST_DEVICE int jalansim::map::MapCollection::get_count () const

Returns:

Number of maps currently stored


function operator=

MapCollection & jalansim::map::MapCollection::operator= (
    const MapCollection &
) = delete

function sample [1/2]

Sample a random map using provided RNG seed.

inline JALANSIM_HOST_DEVICE Map < T > * jalansim::map::MapCollection::sample (
    unsigned int & rng_seed
) 

Parameters:

  • rng_seed Reference to RNG seed (modified for deterministic sequence)

Returns:

Pointer to randomly selected map, or nullptr if collection empty


function sample [2/2]

Sample a random map using system RNG (CPU only).

inline Map < T > * jalansim::map::MapCollection::sample () 

Returns:

Pointer to randomly selected map, or nullptr if collection empty


function ~MapCollection

Destructor cleans up allocated memory.

inline jalansim::map::MapCollection::~MapCollection () 


The documentation for this class was generated from the following file include/jalansim/map/map_collection.hpp