Skip to content

Commit

Permalink
change recording for 1:1 extracted resources
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed Sep 9, 2024
1 parent 8741dcb commit bf16c65
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Since last release
* Rely on ``python3`` in environment instead of ``python`` (#1747)
* Remove ``pandas`` as build dependency (#1748)
* Consistently use hyphens in ``install.py`` flags (#1748)
* Material sell policy can package materials (#1749, #1774, #1775)
* Material sell policy can package materials (#1749, #1774, #1775, #1795)
* Use miniforge for conda CI builds instead of miniconda (#1763)
* Define constants ``CY_LARGE_DOUBLE``, ``CY_LARGE_INT``, and ``CY_NEAR_ZERO`` (#1757)
* Warning and limits on number of packages that can be created from a resource at once (#1771)
Expand Down
5 changes: 1 addition & 4 deletions src/material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ Material::Ptr Material::ExtractComp(double qty, Composition::Ptr c,
// this material regardless of composition.
other->prev_decay_time_ = prev_decay_time_;

if (qty_ > cyclus::eps()) {
tracker_.Extract(&other->tracker_);
} // else, this material is being fully extracted and nothing has effectively
// changed. Don't need to bump state, parent, etc.
tracker_.Extract(&other->tracker_);

return other;
}
Expand Down
17 changes: 11 additions & 6 deletions src/res_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ void ResTracker::Extract(ResTracker* removed) {
parent2_ = 0;

Record();

removed->parent1_ = res_->state_id();
removed->parent2_ = 0;
removed->tracked_ = tracked_;
} else {
removed->parent1_ = parent1_;
removed->parent2_ = parent2_;
removed->tracked_ = tracked_;
}

removed->parent1_ = res_->state_id();
removed->parent2_ = 0;
removed->tracked_ = tracked_;

removed->Record();
}
Expand All @@ -78,7 +82,8 @@ void ResTracker::Package() {
Record();
}

void ResTracker::Record() {
void ResTracker::Record(bool no_bump) {
if (!no_bump) {
res_->BumpStateId();
ctx_->NewDatum("Resources")
->AddVal("ResourceId", res_->state_id())
Expand All @@ -92,7 +97,7 @@ void ResTracker::Record() {
->AddVal("Parent1", parent1_)
->AddVal("Parent2", parent2_)
->Record();

}
res_->Record(ctx_);
}

Expand Down
2 changes: 1 addition & 1 deletion src/res_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ResTracker {
void Package();

private:
void Record();
void Record(bool no_bump = false);

int parent1_;
int parent2_;
Expand Down

0 comments on commit bf16c65

Please sign in to comment.