diff --git a/swig/python/flamegpu.i b/swig/python/flamegpu.i index 9dbf3cb8e..5a0f54c7b 100644 --- a/swig/python/flamegpu.i +++ b/swig/python/flamegpu.i @@ -359,7 +359,7 @@ class FLAMEGPURuntimeException : public std::exception { // Ignore const'd accessors for configuration structs, which were mutable in python. %ignore flamegpu::CUDASimulation::getCUDAConfig; %ignore flamegpu::CUDAEnsemble::getConfig; -// %ignore flamegpu::Simulation::getConfig; // This doesn't currently exist +%ignore flamegpu::Simulation::getSimulationConfig; // This doesn't currently exist // Ignore the detail namespace, as it's not intended to be user-facing %ignore flamegpu::detail; diff --git a/tests/swig/python/gpu/test_cuda_simulation.py b/tests/swig/python/gpu/test_cuda_simulation.py index b5544e2c3..c9457d81b 100644 --- a/tests/swig/python/gpu/test_cuda_simulation.py +++ b/tests/swig/python/gpu/test_cuda_simulation.py @@ -38,77 +38,77 @@ def test_argparse_inputfile_long(self): m = pyflamegpu.ModelDescription("test_argparse_inputfile_long") c = pyflamegpu.CUDASimulation(m) argv = [ "prog.exe", "--in", "test" ] - assert c.getSimulationConfig().input_file == "" + assert c.SimulationConfig().input_file == "" with pytest.raises(pyflamegpu.FLAMEGPURuntimeException) as e: # exception::UnsupportedFileType exception c.initialise(argv) assert e.value.type() == "UnsupportedFileType" - assert c.getSimulationConfig().input_file == argv[2] + assert c.SimulationConfig().input_file == argv[2] # Blank init resets value to default argv = [] c.initialise(argv) - assert c.getSimulationConfig().input_file == "" + assert c.SimulationConfig().input_file == "" def test_argparse_inputfile_short(self): m = pyflamegpu.ModelDescription("test_argparse_inputfile_short") c = pyflamegpu.CUDASimulation(m) argv = [ "prog.exe", "-i", "I_DO_NOT_EXIST.xml" ] - assert c.getSimulationConfig().input_file == "" + assert c.SimulationConfig().input_file == "" with pytest.raises(pyflamegpu.FLAMEGPURuntimeException) as e: # exception::InvalidInputFile c.initialise(argv) assert e.value.type() == "InvalidInputFile" - assert c.getSimulationConfig().input_file == argv[2] + assert c.SimulationConfig().input_file == argv[2] # Blank init resets value to default argv = [] c.initialise(argv) - assert c.getSimulationConfig().input_file == "" + assert c.SimulationConfig().input_file == "" def test_argparse_steps_long(self): m = pyflamegpu.ModelDescription("test_argparse_steps_long") c = pyflamegpu.CUDASimulation(m) argv = [ "prog.exe", "--steps", "12" ] - assert c.getSimulationConfig().steps == 1 + assert c.SimulationConfig().steps == 1 c.initialise(argv) - assert c.getSimulationConfig().steps == 12 + assert c.SimulationConfig().steps == 12 # Blank init resets value to default argv = [] c.initialise(argv) - assert c.getSimulationConfig().steps == 1 + assert c.SimulationConfig().steps == 1 def test_argparse_steps_short(self): m = pyflamegpu.ModelDescription("test_argparse_steps_short") c = pyflamegpu.CUDASimulation(m) argv = [ "prog.exe", "-s", "12" ] - assert c.getSimulationConfig().steps == 1 + assert c.SimulationConfig().steps == 1 c.initialise(argv) - assert c.getSimulationConfig().steps == 12 + assert c.SimulationConfig().steps == 12 # Blank init resets value to default argv = [] c.initialise(argv) - assert c.getSimulationConfig().steps == 1 + assert c.SimulationConfig().steps == 1 def test_argparse_randomseed_long(self): m = pyflamegpu.ModelDescription("test_argparse_randomseed_long") c = pyflamegpu.CUDASimulation(m) argv = [ "prog.exe", "--random", "12" ] - assert c.getSimulationConfig().random_seed != 12 + assert c.SimulationConfig().random_seed != 12 c.initialise(argv) - assert c.getSimulationConfig().random_seed == 12 + assert c.SimulationConfig().random_seed == 12 # Blank init resets value to default argv = [] c.initialise(argv) - assert c.getSimulationConfig().random_seed != 12 + assert c.SimulationConfig().random_seed != 12 def test_argparse_randomseed_short(self): m = pyflamegpu.ModelDescription("test_argparse_randomseed_short") c = pyflamegpu.CUDASimulation(m) argv = [ "prog.exe", "-r", "12" ] - assert c.getSimulationConfig().random_seed != 12 + assert c.SimulationConfig().random_seed != 12 c.initialise(argv) - assert c.getSimulationConfig().random_seed == 12 + assert c.SimulationConfig().random_seed == 12 # Blank init resets value to default argv = [] c.initialise(argv) - assert c.getSimulationConfig().random_seed != 12 + assert c.SimulationConfig().random_seed != 12 def test_argparse_device_long(self): m = pyflamegpu.ModelDescription("test_argparse_device_long") @@ -405,3 +405,11 @@ def test_AgentID_MultipleStatesUniqueIDs(self): assert len(ids_original) == len(pop_out_a) + len(pop_out_b) assert len(ids_copy) == len(pop_out_a) + len(pop_out_b) + + + # Ensure that Simulation::getSimulationConfig() is disabled, as it would be mutable + def test_ignored_getSimulationConfig(self): + m = pyflamegpu.ModelDescription("test_ignored_getSimulationConfig") + c = pyflamegpu.CUDASimulation(m) + with pytest.raises(AttributeError): + c.getSimulationConfig() \ No newline at end of file diff --git a/tests/swig/python/io/test_io.py b/tests/swig/python/io/test_io.py index 8147a83bc..22a19b3b0 100644 --- a/tests/swig/python/io/test_io.py +++ b/tests/swig/python/io/test_io.py @@ -227,11 +227,11 @@ def io_test_fixture(IO_FILENAME): am.SimulationConfig().input_file = IO_FILENAME am.applyConfig() # Validate config matches - assert am.getSimulationConfig().random_seed == 654321 - assert am.getSimulationConfig().steps == 123 - assert am.getSimulationConfig().timing == True - assert am.getSimulationConfig().verbose == False - assert am.getSimulationConfig().input_file == IO_FILENAME + assert am.SimulationConfig().random_seed == 654321 + assert am.SimulationConfig().steps == 123 + assert am.SimulationConfig().timing == True + assert am.SimulationConfig().verbose == False + assert am.SimulationConfig().input_file == IO_FILENAME assert am.CUDAConfig().device_id == 0; pop_a_in = pyflamegpu.AgentVector(a) pop_b_in = pyflamegpu.AgentVector(b)