33
44namespace cycamore {
55
6- GrowthRegion::GrowthRegion (cyclus::Context* ctx) : cyclus::Region(ctx) { }
6+ GrowthRegion::GrowthRegion (cyclus::Context* ctx) : cyclus::Region(ctx) {
7+ #if !CYCLUS_HAS_COIN
8+ throw cyclus::Error (" Growth Region requires that Cyclus & Cycamore be compiled "
9+ " with COIN support." );
10+ #endif
11+ }
712
813GrowthRegion::~GrowthRegion () {}
914
1015void GrowthRegion::AddCommodityDemand_ (std::string commod,
1116 Demand& demand) {
12-
13-
17+
18+
1419 cyclus::toolkit::PiecewiseFunctionFactory pff;
1520 cyclus::toolkit::BasicFunctionFactory bff;
1621 bool continuous = false ;
@@ -55,7 +60,7 @@ void GrowthRegion::DecomNotify(Agent* a) {
5560void GrowthRegion::Register_ (cyclus::Agent* agent) {
5661 using cyclus::toolkit::CommodityProducerManager;
5762 using cyclus::toolkit::Builder;
58-
63+ # if CYCLUS_HAS_COIN
5964 CommodityProducerManager* cpm_cast =
6065 dynamic_cast <CommodityProducerManager*>(agent);
6166 if (cpm_cast != NULL ) {
@@ -72,12 +77,16 @@ void GrowthRegion::Register_(cyclus::Agent* agent) {
7277 << " as a builder." ;
7378 buildmanager_.Register (b_cast);
7479 }
80+ #else
81+ throw cyclus::Error (" Growth Region requires that Cyclus & Cycamore be compiled "
82+ " with COIN support." );
83+ #endif
7584}
7685
7786void GrowthRegion::Unregister_ (cyclus::Agent* agent) {
7887 using cyclus::toolkit::CommodityProducerManager;
7988 using cyclus::toolkit::Builder;
80-
89+ # if CYCLUS_HAS_COIN
8190 CommodityProducerManager* cpm_cast =
8291 dynamic_cast <CommodityProducerManager*>(agent);
8392 if (cpm_cast != NULL )
@@ -86,6 +95,10 @@ void GrowthRegion::Unregister_(cyclus::Agent* agent) {
8695 Builder* b_cast = dynamic_cast <Builder*>(agent);
8796 if (b_cast != NULL )
8897 buildmanager_.Unregister (b_cast);
98+ #else
99+ throw cyclus::Error (" Growth Region requires that Cyclus & Cycamore be compiled "
100+ " with COIN support." );
101+ #endif
89102}
90103
91104void GrowthRegion::Tick () {
@@ -106,7 +119,7 @@ void GrowthRegion::Tick() {
106119 LOG (cyclus::LEV_INFO3, " greg" ) << " * demand = " << demand;
107120 LOG (cyclus::LEV_INFO3, " greg" ) << " * supply = " << supply;
108121 LOG (cyclus::LEV_INFO3, " greg" ) << " * unmet demand = " << unmetdemand;
109-
122+
110123 if (unmetdemand > 0 ) {
111124 OrderBuilds (commod, unmetdemand);
112125 }
@@ -116,6 +129,7 @@ void GrowthRegion::Tick() {
116129
117130void GrowthRegion::OrderBuilds (cyclus::toolkit::Commodity& commodity,
118131 double unmetdemand) {
132+ #if CYCLUS_HAS_COIN
119133 using std::vector;
120134 vector<cyclus::toolkit::BuildOrder> orders =
121135 buildmanager_.MakeBuildDecision (commodity, unmetdemand);
@@ -149,6 +163,10 @@ void GrowthRegion::OrderBuilds(cyclus::toolkit::Commodity& commodity,
149163 context ()->SchedBuild (instcast, agentcast->prototype ());
150164 }
151165 }
166+ #else
167+ throw cyclus::Error (" Growth Region requires that Cyclus & Cycamore be compiled "
168+ " with COIN support." );
169+ #endif
152170}
153171
154172extern " C" cyclus::Agent* ConstructGrowthRegion (cyclus::Context* ctx) {
0 commit comments