Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source move inv resource creation to Build from EnterNotify #623

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Since last release

**Added:**
* Added package parameter to storage (#603, #612, #616)
* Added package parameter to source (#613, #617, #621)
* Added package parameter to source (#613, #617, #621, #623)
* Added default keep packaging to reactor (#618, #619)

**Changed:**
Expand Down
11 changes: 8 additions & 3 deletions src/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,25 @@ std::string Source::str() {
}

void Source::EnterNotify() {
cyclus::Facility::EnterNotify();
RecordPosition();
}

void Source::Build(cyclus::Agent* parent) {
Facility::Build(parent);

using cyclus::CompMap;
using cyclus::Composition;
using cyclus::Material;
cyclus::Facility::EnterNotify();
RecordPosition();

// create all source inventory and place into buf
cyclus::Material::Ptr all_inv;
Composition::Ptr blank_comp = Composition::CreateFromMass(CompMap());

all_inv = (outrecipe.empty() || context() == NULL) ? \
Material::Create(this, inventory_size, blank_comp) : \
Material::Create(this, inventory_size, context()->GetRecipe(outrecipe));
inventory.Push(all_inv);

}

std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr> Source::GetMatlBids(
Expand Down
4 changes: 4 additions & 0 deletions src/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class Source : public cyclus::Facility,

virtual void EnterNotify();

/// --- Facility Members ---
/// perform module-specific tasks when entering the simulation
virtual void Build(cyclus::Agent* parent);

virtual void GetMatlTrades(
const std::vector< cyclus::Trade<cyclus::Material> >& trades,
std::vector<std::pair<cyclus::Trade<cyclus::Material>,
Expand Down
2 changes: 1 addition & 1 deletion src/source_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void SourceTest::SetUp() {
trader = tc.trader();
InitParameters();
SetUpSource();
src_facility->EnterNotify();
src_facility->Build(NULL);
}

void SourceTest::TearDown() {
Expand Down
Loading