Skip to content

Commit

Permalink
Added most basic implementation of facility cost header code injectio…
Browse files Browse the repository at this point in the history
…n, tested with cycamore Source
  • Loading branch information
dean-krueger committed Nov 3, 2024
1 parent f7a42f1 commit 19578ee
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/toolkit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ endif()
SET(CYCLUS_CORE_SRC ${CYCLUS_CORE_SRC} ${cc_files} PARENT_SCOPE)

FILE(GLOB h_files "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
FILE(GLOB cycpp_files "${CMAKE_CURRENT_SOURCE_DIR}/*.cycpp.h")
INSTALL(
FILES ${h_files}
FILES ${h_files} ${cycpp_files}
DESTINATION include/cyclus/toolkit
COMPONENT core
)
25 changes: 25 additions & 0 deletions src/toolkit/facility_cost.cc
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
17 changes: 17 additions & 0 deletions src/toolkit/facility_cost.cycpp.h
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};
43 changes: 43 additions & 0 deletions src/toolkit/facility_cost.h
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_

0 comments on commit 19578ee

Please sign in to comment.