You know, there is no reason Model has to define the step/run interface

The user can do that for themselves
This commit is contained in:
James P. Howard, II
2022-08-19 19:20:48 -04:00
parent 78aca204f4
commit d884e603cb
10 changed files with 99 additions and 70 deletions

View File

@@ -163,12 +163,6 @@ BoltzmannWealthModel1D::BoltzmannWealthModel1D(unsigned int number_agents, unsig
}
}
std::shared_ptr<kami::Model> BoltzmannWealthModel1D::run(unsigned int steps) {
for (auto i = 0; i < steps; i++)
step();
return shared_from_this();
}
std::shared_ptr<kami::Model> BoltzmannWealthModel1D::step() {
console->trace("Executing model step {}", ++_step_count);
_sched->step(shared_from_this());

View File

@@ -96,14 +96,7 @@ public:
/**
* Execute a single time-step for the model.
*/
std::shared_ptr<kami::Model> step() override;
/**
* Execute a number of time-steps for the model.
*
* @param[in] n the number of steps to execute.
*/
std::shared_ptr<kami::Model> run(unsigned int n) override;
std::shared_ptr<kami::Model> step();
private:
unsigned int _step_count;

View File

@@ -164,12 +164,6 @@ BoltzmannWealthModel2D::BoltzmannWealthModel2D(unsigned int number_agents, unsig
}
}
std::shared_ptr<kami::Model> BoltzmannWealthModel2D::run(unsigned int steps) {
for (auto i = 0; i < steps; i++)
step();
return shared_from_this();
}
std::shared_ptr<kami::Model> BoltzmannWealthModel2D::step() {
console->trace("Executing model step {}", _step_count++);
_sched->step(shared_from_this());

View File

@@ -99,14 +99,7 @@ public:
/**
* Execute a single time-step for the model.
*/
std::shared_ptr<kami::Model> step() override;
/**
* Execute a number of time-steps for the model.
*
* @param[in] n the number of steps to execute.
*/
std::shared_ptr<kami::Model> run(unsigned int n) override;
std::shared_ptr<kami::Model> step();
private:
unsigned int _step_count;