PyNE C++
nucname.h
1 
3 #ifndef PYNE_D35WIXV5DZAA5LLOWBY2BL2DPA
4 #define PYNE_D35WIXV5DZAA5LLOWBY2BL2DPA
5 #include <iostream>
6 #include <string>
7 #include <map>
8 #include <set>
9 #include <exception>
10 #include <stdlib.h>
11 #include <stdio.h>
12 
13 #ifndef PYNE_IS_AMALGAMATED
14 #include "utils.h"
15 #endif
16 
17 namespace pyne
18 {
20 namespace nucname
21 {
22  typedef std::string name_t;
23  typedef int zz_t;
24 
25  typedef std::map<name_t, zz_t> name_zz_t;
26  typedef name_zz_t::iterator name_zz_iter;
27  name_zz_t get_name_zz();
28  extern name_zz_t name_zz;
29 
30  typedef std::map<zz_t, name_t> zzname_t;
31  typedef zzname_t::iterator zzname_iter;
32  zzname_t get_zz_name();
33  extern zzname_t zz_name;
34 
35  name_zz_t get_fluka_zz();
36  extern name_zz_t fluka_zz;
37  zzname_t get_zz_fluka();
38  extern zzname_t zz_fluka;
39  /******************************************/
40  /*** Define useful elemental group sets ***/
41  /******************************************/
42 
44  typedef std::set<name_t> name_group;
45  typedef name_group::iterator name_group_iter;
46 
48  typedef std::set<zz_t> zz_group;
49  typedef zz_group::iterator zz_group_iter;
50 
54  zz_group name_to_zz_group (name_group eg);
55 
56  extern name_t LAN_array[15];
57  extern name_group LAN;
58  extern zz_group lan;
59 
60  extern name_t ACT_array[15];
61  extern name_group ACT;
62  extern zz_group act;
63 
64  extern name_t TRU_array[22];
65  extern name_group TRU;
66  extern zz_group tru;
67 
68  extern name_t MA_array[10];
69  extern name_group MA;
70  extern zz_group ma;
71 
72  extern name_t FP_array[88];
73  extern name_group FP;
74  extern zz_group fp;
75 
76 
77  /******************/
78  /*** Exceptions ***/
79  /******************/
80 
83  class NotANuclide : public std::exception
84  {
85  public:
87  NotANuclide () {};
88 
90  ~NotANuclide () throw () {};
91 
95  NotANuclide(std::string wasptr, std::string nowptr)
96  {
97  nucwas = wasptr;
98  nucnow = nowptr;
99  };
100 
104  NotANuclide(std::string wasptr, int nowptr)
105  {
106  nucwas = wasptr;
107  nucnow = pyne::to_str(nowptr);
108  };
109 
113  NotANuclide(int wasptr, std::string nowptr)
114  {
115  nucwas = pyne::to_str(wasptr);
116  nucnow = nowptr;
117  };
118 
122  NotANuclide(int wasptr, int nowptr)
123  {
124  nucwas = pyne::to_str(wasptr);
125  nucnow = pyne::to_str(nowptr);
126  };
127 
130  virtual const char* what() const throw()
131  {
132  std::string NaNEstr ("Not a Nuclide! ");
133  if (!nucwas.empty())
134  NaNEstr += nucwas;
135 
136  if (!nucnow.empty())
137  {
138  NaNEstr += " --> ";
139  NaNEstr += nucnow;
140  }
141  const char* NaNEstr_rtn = NaNEstr.c_str();
142  return NaNEstr_rtn;
143  };
144 
145  private:
146  std::string nucwas;
147  std::string nucnow;
148  };
149 
152  class IndeterminateNuclideForm : public std::exception
153  {
154  public:
157 
160 
164  IndeterminateNuclideForm(std::string wasptr, std::string nowptr)
165  {
166  nucwas = wasptr;
167  nucnow = nowptr;
168  };
169 
173  IndeterminateNuclideForm(std::string wasptr, int nowptr)
174  {
175  nucwas = wasptr;
176  nucnow = pyne::to_str(nowptr);
177  };
178 
182  IndeterminateNuclideForm(int wasptr, std::string nowptr)
183  {
184  nucwas = pyne::to_str(wasptr);
185  nucnow = nowptr;
186  };
187 
191  IndeterminateNuclideForm(int wasptr, int nowptr)
192  {
193  nucwas = pyne::to_str(wasptr);
194  nucnow = pyne::to_str(nowptr);
195  };
196 
199  virtual const char* what() const throw()
200  {
201  std::string INFEstr ("Indeterminate nuclide form: ");
202  if (!nucwas.empty())
203  INFEstr += nucwas;
204 
205  if (!nucnow.empty())
206  {
207  INFEstr += " --> ";
208  INFEstr += nucnow;
209  }
210  const char* INFEstr_rtn = INFEstr.c_str();
211  return INFEstr_rtn;
212  }
213 
214  private:
215  std::string nucwas;
216  std::string nucnow;
217  };
218 
224  bool isnuclide(std::string nuc);
225  bool isnuclide(const char * nuc);
226  bool isnuclide(int nuc);
228 
234  bool iselement(std::string nuc);
235  bool iselement(const char * nuc);
236  bool iselement(int nuc);
237 
269  int id(int nuc);
270  int id(const char * nuc);
271  int id(std::string nuc);
273 
287  std::string name(int nuc);
288  std::string name(const char * nuc);
289  std::string name(std::string nuc);
291 
298  int znum(int nuc);
299  int znum(const char * nuc);
300  int znum(std::string nuc);
302 
309  int anum(int nuc);
310  int anum(const char * nuc);
311  int anum(std::string nuc);
313 
321  int snum(int nuc);
322  int snum(const char * nuc);
323  int snum(std::string nuc);
325 
335  int zzaaam(int nuc);
336  int zzaaam(const char * nuc);
337  int zzaaam(std::string nuc);
339 
346  int zzaaam_to_id(int nuc);
347  int zzaaam_to_id(const char * nuc);
348  int zzaaam_to_id(std::string nuc);
350 
351 
360  int zzzaaa(int nuc);
361  int zzzaaa(const char * nuc);
362  int zzzaaa(std::string nuc);
364 
365 
372  int zzzaaa_to_id(int nuc);
373  int zzzaaa_to_id(const char * nuc);
374  int zzzaaa_to_id(std::string nuc);
376 
377 
386  std::string zzllaaam(int nuc);
387  std::string zzllaaam(const char * nuc);
388  std::string zzllaaam(std::string nuc);
390 
391 
398  //int zzllaaam_to_id(int nuc);
399  int zzllaaam_to_id(const char * nuc);
400  int zzllaaam_to_id(std::string nuc);
402 
403 
413  int mcnp(int nuc);
414  int mcnp(const char * nuc);
415  int mcnp(std::string nuc);
417 
424  int mcnp_to_id(int nuc);
425  int mcnp_to_id(const char * nuc);
426  int mcnp_to_id(std::string nuc);
428 
437  std::string openmc(int nuc);
438  std::string openmc(const char * nuc);
439  std::string openmc(std::string nuc);
441 
448  int openmc_to_id(const char * nuc);
449  int openmc_to_id(std::string nuc);
451 
461  std::string fluka(int nuc);
463 
470  int fluka_to_id(std::string name);
471  int fluka_to_id(char * name);
473 
483  std::string serpent(int nuc);
484  std::string serpent(const char * nuc);
485  std::string serpent(std::string nuc);
487 
494  //int serpent_to_id(int nuc); Should be ZAID
495  int serpent_to_id(const char * nuc);
496  int serpent_to_id(std::string nuc);
498 
507  std::string nist(int nuc);
508  std::string nist(const char * nuc);
509  std::string nist(std::string nuc);
511 
518  //int serpent_to_id(int nuc); NON-EXISTANT
519  int nist_to_id(const char * nuc);
520  int nist_to_id(std::string nuc);
522 
531  int cinder(int nuc);
532  int cinder(const char * nuc);
533  int cinder(std::string nuc);
535 
542  int cinder_to_id(int nuc);
543  int cinder_to_id(const char * nuc);
544  int cinder_to_id(std::string nuc);
546 
554  std::string alara(int nuc);
555  std::string alara(const char * nuc);
556  std::string alara(std::string nuc);
558 
565  //int alara_to_id(int nuc); NOT POSSIBLE
566  int alara_to_id(const char * nuc);
567  int alara_to_id(std::string nuc);
569 
580  int sza(int nuc);
581  int sza(const char * nuc);
582  int sza(std::string nuc);
584 
591  int sza_to_id(int nuc);
592  int sza_to_id(const char * nuc);
593  int sza_to_id(std::string nuc);
595 
603  inline int groundstate(int nuc) {return (id(nuc) / 10000 ) * 10000;}
604  inline int groundstate(std::string nuc) {return groundstate(id(nuc));}
605  inline int groundstate(const char * nuc) {return groundstate(std::string(nuc));}
607 
613  void _load_state_map();
614  int state_id_to_id(int state);
615  int id_to_state_id(int nuc_id);
616  extern std::map<int, int> state_id_map;
618 
624  int ensdf_to_id(const char * nuc);
625  int ensdf_to_id(std::string nuc);
627 
628 }
629 }
630 
631 #endif // PYNE_D35WIXV5DZAA5LLOWBY2BL2DPA
name_zz_t::iterator name_zz_iter
name and Z num iter type
Definition: nucname.h:26
zz_group name_to_zz_group(name_group eg)
Definition: nucname.cpp:324
name_group LAN
lanthanide name group
zz_group lan
lanthanide Z number group
Definition: nucname.cpp:337
name_t MA_array[10]
array of minor actinide names
Definition: nucname.cpp:356
virtual const char * what() const
Definition: nucname.h:130
IndeterminateNuclideForm(std::string wasptr, int nowptr)
Definition: nucname.h:173
name_group MA
minor actinide name group
IndeterminateNuclideForm()
default constructor
Definition: nucname.h:156
virtual const char * what() const
Definition: nucname.h:199
Definition: nucname.h:83
name_t FP_array[88]
array of fission product names
Definition: nucname.cpp:364
zzname_t::iterator zzname_iter
Z num to name iter type.
Definition: nucname.h:31
name_t LAN_array[15]
array of lanthanide names
Definition: nucname.cpp:333
NotANuclide(std::string wasptr, int nowptr)
Definition: nucname.h:104
zzname_t zz_fluka
nucid to fluka-name map
Definition: nucname.cpp:316
IndeterminateNuclideForm(int wasptr, int nowptr)
Definition: nucname.h:191
zzname_t get_zz_fluka()
Creates standard nucid to fluka-name mapping.
Definition: nucname.cpp:307
std::map< name_t, zz_t > name_zz_t
name and Z num map type
Definition: nucname.h:25
NotANuclide(int wasptr, int nowptr)
Definition: nucname.h:122
NotANuclide(std::string wasptr, std::string nowptr)
Definition: nucname.h:95
std::map< zz_t, name_t > zzname_t
Z num to name map type.
Definition: nucname.h:30
zz_group act
actinide Z number group
Definition: nucname.cpp:344
std::string name_t
name type
Definition: nucname.h:22
name_group ACT
actinide name group
name_group FP
fission product name group
name_t TRU_array[22]
array of transuranic names
Definition: nucname.cpp:347
name_zz_t fluka_zz
fluka-name to nucid map
Definition: nucname.cpp:303
zz_group fp
fission product Z number group
Definition: nucname.cpp:374
zz_group::iterator zz_group_iter
Z number grouping iter.
Definition: nucname.h:49
IndeterminateNuclideForm(int wasptr, std::string nowptr)
Definition: nucname.h:182
name_group TRU
transuranic name group
zz_group ma
minor actinide Z number group
Definition: nucname.cpp:360
name_zz_t name_zz
name to Z num map
Definition: nucname.cpp:137
~NotANuclide()
default destructor
Definition: nucname.h:90
name_zz_t get_fluka_zz()
Creates standard fluka-name to nucid mapping.
Definition: nucname.cpp:155
zzname_t get_zz_name()
Creates standard Z number to name mapping.
Definition: nucname.cpp:141
NotANuclide(int wasptr, std::string nowptr)
Definition: nucname.h:113
IndeterminateNuclideForm(std::string wasptr, std::string nowptr)
Definition: nucname.h:164
name_group::iterator name_group_iter
name grouping iter type
Definition: nucname.h:45
zz_group tru
transuranic Z number group
Definition: nucname.cpp:352
name_t ACT_array[15]
array of actinide names
Definition: nucname.cpp:341
std::set< zz_t > zz_group
Z number grouping type (for testing containment)
Definition: nucname.h:48
A container representing enrichment cascades.
Definition: _atomic_data.h:16
name_zz_t get_name_zz()
Creates standard name to Z number mapping.
Definition: nucname.cpp:13
~IndeterminateNuclideForm()
default destuctor
Definition: nucname.h:159
zzname_t zz_name
Z num to name map.
Definition: nucname.cpp:150
int zz_t
Z number type.
Definition: nucname.h:23
NotANuclide()
default constructor
Definition: nucname.h:87
std::set< name_t > name_group
name grouping type (for testing containment)
Definition: nucname.h:44