Skip to content

Commit

Permalink
Change the default number of Simulation steps to 1
Browse files Browse the repository at this point in the history
Closes #634
  • Loading branch information
ptheywood committed Aug 11, 2021
1 parent 4ab21b6 commit 2cced6a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

+ Created `CHANGELOG.md` ([#630](https://github.com/FLAMEGPU/FLAMEGPU2/pull/630))

### Changed

+ Default value of `-s/--steps` set to `1` rather than `0` ([#634](https://github.com/FLAMEGPU/FLAMEGPU2/issues/634))

### Deprecated

### Removed
Expand Down
2 changes: 1 addition & 1 deletion include/flamegpu/sim/Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Simulation {
std::string common_log_file;
bool truncate_log_files = true;
unsigned int random_seed;
unsigned int steps = 0;
unsigned int steps = 1;
bool verbose = false;
bool timing = false;
#ifdef VISUALISATION
Expand Down
8 changes: 4 additions & 4 deletions tests/swig/python/gpu/test_cuda_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ 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 == 0
assert c.getSimulationConfig().steps == 1
c.initialise(argv)
assert c.getSimulationConfig().steps == 12
# Blank init resets value to default
argv = []
c.initialise(argv)
assert c.getSimulationConfig().steps == 0
assert c.getSimulationConfig().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 == 0
assert c.getSimulationConfig().steps == 1
c.initialise(argv)
assert c.getSimulationConfig().steps == 12
# Blank init resets value to default
argv = []
c.initialise(argv)
assert c.getSimulationConfig().steps == 0
assert c.getSimulationConfig().steps == 1

def test_argparse_randomseed_long(self):
m = pyflamegpu.ModelDescription("test_argparse_randomseed_long")
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cases/gpu/test_cuda_simulation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ TEST(TestSimulation, ArgParse_steps_long) {
ModelDescription m(MODEL_NAME);
CUDASimulation c(m);
const char *argv[3] = { "prog.exe", "--steps", "12" };
EXPECT_EQ(c.getSimulationConfig().steps, 0u);
EXPECT_EQ(c.getSimulationConfig().steps, 1u);
c.initialise(sizeof(argv) / sizeof(char*), argv);
EXPECT_EQ(c.getSimulationConfig().steps, 12u);
// Blank init resets value to default
c.initialise(0, nullptr);
EXPECT_EQ(c.getSimulationConfig().steps, 0u);
EXPECT_EQ(c.getSimulationConfig().steps, 1u);
}
TEST(TestSimulation, ArgParse_steps_short) {
ModelDescription m(MODEL_NAME);
CUDASimulation c(m);
const char *argv[3] = { "prog.exe", "-s", "12" };
EXPECT_EQ(c.getSimulationConfig().steps, 0u);
EXPECT_EQ(c.getSimulationConfig().steps, 1u);
c.initialise(sizeof(argv) / sizeof(char*), argv);
EXPECT_EQ(c.getSimulationConfig().steps, 12u);
// Blank init resets value to default
c.initialise(0, nullptr);
EXPECT_EQ(c.getSimulationConfig().steps, 0u);
EXPECT_EQ(c.getSimulationConfig().steps, 1u);
}
TEST(TestSimulation, ArgParse_randomseed_long) {
ModelDescription m(MODEL_NAME);
Expand Down

0 comments on commit 2cced6a

Please sign in to comment.