Class StateReader

Inheritance Relationships

Derived Types

Class Documentation

class StateReader

Abstract representation of a class for importing model data (agent population data, environment properties, run configuration) from file

See also

XMLStateReader The XML implementation of a StateReader

See also

JSONStateReader The JSON implementation of a StateReader

Subclassed by flamegpu::io::JSONStateReader, flamegpu::io::XMLStateReader

Public Functions

inline virtual ~StateReader()

Virtual destructor for correct inheritance behaviour

virtual void parse(const std::string &input_file, const std::shared_ptr<const ModelData> &model, Verbosity verbosity) = 0

Loads the file to an internal data-structure

Parameters:
  • input_file – Path to file to be read

  • model – Model description to ensure file loaded is suitable

  • verbosity – Verbosity level to use during load

void getFullModelState(Simulation::Config &s_cfg, std::unordered_map<std::string, detail::Any> &environment_init, std::unordered_map<std::string, std::vector<char>> &macro_environment_init, util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> &agents_init)

Grab the full simulation state from the input file

Note

CUDASimulation Config is not included and should be requested separately

void getSimulationConfig(Simulation::Config &cfg)

Overwrite the provided simulation config with the one loaded from file

Parameters:

cfg – The config struct to be overwritten

Throws:

If – the parsed file did not contain a simulation config or a file has not been parsed

void getCUDAConfig(CUDASimulation::Config &cfg)

Overwrite the provided CUDA config with the one loaded from file

Parameters:

cfg – The config struct to be overwritten

Throws:

If – the parsed file did not contain a CUDA config or a file has not been parsed

void getEnvironment(std::unordered_map<std::string, detail::Any> &environment_init)
void getMacroEnvironment(std::unordered_map<std::string, std::vector<char>> &macro_environment_init)
void getAgents(util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> &agents_init)

Protected Functions

void resetCache()

Protected Attributes

std::string input_filepath
std::unordered_map<std::string, std::any> simulation_config
std::unordered_map<std::string, std::any> cuda_config
std::unordered_map<std::string, detail::Any> env_init
std::unordered_map<std::string, std::vector<char>> macro_env_init
util::StringPairUnorderedMap<std::shared_ptr<AgentVector>> agents_map