From 78ae5ed4aced4480805ed1238c15ddd19f4b19ea Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Tue, 14 May 2019 12:57:56 -0500 Subject: [PATCH 01/11] facilities don't need to inherit form Position --- src/deploy_inst.h | 3 +-- src/enrichment.h | 3 +-- src/fuel_fab.h | 3 +-- src/growth_region.h | 3 +-- src/manager_inst.h | 3 +-- src/mixer.h | 3 +-- src/reactor.h | 3 +-- src/separations.h | 3 +-- src/sink.h | 3 +-- src/source.h | 3 +-- src/storage.h | 3 +-- 11 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/deploy_inst.h b/src/deploy_inst.h index cc6dc3ea15..14146eb096 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -19,8 +19,7 @@ typedef std::map > BuildSched; // lifetimes. The same prototype can be specified multiple times with any // combination of the same or different build times, build number, and // lifetimes. -class DeployInst : public cyclus::Institution, - public cyclus::toolkit::Position { +class DeployInst : public cyclus::Institution { #pragma cyclus note { \ "doc": \ "Builds and manages agents (facilities) according to a manually" \ diff --git a/src/enrichment.h b/src/enrichment.h index f0bb9210ad..66166f32ae 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -116,8 +116,7 @@ class NatUConverter : public cyclus::Converter { /// tails inventory. class Enrichment - : public cyclus::Facility, - public cyclus::toolkit::Position { + : public cyclus::Facility { #pragma cyclus note { \ "niche": "enrichment facility", \ "doc": \ diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 40607d8705..15ad3cba1a 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -54,8 +54,7 @@ namespace cycamore { /// Breeding. Economics, and Safety in Large Fast Power Reactors. 1963. /// @endcode class FuelFab - : public cyclus::Facility, - public cyclus::toolkit::Position { + : public cyclus::Facility { #pragma cyclus note { \ "niche": "fabrication", \ "doc": \ diff --git a/src/growth_region.h b/src/growth_region.h index 0fe40bb855..eaa2eb2c5e 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -35,8 +35,7 @@ typedef std::vector< /// multiple commodities being demanded. /// /// @warning The growth region is experimental -class GrowthRegion : public cyclus::Region, - public cyclus::toolkit::Position { +class GrowthRegion : public cyclus::Region { friend class GrowthRegionTests; public: /// The default constructor for the GrowthRegion diff --git a/src/manager_inst.h b/src/manager_inst.h index ac86d81f1a..f32890e1ec 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -13,8 +13,7 @@ namespace cycamore { class ManagerInst : public cyclus::Institution, public cyclus::toolkit::CommodityProducerManager, - public cyclus::toolkit::Builder, - public cyclus::toolkit::Position { + public cyclus::toolkit::Builder { public: /// Default constructor ManagerInst(cyclus::Context* ctx); diff --git a/src/mixer.h b/src/mixer.h index 2e4863e320..2c3248ca84 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -13,8 +13,7 @@ namespace cycamore { /// mixed material is constrained by available inventory of mixed material /// quantities. class Mixer - : public cyclus::Facility, - public cyclus::toolkit::Position { + : public cyclus::Facility { #pragma cyclus note { \ "niche": "mixing facility", \ "doc": "Mixer mixes N streams with fixed, static, user-specified" \ diff --git a/src/reactor.h b/src/reactor.h index d412f2026c..1602bcbacb 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -53,8 +53,7 @@ namespace cycamore { /// compositions. class Reactor : public cyclus::Facility, - public cyclus::toolkit::CommodityProducer, - public cyclus::toolkit::Position { + public cyclus::toolkit::CommodityProducer { #pragma cyclus note { \ "niche": "reactor", \ "doc": \ diff --git a/src/separations.h b/src/separations.h index 16ba289996..5b83a5a0e6 100644 --- a/src/separations.h +++ b/src/separations.h @@ -35,8 +35,7 @@ cyclus::Material::Ptr SepMaterial(std::map effs, /// streams, further processing/separations of feed material will halt until /// room is again available in the output streams. class Separations - : public cyclus::Facility, - public cyclus::toolkit::Position { + : public cyclus::Facility { #pragma cyclus note { \ "niche": "separations", \ "doc": \ diff --git a/src/sink.h b/src/sink.h index 97e2c18361..35a6b7ab8e 100644 --- a/src/sink.h +++ b/src/sink.h @@ -19,8 +19,7 @@ class Context; /// default to infinite. If a recipe is provided, it will request material with /// that recipe. Requests are made for any number of specified commodities. class Sink - : public cyclus::Facility, - public cyclus::toolkit::Position { + : public cyclus::Facility { public: Sink(cyclus::Context* ctx); diff --git a/src/source.h b/src/source.h index 4d49e6df93..64b9d7c164 100644 --- a/src/source.h +++ b/src/source.h @@ -21,8 +21,7 @@ class Context; /// inventory, and when the inventory size reaches zero, the source can provide /// no more material. class Source : public cyclus::Facility, - public cyclus::toolkit::CommodityProducer, - public cyclus::toolkit::Position { + public cyclus::toolkit::CommodityProducer { friend class SourceTest; public: diff --git a/src/storage.h b/src/storage.h index e370672aa0..4271c16893 100644 --- a/src/storage.h +++ b/src/storage.h @@ -65,8 +65,7 @@ namespace storage { /// Matched resources are sent immediately. class Storage : public cyclus::Facility, - public cyclus::toolkit::CommodityProducer, - public cyclus::toolkit::Position { + public cyclus::toolkit::CommodityProducer { public: /// @param ctx the cyclus context for access to simulation-wide parameters Storage(cyclus::Context* ctx); From 5b00ee4aa442ba0d54890354720c71182941188c Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 15 May 2019 15:30:30 -0500 Subject: [PATCH 02/11] move recordPosition out of the mixer --- src/mixer.cc | 17 ++++------------- src/mixer.h | 12 ++++++++++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/mixer.cc b/src/mixer.cc index 8cfdf994cc..9f0a85d967 100644 --- a/src/mixer.cc +++ b/src/mixer.cc @@ -12,7 +12,10 @@ Mixer::Mixer(cyclus::Context* ctx) coordinates(latitude, longitude) { cyclus::Warn( "the Mixer archetype is experimental"); - RecordPosition(); + usage_medatas.LoadUsageMetadatas(usage_datas); + + usage_medatas.RecordMetadatas(this); + coordinates.RecordPosition(this); } cyclus::Inventories Mixer::SnapshotInv() { @@ -187,18 +190,6 @@ void Mixer::AcceptMatlTrades( req_inventories_.clear(); } -void Mixer::RecordPosition() { - std::string specification = spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - extern "C" cyclus::Agent* ConstructMixer(cyclus::Context* ctx) { return new Mixer(ctx); } diff --git a/src/mixer.h b/src/mixer.h index 2c3248ca84..4402bf955e 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -57,6 +57,16 @@ class Mixer virtual void InitInv(cyclus::Inventories& inv); protected: + +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; + cyclus::toolkit::UsageMetadatas usage_medatas; + #pragma cyclus var { \ "alias": ["in_streams", [ "stream", [ "info", "mixing_ratio", "buf_size"], [ "commodities", "commodity", "pref"]]], \ "uitype": ["oneormore", [ "pair", ["pair", "double", "double"], ["oneormore", "incommodity", "double"]]], \ @@ -130,8 +140,6 @@ class Mixer cyclus::toolkit::Position coordinates; - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); }; } // namespace cycamore From 4819b192e8b4c379b8cb0b22b856bfeec91385b4 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 15 May 2019 17:35:16 -0500 Subject: [PATCH 03/11] move RecordPosition and RecordusageMetadatas in Agent class --- src/deploy_inst.cc | 19 ++++--------------- src/deploy_inst.h | 11 +++++++---- src/enrichment.cc | 22 +++++----------------- src/enrichment.h | 8 +++++++- src/fuel_fab.cc | 27 ++++++++------------------- src/fuel_fab.h | 11 +++++++---- src/growth_region.cc | 21 +++++---------------- src/growth_region.h | 10 +++++++--- src/manager_inst.cc | 23 ++++++----------------- src/manager_inst.h | 11 +++++++---- src/mixer.cc | 21 +++++++++------------ src/mixer.h | 17 +++++++---------- src/reactor.cc | 22 +++++----------------- src/reactor.h | 10 +++++++--- src/separations.cc | 21 +++++---------------- src/separations.h | 12 +++++++++--- src/sink.cc | 28 +++++++++------------------- src/sink.h | 10 +++++++--- src/source.cc | 24 ++++++------------------ src/source.h | 10 +++++++--- src/storage.cc | 24 ++++++------------------ src/storage.h | 9 +++++++-- 22 files changed, 147 insertions(+), 224 deletions(-) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index 1b12dcb978..c5dcd458f0 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -6,8 +6,10 @@ namespace cycamore { DeployInst::DeployInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} DeployInst::~DeployInst() {} @@ -65,19 +67,6 @@ void DeployInst::EnterNotify() { << " lifetimes vals, expected " << n; throw cyclus::ValueError(ss.str()); } - RecordPosition(); -} - -void DeployInst::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); } extern "C" cyclus::Agent* ConstructDeployInst(cyclus::Context* ctx) { diff --git a/src/deploy_inst.h b/src/deploy_inst.h index 14146eb096..6074ca12dd 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -99,10 +99,13 @@ class DeployInst : public cyclus::Institution { } double longitude; - cyclus::toolkit::Position coordinates; - - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/enrichment.cc b/src/enrichment.cc index 06d058caa1..f8f75bb6ae 100644 --- a/src/enrichment.cc +++ b/src/enrichment.cc @@ -24,8 +24,10 @@ Enrichment::Enrichment(cyclus::Context* ctx) tails_commod(""), order_prefs(true), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Enrichment::~Enrichment() {} @@ -55,11 +57,10 @@ void Enrichment::Build(cyclus::Agent* parent) { LOG(cyclus::LEV_DEBUG2, "EnrFac") << "Enrichment " << " entering the simuluation: "; LOG(cyclus::LEV_DEBUG2, "EnrFac") << str(); - RecordPosition(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Enrichment::Tick() { +void Enrichment::Tick() { current_swu_capacity = SwuCapacity(); } @@ -463,19 +464,6 @@ double Enrichment::FeedAssay() { return cyclus::toolkit::UraniumAssayMass(fission_matl); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Enrichment::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - extern "C" cyclus::Agent* ConstructEnrichment(cyclus::Context* ctx) { return new Enrichment(ctx); diff --git a/src/enrichment.h b/src/enrichment.h index 66166f32ae..4891e8c4c0 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -398,7 +398,13 @@ class Enrichment } double longitude; - cyclus::toolkit::Position coordinates; +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index f64d928d1e..7258893957 100644 --- a/src/fuel_fab.cc +++ b/src/fuel_fab.cc @@ -131,13 +131,15 @@ class TopupConverter : public cyclus::Converter { }; FuelFab::FuelFab(cyclus::Context* ctx) - : cyclus::Facility(ctx), - fill_size(0), - fiss_size(0), + : cyclus::Facility(ctx), + fill_size(0), + fiss_size(0), throughput(0), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} void FuelFab::EnterNotify() { cyclus::Facility::EnterNotify(); @@ -163,7 +165,6 @@ void FuelFab::EnterNotify() { << " fill_commod_prefs vals, expected " << fill_commods.size(); throw cyclus::ValidationError(ss.str()); } - RecordPosition(); } std::set::Ptr> FuelFab::GetMatlRequests() { @@ -397,7 +398,7 @@ void FuelFab::GetMatlTrades( responses) { using cyclus::Trade; - // guard against cases where a buffer is empty - this is okay because some + // guard against cases where a buffer is empty - this is okay because some // trades may not need that particular buffer. double w_fill = 0; if (fill.count() > 0) { @@ -495,18 +496,6 @@ void FuelFab::GetMatlTrades( } } -void FuelFab::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - extern "C" cyclus::Agent* ConstructFuelFab(cyclus::Context* ctx) { return new FuelFab(ctx); } diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 15ad3cba1a..f0db27fdee 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -268,10 +268,13 @@ class FuelFab } double longitude; - cyclus::toolkit::Position coordinates; - - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; double CosiWeight(cyclus::Composition::Ptr c, const std::string& spectrum); diff --git a/src/growth_region.cc b/src/growth_region.cc index 6175f047ef..b8717afcf0 100644 --- a/src/growth_region.cc +++ b/src/growth_region.cc @@ -6,12 +6,13 @@ namespace cycamore { GrowthRegion::GrowthRegion(cyclus::Context* ctx) : cyclus::Region(ctx), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) { - #if !CYCLUS_HAS_COIN + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); + #if !CYCLUS_HAS_COIN throw cyclus::Error("Growth Region requires that Cyclus & Cycamore be compiled " "with COIN support."); - #endif + #endif } GrowthRegion::~GrowthRegion() {} @@ -55,7 +56,6 @@ void GrowthRegion::EnterNotify() { << it->first; AddCommodityDemand_(it->first, it->second); } - RecordPosition(); } void GrowthRegion::DecomNotify(Agent* a) { @@ -174,17 +174,6 @@ void GrowthRegion::OrderBuilds(cyclus::toolkit::Commodity& commodity, #endif } -void GrowthRegion::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} extern "C" cyclus::Agent* ConstructGrowthRegion(cyclus::Context* ctx) { return new GrowthRegion(ctx); diff --git a/src/growth_region.h b/src/growth_region.h index eaa2eb2c5e..14cfb59ed4 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -144,10 +144,14 @@ class GrowthRegion : public cyclus::Region { } double longitude; - cyclus::toolkit::Position coordinates; - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/manager_inst.cc b/src/manager_inst.cc index 8cccfc7363..db903509dd 100644 --- a/src/manager_inst.cc +++ b/src/manager_inst.cc @@ -5,10 +5,12 @@ namespace cycamore { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ManagerInst::ManagerInst(cyclus::Context* ctx) - : cyclus::Institution(ctx), - latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} + : cyclus::Institution(ctx), + latitude(0.0), + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ManagerInst::~ManagerInst() {} @@ -43,7 +45,6 @@ void ManagerInst::EnterNotify() { Builder::Register(cp_cast); } } - RecordPosition(); } void ManagerInst::Register_(Agent* a) { @@ -89,18 +90,6 @@ void ManagerInst::WriteProducerInformation( } } -void ManagerInst::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - extern "C" cyclus::Agent* ConstructManagerInst(cyclus::Context* ctx) { return new ManagerInst(ctx); diff --git a/src/manager_inst.h b/src/manager_inst.h index f32890e1ec..e61cbf5ce1 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -76,10 +76,13 @@ class ManagerInst } double longitude; - cyclus::toolkit::Position coordinates; - - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/mixer.cc b/src/mixer.cc index 9f0a85d967..e4ed5b0bce 100644 --- a/src/mixer.cc +++ b/src/mixer.cc @@ -4,18 +4,15 @@ namespace cycamore { -Mixer::Mixer(cyclus::Context* ctx) - : cyclus::Facility(ctx), +Mixer::Mixer(cyclus::Context* ctx) + : cyclus::Facility(ctx), throughput(0), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) { + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); cyclus::Warn( "the Mixer archetype is experimental"); - usage_medatas.LoadUsageMetadatas(usage_datas); - - usage_medatas.RecordMetadatas(this); - coordinates.RecordPosition(this); } cyclus::Inventories Mixer::SnapshotInv() { @@ -133,10 +130,10 @@ Mixer::GetMatlRequests() { using cyclus::RequestPortfolio; std::set::Ptr> ports; - + for (int i = 0; i < in_commods.size(); i++) { std::string name = "in_stream_" + std::to_string(i); - + if (streambufs[name].space() > cyclus::eps_rsrc()) { RequestPortfolio::Ptr port( new RequestPortfolio()); @@ -145,7 +142,7 @@ Mixer::GetMatlRequests() { m = cyclus::NewBlankMaterial(streambufs[name].space()); std::vector*> reqs; - + std::map::iterator it; for (it = in_commods[i].begin() ; it != in_commods[i].end(); it++) { std::string commod = it->first; @@ -153,7 +150,7 @@ Mixer::GetMatlRequests() { reqs.push_back(port->AddRequest(m, this, commod , pref, false)); req_inventories_[reqs.back()] = name; } - port->AddMutualReqs(reqs); + port->AddMutualReqs(reqs); ports.insert(port); } } diff --git a/src/mixer.h b/src/mixer.h index 4402bf955e..2cacc7e99a 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -58,15 +58,6 @@ class Mixer protected: -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; - cyclus::toolkit::UsageMetadatas usage_medatas; - #pragma cyclus var { \ "alias": ["in_streams", [ "stream", [ "info", "mixing_ratio", "buf_size"], [ "commodities", "commodity", "pref"]]], \ "uitype": ["oneormore", [ "pair", ["pair", "double", "double"], ["oneormore", "incommodity", "double"]]], \ @@ -138,8 +129,14 @@ class Mixer } double longitude; - cyclus::toolkit::Position coordinates; +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/reactor.cc b/src/reactor.cc index 6f735c0cfc..c33f4e5212 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -24,9 +24,10 @@ Reactor::Reactor(cyclus::Context* ctx) power_name("power"), discharged(false), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} - + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} #pragma cyclus def clone cycamore::Reactor @@ -107,7 +108,6 @@ void Reactor::EnterNotify() { if (ss.str().size() > 0) { throw cyclus::ValueError(ss.str()); } - RecordPosition(); } bool Reactor::CheckDecommissionCondition() { @@ -231,7 +231,7 @@ std::set::Ptr> Reactor::GetMatlRequests() { double pref = fuel_prefs[j]; Composition::Ptr recipe = context()->GetRecipe(fuel_inrecipes[j]); m = Material::CreateUntracked(assem_size, recipe); - cyclus::toolkit::RecordTimeSeries("demand"+commod, this, + cyclus::toolkit::RecordTimeSeries("demand"+commod, this, assem_size); Request* r = port->AddRequest(m, this, commod, pref, true); mreqs.push_back(r); @@ -540,18 +540,6 @@ void Reactor::Record(std::string name, std::string val) { ->Record(); } -void Reactor::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - extern "C" cyclus::Agent* ConstructReactor(cyclus::Context* ctx) { return new Reactor(ctx); } diff --git a/src/reactor.h b/src/reactor.h index 1602bcbacb..d9a0790c49 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -449,10 +449,14 @@ class Reactor : public cyclus::Facility, } double longitude; - cyclus::toolkit::Position coordinates; - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/separations.cc b/src/separations.cc index 062f32514c..f146294479 100644 --- a/src/separations.cc +++ b/src/separations.cc @@ -11,11 +11,13 @@ using cyclus::CompMap; namespace cycamore { -Separations::Separations(cyclus::Context* ctx) +Separations::Separations(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} cyclus::Inventories Separations::SnapshotInv() { cyclus::Inventories invs; @@ -68,7 +70,6 @@ void Separations::EnterNotify() { for (it2 = stream.second.begin(); it2 != stream.second.end(); it2++) { efficiency_[it2->first] += it2->second; } - RecordPosition(); } std::vector eff_pb_; @@ -355,18 +356,6 @@ bool Separations::CheckDecommissionCondition() { return true; } -void Separations::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - void Separations::Record(std::string name, double val, std::string type) { context() ->NewDatum("SeparationEvents") diff --git a/src/separations.h b/src/separations.h index 5b83a5a0e6..6ae1dd658a 100644 --- a/src/separations.h +++ b/src/separations.h @@ -221,10 +221,16 @@ class Separations } double longitude; - cyclus::toolkit::Position coordinates; - /// Records an agent's latitude and longitude to the output db - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; + + void Record(std::string name, double val, std::string type); }; diff --git a/src/sink.cc b/src/sink.cc index 11c504e6ef..08c75766d0 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -13,9 +13,11 @@ Sink::Sink(cyclus::Context* ctx) : cyclus::Facility(ctx), capacity(std::numeric_limits::max()), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) { - SetMaxInventorySize(std::numeric_limits::max());} + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); + SetMaxInventorySize(std::numeric_limits::max()); +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Sink::~Sink() {} @@ -52,7 +54,6 @@ void Sink::EnterNotify() { << " values, expected " << in_commods.size(); throw cyclus::ValueError(ss.str()); } - RecordPosition(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -92,14 +93,14 @@ Sink::GetMatlRequests() { mat = cyclus::NewBlankMaterial(amt); } else { Composition::Ptr rec = this->context()->GetRecipe(recipe_name); - mat = cyclus::Material::CreateUntracked(amt, rec); - } + mat = cyclus::Material::CreateUntracked(amt, rec); + } if (amt > cyclus::eps()) { std::vector*> mutuals; for (int i = 0; i < in_commods.size(); i++) { mutuals.push_back(port->AddRequest(mat, this, in_commods[i], in_commod_prefs[i])); - + } port->AddMutualReqs(mutuals); ports.insert(port); @@ -172,7 +173,7 @@ void Sink::Tick() { commod++) { LOG(cyclus::LEV_INFO4, "SnkFac") << " will request " << requestAmt << " kg of " << *commod << "."; - cyclus::toolkit::RecordTimeSeries("demand"+*commod, this, + cyclus::toolkit::RecordTimeSeries("demand"+*commod, this, requestAmt); } } @@ -193,17 +194,6 @@ void Sink::Tock() { LOG(cyclus::LEV_INFO3, "SnkFac") << "}"; } -void Sink::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - extern "C" cyclus::Agent* ConstructSink(cyclus::Context* ctx) { diff --git a/src/sink.h b/src/sink.h index 35a6b7ab8e..15f3edaedc 100644 --- a/src/sink.h +++ b/src/sink.h @@ -169,9 +169,13 @@ class Sink } double longitude; - cyclus::toolkit::Position coordinates; - - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/source.cc b/src/source.cc index 3d7490ef81..3cd7ecddfd 100644 --- a/src/source.cc +++ b/src/source.cc @@ -1,7 +1,7 @@ #include "source.h" -#include #include +#include #include @@ -12,15 +12,16 @@ Source::Source(cyclus::Context* ctx) throughput(std::numeric_limits::max()), inventory_size(std::numeric_limits::max()), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) {} + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); +} Source::~Source() {} void Source::InitFrom(Source* m) { #pragma cyclus impl initfromcopy cycamore::Source cyclus::toolkit::CommodityProducer::Copy(m); - RecordPosition(); } void Source::InitFrom(cyclus::QueryableBackend* b) { @@ -28,7 +29,6 @@ void Source::InitFrom(cyclus::QueryableBackend* b) { namespace tk = cyclus::toolkit; tk::CommodityProducer::Add(tk::Commodity(outcommod), tk::CommodInfo(throughput, throughput)); - RecordPosition(); } std::string Source::str() { @@ -60,7 +60,7 @@ std::set::Ptr> Source::GetMatlBids( using cyclus::Request; double max_qty = std::min(throughput, inventory_size); - cyclus::toolkit::RecordTimeSeries("supply"+outcommod, this, + cyclus::toolkit::RecordTimeSeries("supply"+outcommod, this, max_qty); LOG(cyclus::LEV_INFO3, "Source") << prototype() << " is bidding up to " << max_qty << " kg of " << outcommod; @@ -117,18 +117,6 @@ void Source::GetMatlTrades( } } -void Source::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - extern "C" cyclus::Agent* ConstructSource(cyclus::Context* ctx) { return new Source(ctx); } diff --git a/src/source.h b/src/source.h index 64b9d7c164..bb732d35b1 100644 --- a/src/source.h +++ b/src/source.h @@ -131,9 +131,13 @@ class Source : public cyclus::Facility, } double longitude; - cyclus::toolkit::Position coordinates; - - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; }; } // namespace cycamore diff --git a/src/storage.cc b/src/storage.cc index 9004b22317..19e5681587 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -5,13 +5,15 @@ namespace storage { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Storage::Storage(cyclus::Context* ctx) +Storage::Storage(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), - longitude(0.0), - coordinates(latitude, longitude) { + longitude(0.0) { + usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); + coordinates = cyclus::toolkit::Position(latitude, longitude); cyclus::Warn( - "The Storage Facility is experimental.");}; + "The Storage Facility is experimental."); +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // pragmas @@ -83,7 +85,6 @@ void Storage::EnterNotify() { ss << "out_commods has " << out_commods.size() << " values, expected 1."; throw cyclus::ValueError(ss.str()); } - RecordPosition(); } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -226,19 +227,6 @@ void Storage::ReadyMatl_(int time) { ready.Push(processing.PopN(to_ready)); } -void Storage::RecordPosition() { - std::string specification = this->spec(); - context() - ->NewDatum("AgentPosition") - ->AddVal("Spec", specification) - ->AddVal("Prototype", this->prototype()) - ->AddVal("AgentId", id()) - ->AddVal("Latitude", latitude) - ->AddVal("Longitude", longitude) - ->Record(); -} - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - extern "C" cyclus::Agent* ConstructStorage(cyclus::Context* ctx) { return new Storage(ctx); diff --git a/src/storage.h b/src/storage.h index 4271c16893..be00c4b82d 100644 --- a/src/storage.h +++ b/src/storage.h @@ -229,9 +229,14 @@ class Storage } double longitude; - cyclus::toolkit::Position coordinates; - void RecordPosition(); +#pragma cyclus var { \ + "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ + "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ + "uilabel": "", \ + "doc": "", \ + } + std::map > usage_datas; friend class StorageTest; }; From 5ae8dbad6d2f704b82563cb61ea45261c1abef3b Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Thu, 23 May 2019 08:56:40 -0500 Subject: [PATCH 04/11] removing metadata from this branch --- src/deploy_inst.cc | 1 - src/deploy_inst.h | 7 ------- src/enrichment.cc | 1 - src/enrichment.h | 7 ------- src/fuel_fab.cc | 1 - src/fuel_fab.h | 7 ------- src/growth_region.cc | 1 - src/growth_region.h | 9 --------- src/manager_inst.cc | 1 - src/manager_inst.h | 7 ------- src/mixer.cc | 1 - src/mixer.h | 8 -------- src/reactor.cc | 1 - src/reactor.h | 8 -------- src/separations.cc | 1 - src/separations.h | 9 --------- src/sink.cc | 1 - src/sink.h | 7 ------- src/source.cc | 1 - src/source.h | 7 ------- src/storage.cc | 1 - src/storage.h | 9 --------- 22 files changed, 96 deletions(-) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index c5dcd458f0..6ad767535e 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -7,7 +7,6 @@ DeployInst::DeployInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/deploy_inst.h b/src/deploy_inst.h index 6074ca12dd..d5c486e871 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -99,13 +99,6 @@ class DeployInst : public cyclus::Institution { } double longitude; -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/enrichment.cc b/src/enrichment.cc index f8f75bb6ae..f91bcc4c05 100644 --- a/src/enrichment.cc +++ b/src/enrichment.cc @@ -25,7 +25,6 @@ Enrichment::Enrichment(cyclus::Context* ctx) order_prefs(true), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/enrichment.h b/src/enrichment.h index 4891e8c4c0..b2856d1458 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -398,13 +398,6 @@ class Enrichment } double longitude; -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index 7258893957..90b2ef251d 100644 --- a/src/fuel_fab.cc +++ b/src/fuel_fab.cc @@ -137,7 +137,6 @@ FuelFab::FuelFab(cyclus::Context* ctx) throughput(0), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/fuel_fab.h b/src/fuel_fab.h index f0db27fdee..451d6c6728 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -268,13 +268,6 @@ class FuelFab } double longitude; -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; double CosiWeight(cyclus::Composition::Ptr c, const std::string& spectrum); diff --git a/src/growth_region.cc b/src/growth_region.cc index b8717afcf0..3946b20f54 100644 --- a/src/growth_region.cc +++ b/src/growth_region.cc @@ -7,7 +7,6 @@ GrowthRegion::GrowthRegion(cyclus::Context* ctx) : cyclus::Region(ctx), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); #if !CYCLUS_HAS_COIN throw cyclus::Error("Growth Region requires that Cyclus & Cycamore be compiled " diff --git a/src/growth_region.h b/src/growth_region.h index 14cfb59ed4..7893c8b14e 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -143,15 +143,6 @@ class GrowthRegion : public cyclus::Region { "be expressed in degrees as a double." \ } double longitude; - - -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/manager_inst.cc b/src/manager_inst.cc index db903509dd..ddbbff6cb5 100644 --- a/src/manager_inst.cc +++ b/src/manager_inst.cc @@ -8,7 +8,6 @@ ManagerInst::ManagerInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/manager_inst.h b/src/manager_inst.h index e61cbf5ce1..29fe9a4a91 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -76,13 +76,6 @@ class ManagerInst } double longitude; -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/mixer.cc b/src/mixer.cc index e4ed5b0bce..f8ee5adec1 100644 --- a/src/mixer.cc +++ b/src/mixer.cc @@ -9,7 +9,6 @@ Mixer::Mixer(cyclus::Context* ctx) throughput(0), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); cyclus::Warn( "the Mixer archetype is experimental"); diff --git a/src/mixer.h b/src/mixer.h index 2cacc7e99a..58fbb62274 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -129,14 +129,6 @@ class Mixer } double longitude; - -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/reactor.cc b/src/reactor.cc index c33f4e5212..19e8919d69 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -25,7 +25,6 @@ Reactor::Reactor(cyclus::Context* ctx) discharged(false), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/reactor.h b/src/reactor.h index d9a0790c49..8f74370481 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -449,14 +449,6 @@ class Reactor : public cyclus::Facility, } double longitude; - -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/separations.cc b/src/separations.cc index f146294479..6dc00f9052 100644 --- a/src/separations.cc +++ b/src/separations.cc @@ -15,7 +15,6 @@ Separations::Separations(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/separations.h b/src/separations.h index 6ae1dd658a..b616574851 100644 --- a/src/separations.h +++ b/src/separations.h @@ -221,15 +221,6 @@ class Separations } double longitude; - -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; - void Record(std::string name, double val, std::string type); }; diff --git a/src/sink.cc b/src/sink.cc index 08c75766d0..0baace0c6b 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -14,7 +14,6 @@ Sink::Sink(cyclus::Context* ctx) capacity(std::numeric_limits::max()), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); SetMaxInventorySize(std::numeric_limits::max()); } diff --git a/src/sink.h b/src/sink.h index 15f3edaedc..de9282d90e 100644 --- a/src/sink.h +++ b/src/sink.h @@ -169,13 +169,6 @@ class Sink } double longitude; -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/source.cc b/src/source.cc index 3cd7ecddfd..26df5006c2 100644 --- a/src/source.cc +++ b/src/source.cc @@ -13,7 +13,6 @@ Source::Source(cyclus::Context* ctx) inventory_size(std::numeric_limits::max()), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); } diff --git a/src/source.h b/src/source.h index bb732d35b1..6797d2cc57 100644 --- a/src/source.h +++ b/src/source.h @@ -131,13 +131,6 @@ class Source : public cyclus::Facility, } double longitude; -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; }; } // namespace cycamore diff --git a/src/storage.cc b/src/storage.cc index 19e5681587..3873800b4a 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -9,7 +9,6 @@ Storage::Storage(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), longitude(0.0) { - usagesdata = cyclus::toolkit::UsageMetadatas(usage_datas); coordinates = cyclus::toolkit::Position(latitude, longitude); cyclus::Warn( "The Storage Facility is experimental."); diff --git a/src/storage.h b/src/storage.h index be00c4b82d..66add78325 100644 --- a/src/storage.h +++ b/src/storage.h @@ -229,15 +229,6 @@ class Storage } double longitude; - -#pragma cyclus var { \ - "alias": ["usagemetadata", "keyword", ["usage", "key", "value"]], \ - "uitype": ["onemore", "string", ["onemore", "string", "double"]], \ - "uilabel": "", \ - "doc": "", \ - } - std::map > usage_datas; - friend class StorageTest; }; From 169fe9afa9f58159c518497287f728596c94fee0 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 29 May 2019 12:59:05 -0500 Subject: [PATCH 05/11] include position snippet include --- src/deploy_inst.h | 17 ++--------------- src/enrichment.h | 19 ++----------------- src/fuel_fab.h | 16 +--------------- src/growth_region.h | 16 +--------------- src/manager_inst.h | 16 +--------------- src/mixer.h | 16 +--------------- src/reactor.h | 16 +--------------- src/separations.h | 16 +--------------- src/sink.h | 16 +--------------- src/source.h | 16 +--------------- src/storage.h | 16 +--------------- 11 files changed, 13 insertions(+), 167 deletions(-) diff --git a/src/deploy_inst.h b/src/deploy_inst.h index d5c486e871..61187e250c 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -83,21 +83,8 @@ class DeployInst : public cyclus::Institution { std::vector lifetimes; private: - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + + #include "toolkit/position.cycpp" }; diff --git a/src/enrichment.h b/src/enrichment.h index b2856d1458..04540907db 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -379,24 +379,9 @@ class Enrichment double intra_timestep_swu_; double intra_timestep_feed_; - friend class EnrichmentTest; - // --- - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; + #include "toolkit/position.cycpp" - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + friend class EnrichmentTest; }; diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 451d6c6728..5bc4318a64 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -252,21 +252,7 @@ class FuelFab // map std::map*, std::string> req_inventories_; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; diff --git a/src/growth_region.h b/src/growth_region.h index 7893c8b14e..403b543950 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -128,21 +128,7 @@ class GrowthRegion : public cyclus::Region { void OrderBuilds(cyclus::toolkit::Commodity& commodity, double unmetdemand); private: - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; } // namespace cycamore diff --git a/src/manager_inst.h b/src/manager_inst.h index 29fe9a4a91..e842eed034 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -60,21 +60,7 @@ class ManagerInst } std::vector prototypes; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; diff --git a/src/mixer.h b/src/mixer.h index 58fbb62274..cba33212bd 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -113,21 +113,7 @@ class Mixer cyclus::toolkit::MatlSellPolicy sell_policy; private: - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; diff --git a/src/reactor.h b/src/reactor.h index 8f74370481..a0c70a5a58 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -433,21 +433,7 @@ class Reactor : public cyclus::Facility, // populated lazily and no need to persist. std::set uniq_outcommods_; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; diff --git a/src/separations.h b/src/separations.h index b616574851..87c6332bb4 100644 --- a/src/separations.h +++ b/src/separations.h @@ -205,21 +205,7 @@ class Separations // state var. std::map > streambufs; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" void Record(std::string name, double val, std::string type); diff --git a/src/sink.h b/src/sink.h index de9282d90e..c86b3fc164 100644 --- a/src/sink.h +++ b/src/sink.h @@ -153,21 +153,7 @@ class Sink #pragma cyclus var {'capacity': 'max_inv_size'} cyclus::toolkit::ResBuf inventory; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; diff --git a/src/source.h b/src/source.h index 6797d2cc57..920e42d176 100644 --- a/src/source.h +++ b/src/source.h @@ -115,21 +115,7 @@ class Source : public cyclus::Facility, } double throughput; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" }; diff --git a/src/storage.h b/src/storage.h index 66add78325..27ea2c6202 100644 --- a/src/storage.h +++ b/src/storage.h @@ -213,21 +213,7 @@ class Storage //// A policy for sending material cyclus::toolkit::MatlSellPolicy sell_policy; - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical latitude in degrees as a double", \ - "doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double latitude; - - #pragma cyclus var { \ - "default": 0.0, \ - "uilabel": "Geographical longitude in degrees as a double", \ - "doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ - } - double longitude; + #include "toolkit/position.cycpp" friend class StorageTest; }; From b20113d2fc559cbf42782010ca8424f593dd4eac Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Mon, 3 Jun 2019 09:21:23 -0500 Subject: [PATCH 06/11] change archetypes --- src/deploy_inst.cc | 2 +- src/deploy_inst.h | 4 +++- src/enrichment.cc | 2 +- src/enrichment.h | 3 ++- src/fuel_fab.cc | 2 +- src/fuel_fab.h | 3 ++- src/growth_region.cc | 2 +- src/growth_region.h | 5 ++++- src/manager_inst.cc | 2 +- src/manager_inst.h | 1 + src/mixer.cc | 2 +- src/mixer.h | 3 ++- src/reactor.cc | 2 +- src/reactor.h | 22 +++++++++++++++++++--- src/separations.cc | 2 +- src/separations.h | 3 ++- src/sink.cc | 2 +- src/sink.h | 3 ++- src/source.cc | 2 +- src/source.h | 6 ++++-- src/storage.cc | 2 +- src/storage.h | 1 + 22 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index 6ad767535e..3674362eb3 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -7,7 +7,7 @@ DeployInst::DeployInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } DeployInst::~DeployInst() {} diff --git a/src/deploy_inst.h b/src/deploy_inst.h index 61187e250c..71880cfec7 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -19,7 +19,9 @@ typedef std::map > BuildSched; // lifetimes. The same prototype can be specified multiple times with any // combination of the same or different build times, build number, and // lifetimes. -class DeployInst : public cyclus::Institution { +class DeployInst + : public cyclus::toolkit::Position, + public cyclus::Institution { #pragma cyclus note { \ "doc": \ "Builds and manages agents (facilities) according to a manually" \ diff --git a/src/enrichment.cc b/src/enrichment.cc index f91bcc4c05..a22f18ddcb 100644 --- a/src/enrichment.cc +++ b/src/enrichment.cc @@ -25,7 +25,7 @@ Enrichment::Enrichment(cyclus::Context* ctx) order_prefs(true), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/enrichment.h b/src/enrichment.h index 04540907db..ba39bb8a5d 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -116,7 +116,8 @@ class NatUConverter : public cyclus::Converter { /// tails inventory. class Enrichment - : public cyclus::Facility { + : public cyclus::Facility, + public cyclus::toolkit::Position { #pragma cyclus note { \ "niche": "enrichment facility", \ "doc": \ diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index 90b2ef251d..49b44cba07 100644 --- a/src/fuel_fab.cc +++ b/src/fuel_fab.cc @@ -137,7 +137,7 @@ FuelFab::FuelFab(cyclus::Context* ctx) throughput(0), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } void FuelFab::EnterNotify() { diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 5bc4318a64..48f29c62fa 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -54,7 +54,8 @@ namespace cycamore { /// Breeding. Economics, and Safety in Large Fast Power Reactors. 1963. /// @endcode class FuelFab - : public cyclus::Facility { + : public cyclus::Facility, + public cyclus::toolkit::Position { #pragma cyclus note { \ "niche": "fabrication", \ "doc": \ diff --git a/src/growth_region.cc b/src/growth_region.cc index 3946b20f54..e0d7c47363 100644 --- a/src/growth_region.cc +++ b/src/growth_region.cc @@ -7,7 +7,7 @@ GrowthRegion::GrowthRegion(cyclus::Context* ctx) : cyclus::Region(ctx), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); #if !CYCLUS_HAS_COIN throw cyclus::Error("Growth Region requires that Cyclus & Cycamore be compiled " "with COIN support."); diff --git a/src/growth_region.h b/src/growth_region.h index 403b543950..ade7cc52e4 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -35,8 +35,11 @@ typedef std::vector< /// multiple commodities being demanded. /// /// @warning The growth region is experimental -class GrowthRegion : public cyclus::Region { +class GrowthRegion + : public cyclus::Region, + public cyclus::toolkit::Position { friend class GrowthRegionTests; + public: /// The default constructor for the GrowthRegion GrowthRegion(cyclus::Context* ctx); diff --git a/src/manager_inst.cc b/src/manager_inst.cc index ddbbff6cb5..90b1730ae7 100644 --- a/src/manager_inst.cc +++ b/src/manager_inst.cc @@ -8,7 +8,7 @@ ManagerInst::ManagerInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/manager_inst.h b/src/manager_inst.h index e842eed034..487e32e60b 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -13,6 +13,7 @@ namespace cycamore { class ManagerInst : public cyclus::Institution, public cyclus::toolkit::CommodityProducerManager, + public cyclus::toolkit::Position, public cyclus::toolkit::Builder { public: /// Default constructor diff --git a/src/mixer.cc b/src/mixer.cc index f8ee5adec1..87e456a127 100644 --- a/src/mixer.cc +++ b/src/mixer.cc @@ -9,7 +9,7 @@ Mixer::Mixer(cyclus::Context* ctx) throughput(0), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); cyclus::Warn( "the Mixer archetype is experimental"); } diff --git a/src/mixer.h b/src/mixer.h index cba33212bd..abcf7e66f3 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -13,7 +13,8 @@ namespace cycamore { /// mixed material is constrained by available inventory of mixed material /// quantities. class Mixer - : public cyclus::Facility { + : public cyclus::Facility, + public cyclus::toolkit::Position { #pragma cyclus note { \ "niche": "mixing facility", \ "doc": "Mixer mixes N streams with fixed, static, user-specified" \ diff --git a/src/reactor.cc b/src/reactor.cc index 19e8919d69..279b69203f 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -25,7 +25,7 @@ Reactor::Reactor(cyclus::Context* ctx) discharged(false), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } #pragma cyclus def clone cycamore::Reactor diff --git a/src/reactor.h b/src/reactor.h index a0c70a5a58..ddce75c927 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -52,8 +52,10 @@ namespace cycamore { /// int) of its assemblies are transmuted to their respective burnt /// compositions. -class Reactor : public cyclus::Facility, - public cyclus::toolkit::CommodityProducer { +class Reactor + : public cyclus::Facility, + public cyclus::toolkit::Position, + public cyclus::toolkit::CommodityProducer { #pragma cyclus note { \ "niche": "reactor", \ "doc": \ @@ -433,7 +435,21 @@ class Reactor : public cyclus::Facility, // populated lazily and no need to persist. std::set uniq_outcommods_; - #include "toolkit/position.cycpp" +#pragma cyclus var { \ +"default": 0.0, \ +"uilabel": "Geographical latitude in degrees as a double", \ +"doc": "Latitude of the agent's geographical position. The value should " \ + "be expressed in degrees as a double." \ +} +double latitude; + +#pragma cyclus var { \ +"default": 0.0, \ +"uilabel": "Geographical longitude in degrees as a double", \ +"doc": "Longitude of the agent's geographical position. The value should " \ + "be expressed in degrees as a double." \ +} +double longitude; }; diff --git a/src/separations.cc b/src/separations.cc index 6dc00f9052..c942ea2be7 100644 --- a/src/separations.cc +++ b/src/separations.cc @@ -15,7 +15,7 @@ Separations::Separations(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } cyclus::Inventories Separations::SnapshotInv() { diff --git a/src/separations.h b/src/separations.h index 87c6332bb4..90e6f13c41 100644 --- a/src/separations.h +++ b/src/separations.h @@ -35,7 +35,8 @@ cyclus::Material::Ptr SepMaterial(std::map effs, /// streams, further processing/separations of feed material will halt until /// room is again available in the output streams. class Separations - : public cyclus::Facility { + : public cyclus::Facility, + public cyclus::toolkit::Position { #pragma cyclus note { \ "niche": "separations", \ "doc": \ diff --git a/src/sink.cc b/src/sink.cc index 0baace0c6b..1e007816b2 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -14,7 +14,7 @@ Sink::Sink(cyclus::Context* ctx) capacity(std::numeric_limits::max()), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); SetMaxInventorySize(std::numeric_limits::max()); } diff --git a/src/sink.h b/src/sink.h index c86b3fc164..51d86d2e11 100644 --- a/src/sink.h +++ b/src/sink.h @@ -19,7 +19,8 @@ class Context; /// default to infinite. If a recipe is provided, it will request material with /// that recipe. Requests are made for any number of specified commodities. class Sink - : public cyclus::Facility { + : public cyclus::Facility, + public cyclus::toolkit::Position { public: Sink(cyclus::Context* ctx); diff --git a/src/source.cc b/src/source.cc index 26df5006c2..c059a10a12 100644 --- a/src/source.cc +++ b/src/source.cc @@ -13,7 +13,7 @@ Source::Source(cyclus::Context* ctx) inventory_size(std::numeric_limits::max()), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); } Source::~Source() {} diff --git a/src/source.h b/src/source.h index 920e42d176..7d4324cc97 100644 --- a/src/source.h +++ b/src/source.h @@ -20,8 +20,10 @@ class Context; /// infinite. Supplies material results in corresponding decrease in /// inventory, and when the inventory size reaches zero, the source can provide /// no more material. -class Source : public cyclus::Facility, - public cyclus::toolkit::CommodityProducer { +class Source + : public cyclus::Facility, + public cyclus::toolkit::CommodityProducer, + public cyclus::toolkit::Position { friend class SourceTest; public: diff --git a/src/storage.cc b/src/storage.cc index 3873800b4a..855990e1a8 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -9,7 +9,7 @@ Storage::Storage(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), longitude(0.0) { - coordinates = cyclus::toolkit::Position(latitude, longitude); + cyclus::toolkit::Position(latitude, longitude); cyclus::Warn( "The Storage Facility is experimental."); } diff --git a/src/storage.h b/src/storage.h index 27ea2c6202..e143fdc949 100644 --- a/src/storage.h +++ b/src/storage.h @@ -65,6 +65,7 @@ namespace storage { /// Matched resources are sent immediately. class Storage : public cyclus::Facility, + public cyclus::toolkit::Position, public cyclus::toolkit::CommodityProducer { public: /// @param ctx the cyclus context for access to simulation-wide parameters From 383043630416cb8deb9ce69f766d3842f6d8066b Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Mon, 3 Jun 2019 09:50:08 -0500 Subject: [PATCH 07/11] add mising RecordPosition --- src/deploy_inst.cc | 2 ++ src/enrichment.cc | 6 ++++++ src/enrichment.h | 1 + src/fuel_fab.cc | 1 + src/growth_region.cc | 1 + src/manager_inst.cc | 1 + src/mixer.cc | 1 + src/reactor.cc | 1 + src/separations.cc | 1 + src/sink.cc | 1 + src/source.cc | 6 ++++++ src/source.h | 2 ++ src/storage.cc | 1 + 13 files changed, 25 insertions(+) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index 3674362eb3..31b5f56b25 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -49,6 +49,8 @@ void DeployInst::Build(cyclus::Agent* parent) { void DeployInst::EnterNotify() { cyclus::Institution::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); + int n = prototypes.size(); if (build_times.size() != n) { std::stringstream ss; diff --git a/src/enrichment.cc b/src/enrichment.cc index c1c66fddd7..acee392812 100644 --- a/src/enrichment.cc +++ b/src/enrichment.cc @@ -58,6 +58,12 @@ void Enrichment::Build(cyclus::Agent* parent) { LOG(cyclus::LEV_DEBUG2, "EnrFac") << str(); } +void Enrichment::EnterNotify() { + cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); + +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Enrichment::Tick() { current_swu_capacity = SwuCapacity(); diff --git a/src/enrichment.h b/src/enrichment.h index ba39bb8a5d..e6c5053e04 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -172,6 +172,7 @@ class Enrichment /// perform module-specific tasks when entering the simulation virtual void Build(cyclus::Agent* parent); // --- + virtual void EnterNotify(); // --- Agent Members --- /// Each facility is prompted to do its beginning-of-time-step diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index 49b44cba07..69a8f4c2b1 100644 --- a/src/fuel_fab.cc +++ b/src/fuel_fab.cc @@ -142,6 +142,7 @@ FuelFab::FuelFab(cyclus::Context* ctx) void FuelFab::EnterNotify() { cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); if (fiss_commod_prefs.empty()) { for (int i = 0; i < fiss_commods.size(); i++) { diff --git a/src/growth_region.cc b/src/growth_region.cc index e0d7c47363..b538c214f8 100644 --- a/src/growth_region.cc +++ b/src/growth_region.cc @@ -41,6 +41,7 @@ void GrowthRegion::AddCommodityDemand_(std::string commod, void GrowthRegion::EnterNotify() { cyclus::Region::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); std::set::iterator ait; for (ait = cyclus::Agent::children().begin(); ait != cyclus::Agent::children().end(); diff --git a/src/manager_inst.cc b/src/manager_inst.cc index 90b1730ae7..33459cfc4e 100644 --- a/src/manager_inst.cc +++ b/src/manager_inst.cc @@ -24,6 +24,7 @@ void ManagerInst::DecomNotify(Agent* a) { void ManagerInst::EnterNotify() { cyclus::Institution::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); std::set::iterator sit; for (sit = cyclus::Agent::children().begin(); sit != cyclus::Agent::children().end(); diff --git a/src/mixer.cc b/src/mixer.cc index 9e162c59cc..986a95211f 100644 --- a/src/mixer.cc +++ b/src/mixer.cc @@ -44,6 +44,7 @@ void Mixer::InitInv(cyclus::Inventories& inv) { void Mixer::EnterNotify() { cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); mixing_ratios.clear(); in_buf_sizes.clear(); diff --git a/src/reactor.cc b/src/reactor.cc index 7b0a92f609..a8dc610106 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -63,6 +63,7 @@ void Reactor::InitFrom(cyclus::QueryableBackend* b) { void Reactor::EnterNotify() { cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); // If the user ommitted fuel_prefs, we set it to zeros for each fuel // type. Without this segfaults could occur - yuck. diff --git a/src/separations.cc b/src/separations.cc index 72f4117337..854dfd6f07 100644 --- a/src/separations.cc +++ b/src/separations.cc @@ -53,6 +53,7 @@ typedef std::map StreamSet; void Separations::EnterNotify() { cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); std::map efficiency_; StreamSet::iterator it; diff --git a/src/sink.cc b/src/sink.cc index 1e007816b2..94b236295d 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -42,6 +42,7 @@ Sink::~Sink() {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Sink::EnterNotify() { cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); if (in_commod_prefs.size() == 0) { for (int i = 0; i < in_commods.size(); ++i) { diff --git a/src/source.cc b/src/source.cc index c059a10a12..1bc5d7cfc9 100644 --- a/src/source.cc +++ b/src/source.cc @@ -50,6 +50,12 @@ std::string Source::str() { return ss.str(); } +void Source::EnterNotify() { + cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); +} + + std::set::Ptr> Source::GetMatlBids( cyclus::CommodMap::type& commod_requests) { using cyclus::Bid; diff --git a/src/source.h b/src/source.h index 7d4324cc97..8209ac1485 100644 --- a/src/source.h +++ b/src/source.h @@ -61,6 +61,8 @@ class Source virtual void Tick() {}; virtual void Tock() {}; + + virtual void EnterNotify(); virtual std::string str(); diff --git a/src/storage.cc b/src/storage.cc index fca1199e9c..91f73f3048 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -50,6 +50,7 @@ void Storage::InitFrom(cyclus::QueryableBackend* b) { //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Storage::EnterNotify() { cyclus::Facility::EnterNotify(); + cyclus::toolkit::Position::RecordPosition(this); buy_policy.Init(this, &inventory, std::string("inventory")); // dummy comp, use in_recipe if provided From 645e8df3aa67eda052389e261dac1ee12737e7db Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Tue, 4 Jun 2019 19:33:45 -0500 Subject: [PATCH 08/11] this fixes it! --- src/deploy_inst.cc | 9 +++++---- src/deploy_inst.h | 4 +--- src/enrichment.cc | 9 +++++---- src/enrichment.h | 4 +--- src/fuel_fab.cc | 9 +++++---- src/fuel_fab.h | 4 +--- src/growth_region.cc | 9 ++++++--- src/growth_region.h | 4 +--- src/manager_inst.cc | 10 ++++++---- src/manager_inst.h | 1 - src/mixer.cc | 8 +++++--- src/mixer.h | 4 +--- src/reactor.cc | 9 +++++---- src/reactor.h | 17 +---------------- src/separations.cc | 10 ++++++---- src/separations.h | 4 +--- src/sink.cc | 8 +++++--- src/sink.h | 4 +--- src/source.cc | 9 +++++---- src/source.h | 3 +-- src/storage.cc | 9 ++++++--- src/storage.h | 1 - 22 files changed, 68 insertions(+), 81 deletions(-) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index 31b5f56b25..29f02c1869 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -6,9 +6,8 @@ namespace cycamore { DeployInst::DeployInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} DeployInst::~DeployInst() {} @@ -49,7 +48,9 @@ void DeployInst::Build(cyclus::Agent* parent) { void DeployInst::EnterNotify() { cyclus::Institution::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); int n = prototypes.size(); if (build_times.size() != n) { diff --git a/src/deploy_inst.h b/src/deploy_inst.h index 71880cfec7..61187e250c 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -19,9 +19,7 @@ typedef std::map > BuildSched; // lifetimes. The same prototype can be specified multiple times with any // combination of the same or different build times, build number, and // lifetimes. -class DeployInst - : public cyclus::toolkit::Position, - public cyclus::Institution { +class DeployInst : public cyclus::Institution { #pragma cyclus note { \ "doc": \ "Builds and manages agents (facilities) according to a manually" \ diff --git a/src/enrichment.cc b/src/enrichment.cc index acee392812..c9074536e2 100644 --- a/src/enrichment.cc +++ b/src/enrichment.cc @@ -24,9 +24,8 @@ Enrichment::Enrichment(cyclus::Context* ctx) tails_commod(""), order_prefs(true), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Enrichment::~Enrichment() {} @@ -60,7 +59,9 @@ void Enrichment::Build(cyclus::Agent* parent) { void Enrichment::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); } diff --git a/src/enrichment.h b/src/enrichment.h index e6c5053e04..9791f4f79a 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -115,9 +115,7 @@ class NatUConverter : public cyclus::Converter { /// no associated recipe. Bids for tails are constrained only by total /// tails inventory. -class Enrichment - : public cyclus::Facility, - public cyclus::toolkit::Position { +class Enrichment : public cyclus::Facility { #pragma cyclus note { \ "niche": "enrichment facility", \ "doc": \ diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index 69a8f4c2b1..e226811f5c 100644 --- a/src/fuel_fab.cc +++ b/src/fuel_fab.cc @@ -136,13 +136,14 @@ FuelFab::FuelFab(cyclus::Context* ctx) fiss_size(0), throughput(0), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} void FuelFab::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); if (fiss_commod_prefs.empty()) { for (int i = 0; i < fiss_commods.size(); i++) { diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 48f29c62fa..9c3192289f 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -53,9 +53,7 @@ namespace cycamore { /// uranium isotopes in fast reactors." Proceedings of the Conference on /// Breeding. Economics, and Safety in Large Fast Power Reactors. 1963. /// @endcode -class FuelFab - : public cyclus::Facility, - public cyclus::toolkit::Position { +class FuelFab : public cyclus::Facility { #pragma cyclus note { \ "niche": "fabrication", \ "doc": \ diff --git a/src/growth_region.cc b/src/growth_region.cc index b538c214f8..3d37a5fcda 100644 --- a/src/growth_region.cc +++ b/src/growth_region.cc @@ -6,8 +6,8 @@ namespace cycamore { GrowthRegion::GrowthRegion(cyclus::Context* ctx) : cyclus::Region(ctx), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); + longitude(0.0), + coordinates(0,0) { #if !CYCLUS_HAS_COIN throw cyclus::Error("Growth Region requires that Cyclus & Cycamore be compiled " "with COIN support."); @@ -41,7 +41,10 @@ void GrowthRegion::AddCommodityDemand_(std::string commod, void GrowthRegion::EnterNotify() { cyclus::Region::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); + std::set::iterator ait; for (ait = cyclus::Agent::children().begin(); ait != cyclus::Agent::children().end(); diff --git a/src/growth_region.h b/src/growth_region.h index ade7cc52e4..dac9e6cfed 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -35,9 +35,7 @@ typedef std::vector< /// multiple commodities being demanded. /// /// @warning The growth region is experimental -class GrowthRegion - : public cyclus::Region, - public cyclus::toolkit::Position { +class GrowthRegion : public cyclus::Region { friend class GrowthRegionTests; public: diff --git a/src/manager_inst.cc b/src/manager_inst.cc index 33459cfc4e..c34017e741 100644 --- a/src/manager_inst.cc +++ b/src/manager_inst.cc @@ -7,9 +7,8 @@ namespace cycamore { ManagerInst::ManagerInst(cyclus::Context* ctx) : cyclus::Institution(ctx), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ManagerInst::~ManagerInst() {} @@ -24,7 +23,10 @@ void ManagerInst::DecomNotify(Agent* a) { void ManagerInst::EnterNotify() { cyclus::Institution::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); + std::set::iterator sit; for (sit = cyclus::Agent::children().begin(); sit != cyclus::Agent::children().end(); diff --git a/src/manager_inst.h b/src/manager_inst.h index 487e32e60b..e842eed034 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -13,7 +13,6 @@ namespace cycamore { class ManagerInst : public cyclus::Institution, public cyclus::toolkit::CommodityProducerManager, - public cyclus::toolkit::Position, public cyclus::toolkit::Builder { public: /// Default constructor diff --git a/src/mixer.cc b/src/mixer.cc index 986a95211f..8e42ee65be 100644 --- a/src/mixer.cc +++ b/src/mixer.cc @@ -8,8 +8,8 @@ Mixer::Mixer(cyclus::Context* ctx) : cyclus::Facility(ctx), throughput(0), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); + longitude(0.0), + coordinates(0,0) { cyclus::Warn( "the Mixer archetype is experimental"); } @@ -44,7 +44,9 @@ void Mixer::InitInv(cyclus::Inventories& inv) { void Mixer::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); mixing_ratios.clear(); in_buf_sizes.clear(); diff --git a/src/mixer.h b/src/mixer.h index abcf7e66f3..c53ddca33a 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -12,9 +12,7 @@ namespace cycamore { /// one for each streams to be mixed, and one output stream. The supplying of /// mixed material is constrained by available inventory of mixed material /// quantities. -class Mixer - : public cyclus::Facility, - public cyclus::toolkit::Position { +class Mixer : public cyclus::Facility { #pragma cyclus note { \ "niche": "mixing facility", \ "doc": "Mixer mixes N streams with fixed, static, user-specified" \ diff --git a/src/reactor.cc b/src/reactor.cc index a8dc610106..255fd1a93b 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -24,9 +24,8 @@ Reactor::Reactor(cyclus::Context* ctx) power_name("power"), discharged(false), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} #pragma cyclus def clone cycamore::Reactor @@ -63,7 +62,9 @@ void Reactor::InitFrom(cyclus::QueryableBackend* b) { void Reactor::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); // If the user ommitted fuel_prefs, we set it to zeros for each fuel // type. Without this segfaults could occur - yuck. diff --git a/src/reactor.h b/src/reactor.h index ddce75c927..5b901da5ce 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -54,7 +54,6 @@ namespace cycamore { class Reactor : public cyclus::Facility, - public cyclus::toolkit::Position, public cyclus::toolkit::CommodityProducer { #pragma cyclus note { \ "niche": "reactor", \ @@ -435,21 +434,7 @@ class Reactor // populated lazily and no need to persist. std::set uniq_outcommods_; -#pragma cyclus var { \ -"default": 0.0, \ -"uilabel": "Geographical latitude in degrees as a double", \ -"doc": "Latitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ -} -double latitude; - -#pragma cyclus var { \ -"default": 0.0, \ -"uilabel": "Geographical longitude in degrees as a double", \ -"doc": "Longitude of the agent's geographical position. The value should " \ - "be expressed in degrees as a double." \ -} -double longitude; +#include "toolkit/position.cycpp" }; diff --git a/src/separations.cc b/src/separations.cc index 854dfd6f07..396ff0e56c 100644 --- a/src/separations.cc +++ b/src/separations.cc @@ -14,9 +14,8 @@ namespace cycamore { Separations::Separations(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} cyclus::Inventories Separations::SnapshotInv() { cyclus::Inventories invs; @@ -53,7 +52,10 @@ typedef std::map StreamSet; void Separations::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); + std::map efficiency_; StreamSet::iterator it; diff --git a/src/separations.h b/src/separations.h index 90e6f13c41..84d6df31d7 100644 --- a/src/separations.h +++ b/src/separations.h @@ -34,9 +34,7 @@ cyclus::Material::Ptr SepMaterial(std::map effs, /// reduce its stocks by trading and hits this limit for any of its output /// streams, further processing/separations of feed material will halt until /// room is again available in the output streams. -class Separations - : public cyclus::Facility, - public cyclus::toolkit::Position { +class Separations : public cyclus::Facility { #pragma cyclus note { \ "niche": "separations", \ "doc": \ diff --git a/src/sink.cc b/src/sink.cc index 94b236295d..675b432f53 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -13,8 +13,8 @@ Sink::Sink(cyclus::Context* ctx) : cyclus::Facility(ctx), capacity(std::numeric_limits::max()), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); + longitude(0.0), + coordinates(0,0) { SetMaxInventorySize(std::numeric_limits::max()); } @@ -42,7 +42,9 @@ Sink::~Sink() {} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Sink::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); if (in_commod_prefs.size() == 0) { for (int i = 0; i < in_commods.size(); ++i) { diff --git a/src/sink.h b/src/sink.h index 51d86d2e11..5a194861ea 100644 --- a/src/sink.h +++ b/src/sink.h @@ -18,9 +18,7 @@ class Context; /// total inventory size. The inventory size and throughput capacity both /// default to infinite. If a recipe is provided, it will request material with /// that recipe. Requests are made for any number of specified commodities. -class Sink - : public cyclus::Facility, - public cyclus::toolkit::Position { +class Sink : public cyclus::Facility { public: Sink(cyclus::Context* ctx); diff --git a/src/source.cc b/src/source.cc index 1bc5d7cfc9..0c43333434 100644 --- a/src/source.cc +++ b/src/source.cc @@ -12,9 +12,8 @@ Source::Source(cyclus::Context* ctx) throughput(std::numeric_limits::max()), inventory_size(std::numeric_limits::max()), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); -} + longitude(0.0), + coordinates(0,0) {} Source::~Source() {} @@ -52,7 +51,9 @@ std::string Source::str() { void Source::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); } diff --git a/src/source.h b/src/source.h index 8209ac1485..cc8dc4dc06 100644 --- a/src/source.h +++ b/src/source.h @@ -22,8 +22,7 @@ class Context; /// no more material. class Source : public cyclus::Facility, - public cyclus::toolkit::CommodityProducer, - public cyclus::toolkit::Position { + public cyclus::toolkit::CommodityProducer { friend class SourceTest; public: diff --git a/src/storage.cc b/src/storage.cc index 91f73f3048..ccebdc400a 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -8,8 +8,8 @@ namespace storage { Storage::Storage(cyclus::Context* ctx) : cyclus::Facility(ctx), latitude(0.0), - longitude(0.0) { - cyclus::toolkit::Position(latitude, longitude); + longitude(0.0), + coordinates(0,0) { cyclus::Warn( "The Storage Facility is experimental."); } @@ -50,7 +50,10 @@ void Storage::InitFrom(cyclus::QueryableBackend* b) { //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Storage::EnterNotify() { cyclus::Facility::EnterNotify(); - cyclus::toolkit::Position::RecordPosition(this); + + coordinates = cyclus::toolkit::Position(latitude, longitude); + coordinates.RecordPosition(this); + buy_policy.Init(this, &inventory, std::string("inventory")); // dummy comp, use in_recipe if provided diff --git a/src/storage.h b/src/storage.h index e143fdc949..27ea2c6202 100644 --- a/src/storage.h +++ b/src/storage.h @@ -65,7 +65,6 @@ namespace storage { /// Matched resources are sent immediately. class Storage : public cyclus::Facility, - public cyclus::toolkit::Position, public cyclus::toolkit::CommodityProducer { public: /// @param ctx the cyclus context for access to simulation-wide parameters From 3ddc76d96d02b4797b05da48b9a684228455bf04 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 5 Jun 2019 09:23:23 -0500 Subject: [PATCH 09/11] add comment to inform about the include "position.cycpp" --- src/deploy_inst.h | 3 ++- src/enrichment.h | 1 + src/fuel_fab.h | 1 + src/growth_region.h | 3 +++ src/manager_inst.h | 1 + src/mixer.h | 2 ++ src/reactor.h | 3 ++- src/separations.h | 1 + src/sink.h | 1 + src/source.h | 1 + src/storage.h | 1 + 11 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/deploy_inst.h b/src/deploy_inst.h index 61187e250c..4e6e130b72 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -83,7 +83,8 @@ class DeployInst : public cyclus::Institution { std::vector lifetimes; private: - + + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" }; diff --git a/src/enrichment.h b/src/enrichment.h index 9791f4f79a..c42afd93cd 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -379,6 +379,7 @@ class Enrichment : public cyclus::Facility { double intra_timestep_swu_; double intra_timestep_feed_; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" friend class EnrichmentTest; diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 9c3192289f..d0ced299cc 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -251,6 +251,7 @@ class FuelFab : public cyclus::Facility { // map std::map*, std::string> req_inventories_; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" }; diff --git a/src/growth_region.h b/src/growth_region.h index dac9e6cfed..a4bcada05e 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -129,7 +129,10 @@ class GrowthRegion : public cyclus::Region { void OrderBuilds(cyclus::toolkit::Commodity& commodity, double unmetdemand); private: + + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" + }; } // namespace cycamore diff --git a/src/manager_inst.h b/src/manager_inst.h index e842eed034..1742d758e2 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -60,6 +60,7 @@ class ManagerInst } std::vector prototypes; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" }; diff --git a/src/mixer.h b/src/mixer.h index c53ddca33a..0e2d23043c 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -112,6 +112,8 @@ class Mixer : public cyclus::Facility { cyclus::toolkit::MatlSellPolicy sell_policy; private: + + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" }; diff --git a/src/reactor.h b/src/reactor.h index 5b901da5ce..776bd638da 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -434,7 +434,8 @@ class Reactor // populated lazily and no need to persist. std::set uniq_outcommods_; -#include "toolkit/position.cycpp" + // Adds required header to add geographic coordinates to the archetype + #include "toolkit/position.cycpp" }; diff --git a/src/separations.h b/src/separations.h index 84d6df31d7..ad295a8fda 100644 --- a/src/separations.h +++ b/src/separations.h @@ -204,6 +204,7 @@ class Separations : public cyclus::Facility { // state var. std::map > streambufs; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" diff --git a/src/sink.h b/src/sink.h index 5a194861ea..a6e7846687 100644 --- a/src/sink.h +++ b/src/sink.h @@ -152,6 +152,7 @@ class Sink : public cyclus::Facility { #pragma cyclus var {'capacity': 'max_inv_size'} cyclus::toolkit::ResBuf inventory; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" }; diff --git a/src/source.h b/src/source.h index cc8dc4dc06..7e32daff29 100644 --- a/src/source.h +++ b/src/source.h @@ -118,6 +118,7 @@ class Source } double throughput; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" }; diff --git a/src/storage.h b/src/storage.h index 27ea2c6202..ffacbe7fec 100644 --- a/src/storage.h +++ b/src/storage.h @@ -213,6 +213,7 @@ class Storage //// A policy for sending material cyclus::toolkit::MatlSellPolicy sell_policy; + // Adds required header to add geographic coordinates to the archetype #include "toolkit/position.cycpp" friend class StorageTest; From 46627abc8be5db61ab8a5f2d1b494afde506d18e Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 5 Jun 2019 10:47:03 -0500 Subject: [PATCH 10/11] adatp to the name change of position.cycpp --- src/deploy_inst.h | 2 +- src/enrichment.h | 2 +- src/fuel_fab.h | 2 +- src/growth_region.h | 2 +- src/manager_inst.h | 2 +- src/mixer.h | 2 +- src/reactor.h | 2 +- src/separations.h | 2 +- src/sink.h | 2 +- src/source.h | 2 +- src/storage.h | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/deploy_inst.h b/src/deploy_inst.h index 4e6e130b72..13bf02dd19 100644 --- a/src/deploy_inst.h +++ b/src/deploy_inst.h @@ -85,7 +85,7 @@ class DeployInst : public cyclus::Institution { private: // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/enrichment.h b/src/enrichment.h index c42afd93cd..e824c2c708 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -380,7 +380,7 @@ class Enrichment : public cyclus::Facility { double intra_timestep_feed_; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" friend class EnrichmentTest; diff --git a/src/fuel_fab.h b/src/fuel_fab.h index d0ced299cc..244b1e87a5 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -252,7 +252,7 @@ class FuelFab : public cyclus::Facility { std::map*, std::string> req_inventories_; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/growth_region.h b/src/growth_region.h index a4bcada05e..6d4522145f 100644 --- a/src/growth_region.h +++ b/src/growth_region.h @@ -131,7 +131,7 @@ class GrowthRegion : public cyclus::Region { private: // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; } // namespace cycamore diff --git a/src/manager_inst.h b/src/manager_inst.h index 1742d758e2..632c747dd4 100644 --- a/src/manager_inst.h +++ b/src/manager_inst.h @@ -61,7 +61,7 @@ class ManagerInst std::vector prototypes; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/mixer.h b/src/mixer.h index 0e2d23043c..7b949edf53 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -114,7 +114,7 @@ class Mixer : public cyclus::Facility { private: // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/reactor.h b/src/reactor.h index 776bd638da..24bccb6267 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -435,7 +435,7 @@ class Reactor std::set uniq_outcommods_; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/separations.h b/src/separations.h index ad295a8fda..bf70ce95e8 100644 --- a/src/separations.h +++ b/src/separations.h @@ -205,7 +205,7 @@ class Separations : public cyclus::Facility { std::map > streambufs; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" void Record(std::string name, double val, std::string type); diff --git a/src/sink.h b/src/sink.h index a6e7846687..1e237e1c73 100644 --- a/src/sink.h +++ b/src/sink.h @@ -153,7 +153,7 @@ class Sink : public cyclus::Facility { cyclus::toolkit::ResBuf inventory; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/source.h b/src/source.h index 7e32daff29..3b96daf7b9 100644 --- a/src/source.h +++ b/src/source.h @@ -119,7 +119,7 @@ class Source double throughput; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" }; diff --git a/src/storage.h b/src/storage.h index ffacbe7fec..41b2b1f4a2 100644 --- a/src/storage.h +++ b/src/storage.h @@ -214,7 +214,7 @@ class Storage cyclus::toolkit::MatlSellPolicy sell_policy; // Adds required header to add geographic coordinates to the archetype - #include "toolkit/position.cycpp" + #include "toolkit/position.cycpp.h" friend class StorageTest; }; From 4c40aa2ac52d2a65f8922d61a025f856228bd4b9 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Wed, 12 Jun 2019 16:11:47 -0500 Subject: [PATCH 11/11] uniformisation of the Position test name, add missing PositionTest --- src/deploy_inst_tests.cc | 4 +-- src/enrichment_tests.cc | 4 +-- src/fuel_fab_tests.cc | 4 +-- src/growth_region_tests.cc | 54 +++++++++++++++++++++++++++++++++ src/manager_inst_tests.cc | 30 ++++++++++++++++++ src/mixer_tests.cc | 62 +++++++++++++++++++++++++++++++++++++- src/reactor_tests.cc | 4 +-- src/sink_tests.cc | 4 +-- src/source_tests.cc | 7 ++--- src/storage_tests.cc | 6 ++-- 10 files changed, 161 insertions(+), 18 deletions(-) diff --git a/src/deploy_inst_tests.cc b/src/deploy_inst_tests.cc index 2c177aa318..9c984e7c38 100644 --- a/src/deploy_inst_tests.cc +++ b/src/deploy_inst_tests.cc @@ -141,7 +141,7 @@ TEST(DeployInstTests, NoDupProtos) { EXPECT_EQ(1, stmt->GetInt(0)); } -TEST(DeployInstTests, PositionInitialize) { +TEST(DeployInstTests, PositionDefault) { std::string config = " foobar " " 1 " @@ -158,7 +158,7 @@ TEST(DeployInstTests, PositionInitialize) { EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } -TEST(DeployInstTests, PositionInitialize2) { +TEST(DeployInstTests, PositionInitialize) { std::string config = " foobar " " -20.0 " diff --git a/src/enrichment_tests.cc b/src/enrichment_tests.cc index 1522b8c862..95eb0df37f 100644 --- a/src/enrichment_tests.cc +++ b/src/enrichment_tests.cc @@ -725,7 +725,7 @@ TEST_F(EnrichmentTest, Response) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TEST_F(EnrichmentTest, PositionInitialize) { +TEST_F(EnrichmentTest, PositionDefault) { // this tests verifies the initialization of the latitude variable std::string config = @@ -752,7 +752,7 @@ TEST_F(EnrichmentTest, PositionInitialize) { EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } -TEST_F(EnrichmentTest, PositionInitialize2) { +TEST_F(EnrichmentTest, PositionInitialize) { // this tests verifies the initialization of the longitude // variable diff --git a/src/fuel_fab_tests.cc b/src/fuel_fab_tests.cc index 68a029643d..6315e1019e 100644 --- a/src/fuel_fab_tests.cc +++ b/src/fuel_fab_tests.cc @@ -891,7 +891,7 @@ TEST(FuelFabTests, HomogenousBuffers) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TEST(FuelFabTests, PositionInitialize) { +TEST(FuelFabTests, PositionDefault) { cyclus::Env::SetNucDataPath(); std::string config = " natu " @@ -937,7 +937,7 @@ TEST(FuelFabTests, PositionInitialize) { EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } -TEST(FuelFabTests, PositionInitialize2) { +TEST(FuelFabTests, PositionInitialize) { cyclus::Env::SetNucDataPath(); std::string config = " natu " diff --git a/src/growth_region_tests.cc b/src/growth_region_tests.cc index 9226585d69..1b7f9d2f1c 100644 --- a/src/growth_region_tests.cc +++ b/src/growth_region_tests.cc @@ -34,6 +34,60 @@ TEST_F(GrowthRegionTests, init) { EXPECT_TRUE(ManagesCommodity(commodity)); } +TEST_F(GrowthRegionTests, PositionDefault) { + std::string config = + " foobar " + "" + "test_commod" + "" + "" + "0" + "" + "linear" + "1 2" + "" + "" + "" + ""; + + int simdur = 5; + cyclus::MockSim sim(cyclus::AgentSpec(":cycamore:GrowthRegion"), config, simdur); + sim.DummyProto("foobar"); + int id = sim.Run(); + + cyclus::QueryResult qr = sim.db().Query("AgentPosition", NULL); + EXPECT_EQ(qr.GetVal("Latitude"), 0.0); + EXPECT_EQ(qr.GetVal("Longitude"), 0.0); +} + +TEST_F(GrowthRegionTests, PositionInitialize) { + std::string config = + " foobar " + " -20.0 " + " 2.0 " + "" + "test_commod" + "" + "" + "0" + "" + "linear" + "1 2" + "" + "" + "" + ""; + + int simdur = 5; + cyclus::MockSim sim(cyclus::AgentSpec(":cycamore:GrowthRegion"), config, simdur); + sim.DummyProto("foobar"); + int id = sim.Run(); + + cyclus::QueryResult qr = sim.db().Query("AgentPosition", NULL); + EXPECT_EQ(qr.GetVal("Latitude"), 2.0); + EXPECT_EQ(qr.GetVal("Longitude"), -20.0); +} + } // namespace cycamore // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/manager_inst_tests.cc b/src/manager_inst_tests.cc index e9f931095d..c7e8746d5c 100644 --- a/src/manager_inst_tests.cc +++ b/src/manager_inst_tests.cc @@ -53,6 +53,36 @@ TEST_F(ManagerInstTests, productioncapacity) { EXPECT_EQ(src_inst->TotalCapacity(commodity), 0); } +TEST_F(ManagerInstTests, PositionDefault) { + std::string config = + " foobar "; + + int simdur = 5; + cyclus::MockSim sim(cyclus::AgentSpec(":cycamore:ManagerInst"), config, simdur); + sim.DummyProto("foobar"); + int id = sim.Run(); + + cyclus::QueryResult qr = sim.db().Query("AgentPosition", NULL); + EXPECT_EQ(qr.GetVal("Latitude"), 0.0); + EXPECT_EQ(qr.GetVal("Longitude"), 0.0); +} + +TEST_F(ManagerInstTests, PositionInitialize) { + std::string config = + " foobar " + " -20.0 " + " 2.0 "; + + int simdur = 5; + cyclus::MockSim sim(cyclus::AgentSpec(":cycamore:ManagerInst"), config, simdur); + sim.DummyProto("foobar"); + int id = sim.Run(); + + cyclus::QueryResult qr = sim.db().Query("AgentPosition", NULL); + EXPECT_EQ(qr.GetVal("Latitude"), 2.0); + EXPECT_EQ(qr.GetVal("Longitude"), -20.0); +} + // required to get functionality in cyclus agent unit tests library #ifndef CYCLUS_AGENT_TESTS_CONNECTED int ConnectAgentTests(); diff --git a/src/mixer_tests.cc b/src/mixer_tests.cc index 5dc58f37a2..f6a62dc99d 100644 --- a/src/mixer_tests.cc +++ b/src/mixer_tests.cc @@ -461,7 +461,7 @@ TEST(MixerTests, CompleteMixingProcess) { EXPECT_DOUBLE_EQ(1., m->quantity()); } -TEST(MixerTests, PositionInitialize) { +TEST(MixerTests, PositionDefault) { std::string config = "" "" @@ -519,4 +519,64 @@ TEST(MixerTests, PositionInitialize) { EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } +TEST(MixerTests, PositionInitialize) { + std::string config = + "" + "" + "" + "0.8" + "2.5" + "" + "" + "" + "stream1" + "1" + "" + "" + "" + "" + "" + "0.15" + "3" + "" + "" + "" + "stream2" + "1" + "" + "" + "" + "" + "" + "0.05" + "5" + "" + "" + "" + "stream3" + "1" + "" + "" + "" + "" + "mixedstream" + "0" + " -20.0 " + " 2.0 " + "0"; + int simdur = 1; + cyclus::MockSim sim(cyclus::AgentSpec(":cycamore:Mixer"), config, simdur); + sim.AddSource("stream1").recipe("unatstream").capacity(1).Finalize(); + sim.AddSource("stream2").recipe("uoxstream").capacity(1).Finalize(); + sim.AddSource("stream3").recipe("pustream").capacity(1).Finalize(); + sim.AddRecipe("unatstream", c_natu()); + sim.AddRecipe("uoxstream", c_pustream()); + sim.AddRecipe("pustream", c_uox()); + int id = sim.Run(); + + QueryResult qr = sim.db().Query("AgentPosition", NULL); + EXPECT_EQ(qr.GetVal("Latitude"), 2.0); + EXPECT_EQ(qr.GetVal("Longitude"), -20.0); +} + } // namespace cycamore diff --git a/src/reactor_tests.cc b/src/reactor_tests.cc index 89996cb0c7..5f0e5b52e7 100644 --- a/src/reactor_tests.cc +++ b/src/reactor_tests.cc @@ -591,7 +591,7 @@ TEST(ReactorTests, Retire) { << "failed to generate power for the correct number of time steps"; } -TEST(ReactorTests, PositionInitialize) { +TEST(ReactorTests, PositionDefault) { std::string config = " lwr_fresh " " lwr_spent " @@ -617,7 +617,7 @@ TEST(ReactorTests, PositionInitialize) { EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } -TEST(ReactorTests, PositionInitialize2) { +TEST(ReactorTests, PositionInitialize) { std::string config = " lwr_fresh " " lwr_spent " diff --git a/src/sink_tests.cc b/src/sink_tests.cc index 80a81da616..ccabd6d693 100644 --- a/src/sink_tests.cc +++ b/src/sink_tests.cc @@ -269,7 +269,7 @@ TEST_F(SinkTest, Print) { EXPECT_NO_THROW(std::string s = src_facility->str()); } -TEST_F(SinkTest, PositionInitialize) { +TEST_F(SinkTest, PositionDefault) { using cyclus::QueryResult; using cyclus::Cond; @@ -304,7 +304,7 @@ TEST_F(SinkTest, PositionInitialize) { EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } -TEST_F(SinkTest, PositionInitialize2) { +TEST_F(SinkTest, PositionInitialize) { using cyclus::QueryResult; using cyclus::Cond; diff --git a/src/source_tests.cc b/src/source_tests.cc index be3133934f..c6aafcb681 100644 --- a/src/source_tests.cc +++ b/src/source_tests.cc @@ -123,10 +123,9 @@ TEST_F(SourceTest, Response) { delete bid; } -TEST_F(SourceTest, PositionInitialize) { +TEST_F(SourceTest, PositionDefault) { std::string config = - "spent_fuel" - ; + "spent_fuel"; int simdur = 3; cyclus::MockSim sim(cyclus::AgentSpec (":cycamore:Source"), config, simdur); int id = sim.Run(); @@ -137,7 +136,7 @@ TEST_F(SourceTest, PositionInitialize) { } -TEST_F(SourceTest, Longitude) { +TEST_F(SourceTest, PositionInitialize) { std::string config = "spent_fuel" "-0.01" diff --git a/src/storage_tests.cc b/src/storage_tests.cc index a4f5655bbf..868919c07f 100644 --- a/src/storage_tests.cc +++ b/src/storage_tests.cc @@ -455,7 +455,7 @@ TEST_F(StorageTest, MultipleCommods){ EXPECT_EQ(1, n_trans2) << "expected 1 transactions, got " << n_trans; } -TEST_F(StorageTest, PositionInitialize){ +TEST_F(StorageTest, PositionDefault){ // Verify Storage behavior std::string config = @@ -478,7 +478,7 @@ TEST_F(StorageTest, PositionInitialize){ EXPECT_EQ(qr.GetVal("Longitude"), 0.0); } -TEST_F(StorageTest, Longitude){ +TEST_F(StorageTest, PositionInitialize){ // Verify Storage behavior std::string config = @@ -522,4 +522,4 @@ INSTANTIATE_TEST_CASE_P(StorageFac, FacilityTests, ::testing::Values(&StorageConstructor)); INSTANTIATE_TEST_CASE_P(StorageFac, AgentTests, - ::testing::Values(&StorageConstructor)); \ No newline at end of file + ::testing::Values(&StorageConstructor));