15 int Composition::next_id_ = 1;
19 throw ValueError(
"invalid nuclide in CompMap");
22 throw ValueError(
"negative quantity in CompMap");
31 throw ValueError(
"invalid nuclide in CompMap");
34 throw ValueError(
"negative quantity in CompMap");
46 if (atom_.size() == 0) {
48 for (it = mass_.begin(); it != mass_.end(); ++it) {
57 if (mass_.size() == 0) {
59 for (it = atom_.begin(); it != atom_.end(); ++it) {
68 int tot_decay = prev_decay_ + delta;
79 (*decay_line_)[tot_decay] = decayed;
93 CompMap::const_iterator it;
96 for (it = cm.begin(); it != cm.end(); ++it) {
99 ->
AddVal(
"NucId", it->first)
100 ->
AddVal(
"MassFrac", it->second)
113 prev_decay_(prev_decay),
119 Composition::Ptr Composition::NewDecay(
int delta, uint64_t secs_per_timestep) {
120 int tot_decay = prev_decay_ + delta;
128 if (atom_.size() == 0)
133 CompMap::const_iterator it;
135 for (it = atom_.begin(); it != atom_.end(); ++it) {
144 double t =
static_cast<double>(secs_per_timestep) * delta;
boost::shared_ptr< Composition > Ptr
bool AllPositive(const CompMap &v)
Returns true if all nuclides in v have quantities greater than or equal to zero.
For values that are too big, too small, etc.
int id()
Returns a unique id associated with this composition.
bool ValidNucs(const CompMap &v)
Returns true if all nuclide keys in v are valid.
Ptr Decay(int delta)
Returns a decayed version of this composition (decayed delta timesteps) assuming a time step is 1/12 ...
std::map< Nuc, double > CompMap
a raw definition of nuclides and corresponding (dimensionless quantities).
std::map< int, Composition::Ptr > Chain
a chain containing compositions that are a result of decay from a common ancestor composition...
void pyne_cram_expm_multiply14(double *A, double *b, double *x)
pyne_cram_transmute_info_t pyne_cram_transmute_info
const uint64_t kDefaultTimeStepDur
void Record(Context *ctx)
Records the composition in output database Compositions table (if not done previously).
Datum * AddVal(const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
Add an arbitrary field-value pair to the datum.
A simulation context provides access to necessary simulation-global functions and state...
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
const CompMap & mass()
Returns the unnormalized mass composition.
void Record()
Record this datum to its Recorder.
double atomic_mass(int nuc)
Returns the atomic mass of a nuclide nuc.
static Ptr CreateFromAtom(CompMap v)
Creates a new composition from v with its components having appropriate atom-based ratios...
Datum * NewDatum(std::string title)
See Recorder::NewDatum documentation.
void Normalize(CompMap *v, double val)
The sum of quantities of all nuclides of v is normalized to val.
boost::shared_ptr< Chain > ChainPtr
const CompMap & atom()
Returns the unnormalized atom composition.
int pyne_cram_transmute_nucid_to_i(int nucid)
static Ptr CreateFromMass(CompMap v)
Creates a new composition from v with its components having appropriate mass-based ratios...