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  return (const char *) NaNEstr.c_str();
142  };
143 
144  private:
145  std::string nucwas;
146  std::string nucnow;
147  };
148 
151  class IndeterminateNuclideForm : public std::exception
152  {
153  public:
156 
159 
163  IndeterminateNuclideForm(std::string wasptr, std::string nowptr)
164  {
165  nucwas = wasptr;
166  nucnow = nowptr;
167  };
168 
172  IndeterminateNuclideForm(std::string wasptr, int nowptr)
173  {
174  nucwas = wasptr;
175  nucnow = pyne::to_str(nowptr);
176  };
177 
181  IndeterminateNuclideForm(int wasptr, std::string nowptr)
182  {
183  nucwas = pyne::to_str(wasptr);
184  nucnow = nowptr;
185  };
186 
190  IndeterminateNuclideForm(int wasptr, int nowptr)
191  {
192  nucwas = pyne::to_str(wasptr);
193  nucnow = pyne::to_str(nowptr);
194  };
195 
198  virtual const char* what() const throw()
199  {
200  std::string INFEstr ("Indeterminate nuclide form: ");
201  if (!nucwas.empty())
202  INFEstr += nucwas;
203 
204  if (!nucnow.empty())
205  {
206  INFEstr += " --> ";
207  INFEstr += nucnow;
208  }
209  return (const char *) INFEstr.c_str();
210  }
211 
212  private:
213  std::string nucwas;
214  std::string nucnow;
215  };
216 
222  bool isnuclide(std::string nuc);
223  bool isnuclide(const char * nuc);
224  bool isnuclide(int nuc);
226 
232  bool iselement(std::string nuc);
233  bool iselement(const char * nuc);
234  bool iselement(int nuc);
235 
267  int id(int nuc);
268  int id(const char * nuc);
269  int id(std::string nuc);
271 
285  std::string name(int nuc);
286  std::string name(const char * nuc);
287  std::string name(std::string nuc);
289 
296  int znum(int nuc);
297  int znum(const char * nuc);
298  int znum(std::string nuc);
300 
307  int anum(int nuc);
308  int anum(const char * nuc);
309  int anum(std::string nuc);
311 
319  int snum(int nuc);
320  int snum(const char * nuc);
321  int snum(std::string nuc);
323 
333  int zzaaam(int nuc);
334  int zzaaam(const char * nuc);
335  int zzaaam(std::string nuc);
337 
344  int zzaaam_to_id(int nuc);
345  int zzaaam_to_id(const char * nuc);
346  int zzaaam_to_id(std::string nuc);
348 
349 
358  int zzzaaa(int nuc);
359  int zzzaaa(const char * nuc);
360  int zzzaaa(std::string nuc);
362 
363 
370  int zzzaaa_to_id(int nuc);
371  int zzzaaa_to_id(const char * nuc);
372  int zzzaaa_to_id(std::string nuc);
374 
375 
384  std::string zzllaaam(int nuc);
385  std::string zzllaaam(const char * nuc);
386  std::string zzllaaam(std::string nuc);
388 
389 
396  //int zzllaaam_to_id(int nuc);
397  int zzllaaam_to_id(const char * nuc);
398  int zzllaaam_to_id(std::string nuc);
400 
401 
411  int mcnp(int nuc);
412  int mcnp(const char * nuc);
413  int mcnp(std::string nuc);
415 
422  int mcnp_to_id(int nuc);
423  int mcnp_to_id(const char * nuc);
424  int mcnp_to_id(std::string nuc);
426 
436  std::string fluka(int nuc);
438 
445  int fluka_to_id(std::string name);
446  int fluka_to_id(char * name);
448 
458  std::string serpent(int nuc);
459  std::string serpent(const char * nuc);
460  std::string serpent(std::string nuc);
462 
469  //int serpent_to_id(int nuc); Should be ZAID
470  int serpent_to_id(const char * nuc);
471  int serpent_to_id(std::string nuc);
473 
482  std::string nist(int nuc);
483  std::string nist(const char * nuc);
484  std::string nist(std::string nuc);
486 
493  //int serpent_to_id(int nuc); NON-EXISTANT
494  int nist_to_id(const char * nuc);
495  int nist_to_id(std::string nuc);
497 
506  int cinder(int nuc);
507  int cinder(const char * nuc);
508  int cinder(std::string nuc);
510 
517  int cinder_to_id(int nuc);
518  int cinder_to_id(const char * nuc);
519  int cinder_to_id(std::string nuc);
521 
529  std::string alara(int nuc);
530  std::string alara(const char * nuc);
531  std::string alara(std::string nuc);
533 
540  //int alara_to_id(int nuc); NOT POSSIBLE
541  int alara_to_id(const char * nuc);
542  int alara_to_id(std::string nuc);
544 
555  int sza(int nuc);
556  int sza(const char * nuc);
557  int sza(std::string nuc);
559 
566  int sza_to_id(int nuc);
567  int sza_to_id(const char * nuc);
568  int sza_to_id(std::string nuc);
570 
578  inline int groundstate(int nuc) {return (id(nuc) / 10000 ) * 10000;}
579  inline int groundstate(std::string nuc) {return groundstate(id(nuc));}
580  inline int groundstate(const char * nuc) {return groundstate(std::string(nuc));}
582 
587  void _load_state_map();
588  int state_id_to_id(int state);
589  int id_to_state_id(int nuc_id);
590  extern std::map<int, int> state_id_map;
592 
598  int ensdf_to_id(const char * nuc);
599  int ensdf_to_id(std::string nuc);
601 
602 }
603 }
604 
605 #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:320
name_group LAN
lanthanide name group
zz_group lan
lanthanide Z number group
Definition: nucname.cpp:333
name_t MA_array[10]
array of minor actinide names
Definition: nucname.cpp:352
IndeterminateNuclideForm(std::string wasptr, int nowptr)
Definition: nucname.h:172
name_group MA
minor actinide name group
IndeterminateNuclideForm()
default constructor
Definition: nucname.h:155
Definition: nucname.h:83
name_t FP_array[88]
array of fission product names
Definition: nucname.cpp:360
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:329
NotANuclide(std::string wasptr, int nowptr)
Definition: nucname.h:104
zzname_t zz_fluka
nucid to fluka-name map
Definition: nucname.cpp:312
IndeterminateNuclideForm(int wasptr, int nowptr)
Definition: nucname.h:190
zzname_t get_zz_fluka()
Creates standard nucid to fluka-name mapping.
Definition: nucname.cpp:303
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:340
std::string name_t
name type
Definition: nucname.h:22
virtual const char * what() const
Definition: nucname.h:198
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:343
name_zz_t fluka_zz
fluka-name to nucid map
Definition: nucname.cpp:299
zz_group fp
fission product Z number group
Definition: nucname.cpp:370
zz_group::iterator zz_group_iter
Z number grouping iter.
Definition: nucname.h:49
IndeterminateNuclideForm(int wasptr, std::string nowptr)
Definition: nucname.h:181
name_group TRU
transuranic name group
zz_group ma
minor actinide Z number group
Definition: nucname.cpp:356
name_zz_t name_zz
name to Z num map
Definition: nucname.cpp:133
~NotANuclide()
default destructor
Definition: nucname.h:90
name_zz_t get_fluka_zz()
Creates standard fluka-name to nucid mapping.
Definition: nucname.cpp:151
zzname_t get_zz_name()
Creates standard Z number to name mapping.
Definition: nucname.cpp:137
NotANuclide(int wasptr, std::string nowptr)
Definition: nucname.h:113
IndeterminateNuclideForm(std::string wasptr, std::string nowptr)
Definition: nucname.h:163
name_group::iterator name_group_iter
name grouping iter type
Definition: nucname.h:45
virtual const char * what() const
Definition: nucname.h:130
zz_group tru
transuranic Z number group
Definition: nucname.cpp:348
name_t ACT_array[15]
array of actinide names
Definition: nucname.cpp:337
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:7
name_zz_t get_name_zz()
Creates standard name to Z number mapping.
Definition: nucname.cpp:13
~IndeterminateNuclideForm()
default destuctor
Definition: nucname.h:158
zzname_t zz_name
Z num to name map.
Definition: nucname.cpp:146
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