15int Composition::next_id_ = 1;
21 throw ValueError(
"negative quantity in CompMap");
32 throw ValueError(
"negative quantity in CompMap");
44 if (atom_.size() == 0) {
46 for (it = mass_.begin(); it != mass_.end(); ++it) {
55 if (mass_.size() == 0) {
57 for (it = atom_.begin(); it != atom_.end(); ++it) {
66 int tot_decay = prev_decay_ + delta;
77 (*decay_line_)[tot_decay] = decayed;
91 CompMap::const_iterator it;
94 for (it = cm.begin(); it != cm.end(); ++it) {
97 ->
AddVal(
"NucId", it->first)
98 ->
AddVal(
"MassFrac", it->second)
110 : recorded_(false), prev_decay_(prev_decay), decay_line_(decay_line) {
116 std::string comp =
"";
117 for (cyclus::CompMap::const_iterator it = v.begin(); it != v.end(); ++it) {
118 comp += std::to_string(it->first) + std::string(
": ") +
119 std::to_string(it->second) + std::string(
"\n");
125Composition::Ptr Composition::NewDecay(
int delta, uint64_t secs_per_timestep) {
126 int tot_decay = prev_decay_ + delta;
134 if (atom_.size() == 0)
return decayed;
138 CompMap::const_iterator it;
140 for (it = atom_.begin(); it != atom_.end(); ++it) {
149 double t =
static_cast<double>(secs_per_timestep) * delta;
static Ptr CreateFromMass(CompMap v)
Creates a new composition from v with its components having appropriate mass-based ratios.
const CompMap & mass()
Returns the unnormalized mass composition.
const CompMap & atom()
Returns the unnormalized atom composition.
static std::string ToString(CompMap v)
Transforms a composition into a printable string, primarily for debugging and logging.
boost::shared_ptr< Composition > Ptr
static Ptr CreateFromAtom(CompMap v)
Creates a new composition from v with its components having appropriate atom-based ratios.
void Record(Context *ctx)
Records the composition in output database Compositions table (if not done previously).
std::map< int, Composition::Ptr > Chain
a chain containing compositions that are a result of decay from a common ancestor composition.
Ptr Decay(int delta)
Returns a decayed version of this composition (decayed delta timesteps) assuming a time step is 1/12 ...
boost::shared_ptr< Chain > ChainPtr
int id()
Returns a unique id associated with this composition.
A simulation context provides access to necessary simulation-global functions and state.
Datum * NewDatum(std::string title)
See Recorder::NewDatum documentation.
Datum * AddVal(const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
Add an arbitrary field-value pair to the datum.
void Record()
Record this datum to its Recorder.
For values that are too big, too small, etc.
const uint64_t kDefaultTimeStepDur
int pyne_cram_transmute_nucid_to_i(int nucid)
pyne_cram_transmute_info_t pyne_cram_transmute_info
void pyne_cram_expm_multiply14(double *A, double *b, double *x)
bool ValidNucs(const CompMap &v)
Returns true if all nuclide keys in v are valid.
bool AllPositive(const CompMap &v)
Returns true if all nuclides in v have quantities greater than or equal to zero.
void Normalize(CompMap *v, double val)
The sum of quantities of all nuclides of v is normalized to val.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
std::map< Nuc, double > CompMap
a raw definition of nuclides and corresponding (dimensionless quantities).
int CapacityConstraint< T >::next_id_
double atomic_mass(int nuc)
Returns the atomic mass of a nuclide nuc.