Skip to content

Instantly share code, notes, and snippets.

View rwcarlsen's full-sized avatar

Robert Carlsen rwcarlsen

View GitHub Profile
/////////// in the .h file: //////////////////////
// use this instead of "#pragma cyclus":
#pragma cyclus decl
/////////// in the .cc file: //////////////////////
#pragma cyclus def clone cycamore::YourArchetypeClass
# ------------------- Add all Concrete Agents ----------------------------
USE_CYCLUS("cycamore" "batch_reactor")
USE_CYCLUS("cycamore" "enrichment_facility")
#USE_CYCLUS("cycamore" "inpro_reactor")
USE_CYCLUS("cycamore" "sink")
class Buffer(object):
def __init__(self):
self.s = ''
def write(self, s):
self.s += s
def test_write_partisan_input(...):
buf = Buffer();
...
write_partisan_input(self, buf, ...)
int filtercol = ...;
int filterval = ...;
int operation = ...;
std::vector<int> pass;
for (int i = 0; i < qr.rows.size(); i++) {
int val = qr.GetVal<int>(filtercol, i);
switch (operation) {
case LT:
if (val < filterval) {
@rwcarlsen
rwcarlsen / gist:2caa799069d1a7b8f8d5
Created October 29, 2014 20:06
dre bug sim log
DEBUG1(core ): done with info gathering
DEBUG1(core ): translating graph...
DEBUG2(core ): Translating request portfolio of size 2
DEBUG4(core ): adding 2 request capacities
DEBUG4(core ): adding 1 bid capacities
DEBUG1(core ): Additing unit capacity: 1
DEBUG1(core ): Additing unit capacity: 1
DEBUG1(core ): Additing unit capacity: 1
DEBUG5(core ): Updating preference for one of Reactor1's trade nodes:
DEBUG5(core ): preference: 0
@rwcarlsen
rwcarlsen / gist:e4f52ed93d56e28f7255
Created October 9, 2014 20:37
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);
class Foo {
public:
Foo() : myfoo(NULL) {};
void eat_cheese(std::string type) {
//...
}
static Foo* TheFoo(int index) {
@rwcarlsen
rwcarlsen / query.json
Created July 1, 2014 19:01
custom cyan queries json file
{
"puseries":
"SELECT ti.Time,SUM(cmp.MassFrac * inv.Quantity) FROM ( Compositions AS cmp INNER JOIN Inventories AS inv ON inv.QualId = cmp.QualId INNER JOIN TimeList AS ti ON (ti.Time >= inv.StartTime AND ti.Time < inv.EndTime)) WHERE ( inv.SimId = cmp.SimId AND ti.SimId = inv.SimId AND cmp.NucId = 942390000) GROUP BY ti.Time,cmp.NucId;",
"agentop":
"SELECT ag.Prototype,SUM(IFNULL(ag.ExitTime,Info.Duration)-ag.EnterTime) FROM Agents AS ag INNER JOIN Info ON Info.SimId = ag.SimId GROUP BY ag.Prototype;",
"trans":
"SELECT tr.Time,tr.Commodity,snd.Prototype,rcv.Prototype,rs.Quantity FROM Transactions AS tr INNER JOIN Resources AS rs ON rs.ResourceId = tr.ResourceId INNER JOIN Agents AS snd ON tr.SenderId = snd.AgentId INNER JOIN Agents AS rcv ON tr.ReceiverID = rcv.AgentId ORDER BY tr.Time,snd.Prototype,rcv.Prototype;"
}
@rwcarlsen
rwcarlsen / unpredictable.xml
Created July 1, 2014 18:53
cyclus input file that has non-deterministic output
<simulation>
<schematype>flat</schematype>
<control>
<duration>121</duration>
<startmonth>1</startmonth>
<startyear>2000</startyear>
<simhandle>207</simhandle>
</control>
<archetypes>
# cae account with forward-tunnel to office computer
Host cae
HostName best-tux.cae.wisc.edu
Port 22
User rcarlsen
ForwardAgent yes
LocalForward localhost:2222 rc.ep.wisc.edu:22
# alias for cae-tunnel to work machine.
#