forked from cyclus/cyclus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added most basic implementation of facility cost header code injectio…
…n, tested with cycamore Source
- Loading branch information
1 parent
f7a42f1
commit 19578ee
Showing
4 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "facility_cost.h" | ||
|
||
#include <math.h> | ||
#include <stdio.h> | ||
#include <iomanip> | ||
#include <sstream> | ||
|
||
namespace cyclus { | ||
namespace toolkit { | ||
|
||
// Interested in thoughts on the member initializer list | ||
FacilityCost::FacilityCost() : capital_cost_(0) {} | ||
|
||
FacilityCost::FacilityCost(double capital_cost) { | ||
capital_cost_ = capital_cost; | ||
} | ||
|
||
FacilityCost::~FacilityCost() {} | ||
|
||
void FacilityCost::EnumerateCosts(){ | ||
std::cout<<capital_cost_<<std::endl; | ||
} | ||
|
||
} // namespace toolkit | ||
} // namespace cyclus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// This includes the required header to add facility costs to archetypes. | ||
/// One should only need to: | ||
/// - '#include "toolkit/facility_cost.cycpp.h"' in the header of the | ||
/// archetype class (as private) | ||
|
||
cyclus::toolkit::FacilityCost cost; | ||
|
||
#pragma cyclus var { \ | ||
"default": 0.0, \ | ||
"uilabel": "Capital cost required to build facility", \ | ||
"doc": "Capital cost required to build facility" \ | ||
} | ||
double capital_cost; | ||
|
||
// Required for compilation but not added by the cycpp preprocessor. Do not | ||
// remove. | ||
std::vector<int> cycpp_shape_capital_cost = {0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef CYCLUS_SRC_TOOLKIT_FACILITY_COST_H_ | ||
#define CYCLUS_SRC_TOOLKIT_FACILITY_COST_H_ | ||
|
||
|
||
#include <string> | ||
#include "cyclus.h" | ||
|
||
namespace cyclus { | ||
namespace toolkit { | ||
|
||
/// @class FacilityCost | ||
/// The FacilityCost class is a class that handles basic cost data for | ||
/// Facilities within cyclus. The inner workings of this class are TBD, | ||
/// but it will first serve as a very basic showcase of code injection into | ||
/// Facility header files for state variables which can be common to all | ||
/// Facilities. | ||
|
||
class FacilityCost { | ||
public: | ||
|
||
/// The default constructor for FacilityCost. This creates an object | ||
/// with all costs set to 0.0. | ||
FacilityCost(); | ||
|
||
/// FacilityCost constructor with capital_cost as a double | ||
/// @param capital_cost Capital cost of the facility. | ||
FacilityCost(double capital_cost); | ||
|
||
/// The default destructor for FacilityCost | ||
~FacilityCost(); | ||
|
||
void EnumerateCosts(); | ||
|
||
private: | ||
/// Capital cost of the facility | ||
double capital_cost_; | ||
|
||
}; | ||
|
||
} // namespace toolkit | ||
} // namespace cyclus | ||
|
||
#endif // CYCLUS_SRC_TOOLKIT_POSITION_H_ |