Skip to content

Commit

Permalink
allow packages to be loaded from previous sim
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed May 14, 2024
1 parent 2559d4d commit bbc3c0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/sim_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ void SimInit::LoadRecipes() {
}
}

void SimInit::LoadPackages() {
QueryResult qr;
try {
qr = b_->Query("Packages", NULL);
} catch (std::exception err) {
return;
} // table doesn't exist (okay)

for (int i = 0; i < qr.rows.size(); ++i) {
std::string package = qr.GetVal<std::string>("Package", i);
double fill_min = qr.GetVal<int>("FillMin", i);
double fill_max = qr.GetVal<int>("FillMax", i);
std::string strategy = qr.GetVal<std::string>("Strategy", i);
ctx_->AddPackage(package, fill_min, fill_max, strategy);
}
}

void* SimInit::LoadPreconditioner(std::string name) {
using std::map;
using std::string;
Expand Down
1 change: 1 addition & 0 deletions src/sim_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class SimInit {

void LoadInfo();
void LoadRecipes();
void LoadPackages();
void LoadSolverInfo();
void LoadPrototypes();
void LoadInitialAgents();
Expand Down

0 comments on commit bbc3c0b

Please sign in to comment.