Skip to content

Instantly share code, notes, and snippets.

@rwcarlsen
Created October 9, 2014 20:37
Show Gist options
  • Save rwcarlsen/e4f52ed93d56e28f7255 to your computer and use it in GitHub Desktop.
Save rwcarlsen/e4f52ed93d56e28f7255 to your computer and use it in GitHub Desktop.
sink composition test starter
TEST(blabla) {
cyclus::Recorder rec;
cyclus::Timer ti;
cyclus::Context ctx(&ti, &rec);
// ... create composition c
cyclus::CompMap m;
m[922350000] = 1;
m[922380000] = 2;
cyclus::Composition::Ptr c = cyclus::Composition::CreateFromMass(m);
ctx.AddRecipe("swiss", c);
cyclus::Agent* snk = new SinkFacility(&ctx);
snk->recipe("swiss");
snk->AddCommodity("cheese");
somehorriblylongtypename ports = snk->GetMatlRequest();
somehorriblylongtypename::iterator it = ports.begin();
std::vector<cyclus::Request<cyclus::Material>*> reqs = *it;
cyclus::Material::Ptr mat = reqs[0]->target();
EXPECT_EQ(mat->comp(), c);
}
@mbmcgarry
Copy link

Hi Robert,
Ok I'm going through this line by line and I'm stuck on line 13. I can't find any documentation for 'SinkFacility', but I found something similar in cycamore. Is this the right way to implement it?

cyclus::Agent* snk = new cycamore::Sink::Sink(&ctx);

Also the cycamore sink documentation says that I need to define a capacity. Do I do that in the same way that defined cyclus::Timer (line 3)?

Thanks!
Meghan

@rwcarlsen
Copy link
Author

yclus::Agent* snk = new cycamore::Sink::Sink(&ctx);

yep.

Also the cycamore sink documentation says that I need to define a capacity. Do I do that in the same way that defined cyclus::Timer (line 3)?

something like this:

double cap = 42.42;
snk->capacity(cap);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment