Skip to content

Commit

Permalink
companion to cyclus/cyclus#628.
Browse files Browse the repository at this point in the history
  • Loading branch information
gidden committed Oct 23, 2013
1 parent 5ad132e commit 000a8c1
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/Models/BatchReactor/batch_reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ void BatchReactor::InitModuleMembers(cyclus::QueryEngine* qe) {
cyclus::Commodity commod(commodity->GetElementContent("commodity"));
AddCommodity(commod);
data = commodity->GetElementContent("capacity");
cyclus::supply_demand::CommodityProducer::SetCapacity(commod,
cyclus::CommodityProducer::SetCapacity(commod,
lexical_cast<double>(data));
data = commodity->GetElementContent("cost");
cyclus::supply_demand::CommodityProducer::SetCost(commod,
cyclus::CommodityProducer::SetCost(commod,
lexical_cast<double>(data));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Models/BatchReactor/batch_reactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum Phase {INIT, BEGIN, OPERATION, REFUEL, REFUEL_DELAY, WAITING, END};
operates in a batch-like manner, i.e. it refuels in batches.
*/
class BatchReactor : public cyclus::FacilityModel,
public cyclus::supply_demand::CommodityProducer {
public cyclus::CommodityProducer {
public:
/* --- Module Methods --- */
/**
Expand Down
12 changes: 6 additions & 6 deletions src/Models/GrowthRegion/growth_region.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ void GrowthRegion::RegisterCommodity(cyclus::Commodity& commodity) {

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GrowthRegion::RegisterCommodityProducerManager(cyclus::Model* child) {
cyclus::supply_demand::CommodityProducerManager* cast =
dynamic_cast<cyclus::supply_demand::CommodityProducerManager*>(child);
cyclus::CommodityProducerManager* cast =
dynamic_cast<cyclus::CommodityProducerManager*>(child);
if (!cast) {
throw cyclus::CastError("Failed to cast to CommodityProducerManager");
}
Expand All @@ -152,8 +152,8 @@ void GrowthRegion::RegisterCommodityProducerManager(cyclus::Model* child) {

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GrowthRegion::RegisterBuilder(cyclus::Model* child) {
cyclus::action_building::Builder* cast =
dynamic_cast<cyclus::action_building::Builder*>(child);
cyclus::Builder* cast =
dynamic_cast<cyclus::Builder*>(child);
if (!cast) {
throw cyclus::CastError("Failed to cast to Builder");
}
Expand All @@ -164,15 +164,15 @@ void GrowthRegion::RegisterBuilder(cyclus::Model* child) {
void GrowthRegion::orderBuilds(cyclus::Commodity& commodity,
double unmetdemand) {
using std::vector;
vector<cyclus::action_building::BuildOrder> orders =
vector<cyclus::BuildOrder> orders =
buildmanager_.MakeBuildDecision(commodity, unmetdemand);

LOG(cyclus::LEV_INFO3, "greg") << "The build orders have been determined. "
<< orders.size()
<< " different type(s) of prototypes will be built.";

for (int i = 0; i < orders.size(); i++) {
cyclus::action_building::BuildOrder order = orders.at(i);
cyclus::BuildOrder order = orders.at(i);
cyclus::InstModel* instcast = dynamic_cast<cyclus::InstModel*>(order.builder);
cyclus::Model* modelcast = dynamic_cast<cyclus::Model*>(order.producer);
if (!instcast || !modelcast) {
Expand Down
4 changes: 2 additions & 2 deletions src/Models/GrowthRegion/growth_region.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class GrowthRegion : public cyclus::RegionModel {
/* --- */

/// manager for Supply and emand
cyclus::supply_demand::SupplyDemandManager sdmanager_;
cyclus::SupplyDemandManager sdmanager_;

virtual cyclus::Model* Clone() {
GrowthRegion* m = new GrowthRegion(context());
Expand All @@ -90,7 +90,7 @@ class GrowthRegion : public cyclus::RegionModel {
std::set<cyclus::Commodity, cyclus::CommodityCompare> commodities_;

/// manager for building things
cyclus::action_building::BuildingManager buildmanager_;
cyclus::BuildingManager buildmanager_;

/**
register a commodity for which production capacity is being
Expand Down
18 changes: 9 additions & 9 deletions src/Models/ManagerInst/manager_inst.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ ManagerInst::~ManagerInst() {}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ManagerInst::RegisterAvailablePrototype(std::string prototype) {
using cyclus::supply_demand::CommodityProducer;
using cyclus::CommodityProducer;
try {
CommodityProducer* cast = context()->CreateModel<CommodityProducer>(prototype);
cyclus::action_building::Builder::RegisterProducer(cast);
cyclus::Builder::RegisterProducer(cast);
LOG(cyclus::LEV_DEBUG3, "maninst") << "ManagerInst " << name()
<< " has registered a producer prototype: "
<< prototype
Expand All @@ -29,10 +29,10 @@ void ManagerInst::RegisterAvailablePrototype(std::string prototype) {

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ManagerInst::RegisterCloneAsBuilt(cyclus::Model* clone) {
cyclus::supply_demand::CommodityProducer* cast =
dynamic_cast<cyclus::supply_demand::CommodityProducer*>(clone);
cyclus::CommodityProducer* cast =
dynamic_cast<cyclus::CommodityProducer*>(clone);
if (cast) {
cyclus::supply_demand::CommodityProducerManager::RegisterProducer(cast);
cyclus::CommodityProducerManager::RegisterProducer(cast);
if (cyclus::LEV_DEBUG3 >= cyclus::Logger::ReportLevel()) {
LOG(cyclus::LEV_DEBUG3, "maninst") << "ManagerInst " << name()
<< " has registered a producer clone:";
Expand All @@ -43,16 +43,16 @@ void ManagerInst::RegisterCloneAsBuilt(cyclus::Model* clone) {

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ManagerInst::RegisterCloneAsDecommissioned(cyclus::Model* clone) {
cyclus::supply_demand::CommodityProducer* cast =
dynamic_cast<cyclus::supply_demand::CommodityProducer*>(clone);
cyclus::CommodityProducer* cast =
dynamic_cast<cyclus::CommodityProducer*>(clone);
if (cast) {
cyclus::supply_demand::CommodityProducerManager::UnRegisterProducer(cast);
cyclus::CommodityProducerManager::UnRegisterProducer(cast);
}
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ManagerInst::WriteProducerInformation(
cyclus::supply_demand::CommodityProducer* producer) {
cyclus::CommodityProducer* producer) {
using std::set;
set<cyclus::Commodity, cyclus::CommodityCompare> commodities =
producer->ProducedCommodities();
Expand Down
6 changes: 3 additions & 3 deletions src/Models/ManagerInst/manager_inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace cycamore {
@section detailedBehavior Detailed Behavior
*/
class ManagerInst : public cyclus::InstModel,
public cyclus::supply_demand::CommodityProducerManager,
public cyclus::action_building::Builder {
public cyclus::CommodityProducerManager,
public cyclus::Builder {
public:
/**
Default constructor
Expand Down Expand Up @@ -61,7 +61,7 @@ class ManagerInst : public cyclus::InstModel,
write information about a commodity producer to a stream
@param producer the producer
*/
void WriteProducerInformation(cyclus::supply_demand::CommodityProducer*
void WriteProducerInformation(cyclus::CommodityProducer*
producer);
};
} // namespace cycamore
Expand Down
2 changes: 1 addition & 1 deletion src/Models/ManagerInst/manager_inst_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_F(ManagerInstTests, producerexists) {
using std::set;
ctx_->AddPrototype("foop", producer);
src_inst->RegisterAvailablePrototype("foop");
set<cyclus::supply_demand::CommodityProducer*>::iterator it;
set<cyclus::CommodityProducer*>::iterator it;
for (it = src_inst->BeginningProducer(); it != src_inst->EndingProducer();
it++) {
EXPECT_EQ(dynamic_cast<TestProducer*>(*it)->name(), producer->name());
Expand Down
2 changes: 1 addition & 1 deletion src/Models/ManagerInst/manager_inst_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class TestProducer :
public cyclus::FacilityModel,
public cyclus::supply_demand::CommodityProducer {
public cyclus::CommodityProducer {
public:
TestProducer(cyclus::Context* ctx);
virtual ~TestProducer();
Expand Down
4 changes: 2 additions & 2 deletions src/Models/SourceFacility/source_facility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ void SourceFacility::InitModuleMembers(cyclus::QueryEngine* qe) {
string data = output->GetElementContent("outcommodity");
SetCommodity(data);
cyclus::Commodity commod(data);
cyclus::supply_demand::CommodityProducer::AddCommodity(commod);
cyclus::CommodityProducer::AddCommodity(commod);

double capacity =
cyclus::GetOptionalQuery<double>(output,
"output_capacity",
numeric_limits<double>::max());
cyclus::supply_demand::CommodityProducer::SetCapacity(commod, capacity);
cyclus::CommodityProducer::SetCapacity(commod, capacity);
SetCapacity(capacity);

double size =
Expand Down
2 changes: 1 addition & 1 deletion src/Models/SourceFacility/source_facility.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Context;
*/

class SourceFacility : public cyclus::FacilityModel,
public cyclus::supply_demand::CommodityProducer {
public cyclus::CommodityProducer {
public:
/* --- Module Methods --- */
/**
Expand Down

0 comments on commit 000a8c1

Please sign in to comment.