Skip to content

Commit

Permalink
changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed Feb 26, 2024
1 parent 7e9944c commit ac897e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
10 changes: 4 additions & 6 deletions src/material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace cyclus {

const ResourceType Material::kType = "Material";

static int default_package_id_ = 1;

Material::~Material() {}

Material::Ptr Material::Create(Agent* creator, double quantity,
Expand All @@ -23,9 +25,7 @@ Material::Ptr Material::Create(Agent* creator, double quantity,

Material::Ptr Material::CreateUntracked(double quantity,
Composition::Ptr c) {
// default package id for untracked
int package_id = 1;
Material::Ptr m(new Material(NULL, quantity, c, package_id));
Material::Ptr m(new Material(NULL, quantity, c, default_package_id_));
return m;
}

Expand Down Expand Up @@ -90,9 +90,7 @@ Material::Ptr Material::ExtractComp(double qty, Composition::Ptr c,
}

qty_ -= qty;
// extracted material has default package
int package_id = 1;
Material::Ptr other(new Material(ctx_, qty, c, package_id));
Material::Ptr other(new Material(ctx_, qty, c, default_package_id_));

// Decay called on the extracted material should have the same dt as for
// this material regardless of composition.
Expand Down
2 changes: 1 addition & 1 deletion src/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class Material: public Resource {
virtual void ChangePackageId(int new_package_id);

protected:
Material(Context* ctx, double quantity, Composition::Ptr c, int package_id);
Material(Context* ctx, double quantity, Composition::Ptr c, int package_id = 1);

private:
Context* ctx_;
Expand Down
5 changes: 2 additions & 3 deletions src/product.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ResourceType Product::kType = "Product";

std::map<std::string, int> Product::qualids_;
int Product::next_qualid_ = 1;
static int default_package_id_ = 1;

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Product::Ptr Product::Create(Agent* creator, double quantity,
Expand All @@ -31,9 +32,7 @@ Product::Ptr Product::Create(Agent* creator, double quantity,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Product::Ptr Product::CreateUntracked(double quantity,
std::string quality) {
// default package id for untracked
int package_id = 1;
Product::Ptr r(new Product(NULL, quantity, quality, package_id));
Product::Ptr r(new Product(NULL, quantity, quality));
r->tracker_.DontTrack();
return r;
}
Expand Down
2 changes: 1 addition & 1 deletion src/product.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Product : public Resource {
/// @param ctx the simulation context
/// @param quantity is a double indicating the quantity
/// @param quality the resource quality
Product(Context* ctx, double quantity, std::string quality, int package_id);
Product(Context* ctx, double quantity, std::string quality, int package_id = 1);

// map<quality, quality_id>
static std::map<std::string, int> qualids_;
Expand Down
2 changes: 0 additions & 2 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <vector>
#include <boost/shared_ptr.hpp>

#include "package.h"

class SimInitTest;

namespace cyclus {
Expand Down

0 comments on commit ac897e5

Please sign in to comment.