Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
elementnames.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2023 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef ELEMENTNAMES_H_
5 #define ELEMENTNAMES_H_
6 
9 
13 
18 
22 
26 
30 
33 
34  /* here lies the first C++ code, written by PvH, 2006 Nov 20, after
35  * the conversion from C to C++. It is a constructor. */
37  strncpy( chElementName[0], "Hydrogen ", CHARS_ELEMENT_NAME );
38  strncpy( chElementName[1], "Helium ", CHARS_ELEMENT_NAME );
39  strncpy( chElementName[2], "Lithium ", CHARS_ELEMENT_NAME );
40  strncpy( chElementName[3], "Beryllium ", CHARS_ELEMENT_NAME );
41  strncpy( chElementName[4], "Boron ", CHARS_ELEMENT_NAME );
42  strncpy( chElementName[5], "Carbon ", CHARS_ELEMENT_NAME );
43  strncpy( chElementName[6], "Nitrogen ", CHARS_ELEMENT_NAME );
44  strncpy( chElementName[7], "Oxygen ", CHARS_ELEMENT_NAME );
45  strncpy( chElementName[8], "Fluorine ", CHARS_ELEMENT_NAME );
46  strncpy( chElementName[9], "Neon ", CHARS_ELEMENT_NAME );
47  strncpy( chElementName[10], "Sodium ", CHARS_ELEMENT_NAME );
48  strncpy( chElementName[11], "Magnesium ", CHARS_ELEMENT_NAME );
49  strncpy( chElementName[12], "Aluminium ", CHARS_ELEMENT_NAME );
50  strncpy( chElementName[13], "Silicon ", CHARS_ELEMENT_NAME );
51  strncpy( chElementName[14], "Phosphorus", CHARS_ELEMENT_NAME );
52  strncpy( chElementName[15], "Sulphur ", CHARS_ELEMENT_NAME );
53  strncpy( chElementName[16], "Chlorine ", CHARS_ELEMENT_NAME );
54  strncpy( chElementName[17], "Argon ", CHARS_ELEMENT_NAME );
55  strncpy( chElementName[18], "Potassium ", CHARS_ELEMENT_NAME );
56  strncpy( chElementName[19], "Calcium ", CHARS_ELEMENT_NAME );
57  strncpy( chElementName[20], "Scandium ", CHARS_ELEMENT_NAME );
58  strncpy( chElementName[21], "Titanium ", CHARS_ELEMENT_NAME );
59  strncpy( chElementName[22], "Vanadium ", CHARS_ELEMENT_NAME );
60  strncpy( chElementName[23], "Chromium ", CHARS_ELEMENT_NAME );
61  strncpy( chElementName[24], "Manganese ", CHARS_ELEMENT_NAME );
62  strncpy( chElementName[25], "Iron ", CHARS_ELEMENT_NAME );
63  strncpy( chElementName[26], "Cobalt ", CHARS_ELEMENT_NAME );
64  strncpy( chElementName[27], "Nickel ", CHARS_ELEMENT_NAME );
65  strncpy( chElementName[28], "Copper ", CHARS_ELEMENT_NAME );
66  strncpy( chElementName[29], "Zinc ", CHARS_ELEMENT_NAME );
67 
68  strncpy( chElementNameShort[0], "HYDR", CHARS_ELEMENT_NAME_SHORT );
69  strncpy( chElementNameShort[1], "HELI", CHARS_ELEMENT_NAME_SHORT );
70  strncpy( chElementNameShort[2], "LITH", CHARS_ELEMENT_NAME_SHORT );
71  strncpy( chElementNameShort[3], "BERY", CHARS_ELEMENT_NAME_SHORT );
72  strncpy( chElementNameShort[4], "BORO", CHARS_ELEMENT_NAME_SHORT );
73  strncpy( chElementNameShort[5], "CARB", CHARS_ELEMENT_NAME_SHORT );
74  strncpy( chElementNameShort[6], "NITR", CHARS_ELEMENT_NAME_SHORT );
75  strncpy( chElementNameShort[7], "OXYG", CHARS_ELEMENT_NAME_SHORT );
76  strncpy( chElementNameShort[8], "FLUO", CHARS_ELEMENT_NAME_SHORT );
77  strncpy( chElementNameShort[9], "NEON", CHARS_ELEMENT_NAME_SHORT );
78  strncpy( chElementNameShort[10], "SODI", CHARS_ELEMENT_NAME_SHORT );
79  strncpy( chElementNameShort[11], "MAGN", CHARS_ELEMENT_NAME_SHORT );
80  strncpy( chElementNameShort[12], "ALUM", CHARS_ELEMENT_NAME_SHORT );
81  strncpy( chElementNameShort[13], "SILI", CHARS_ELEMENT_NAME_SHORT );
82  strncpy( chElementNameShort[14], "PHOS", CHARS_ELEMENT_NAME_SHORT );
83  strncpy( chElementNameShort[15], "SULP", CHARS_ELEMENT_NAME_SHORT );
84  strncpy( chElementNameShort[16], "CHLO", CHARS_ELEMENT_NAME_SHORT );
85  strncpy( chElementNameShort[17], "ARGO", CHARS_ELEMENT_NAME_SHORT );
86  strncpy( chElementNameShort[18], "POTA", CHARS_ELEMENT_NAME_SHORT );
87  strncpy( chElementNameShort[19], "CALC", CHARS_ELEMENT_NAME_SHORT );
88  strncpy( chElementNameShort[20], "SCAN", CHARS_ELEMENT_NAME_SHORT );
89  strncpy( chElementNameShort[21], "TITA", CHARS_ELEMENT_NAME_SHORT );
90  strncpy( chElementNameShort[22], "VANA", CHARS_ELEMENT_NAME_SHORT );
91  strncpy( chElementNameShort[23], "CHRO", CHARS_ELEMENT_NAME_SHORT );
92  strncpy( chElementNameShort[24], "MANG", CHARS_ELEMENT_NAME_SHORT );
93  strncpy( chElementNameShort[25], "IRON", CHARS_ELEMENT_NAME_SHORT );
94  strncpy( chElementNameShort[26], "COBA", CHARS_ELEMENT_NAME_SHORT );
95  strncpy( chElementNameShort[27], "NICK", CHARS_ELEMENT_NAME_SHORT );
96  strncpy( chElementNameShort[28], "COPP", CHARS_ELEMENT_NAME_SHORT );
97  strncpy( chElementNameShort[29], "ZINC", CHARS_ELEMENT_NAME_SHORT );
98 
99  strncpy( chElementSym[0], "H ", CHARS_ELEMENT_SYM );
100  strncpy( chElementSym[1], "He", CHARS_ELEMENT_SYM );
101  strncpy( chElementSym[2], "Li", CHARS_ELEMENT_SYM );
102  strncpy( chElementSym[3], "Be", CHARS_ELEMENT_SYM );
103  strncpy( chElementSym[4], "B ", CHARS_ELEMENT_SYM );
104  strncpy( chElementSym[5], "C ", CHARS_ELEMENT_SYM );
105  strncpy( chElementSym[6], "N ", CHARS_ELEMENT_SYM );
106  strncpy( chElementSym[7], "O ", CHARS_ELEMENT_SYM );
107  strncpy( chElementSym[8], "F ", CHARS_ELEMENT_SYM );
108  strncpy( chElementSym[9], "Ne", CHARS_ELEMENT_SYM );
109  strncpy( chElementSym[10], "Na", CHARS_ELEMENT_SYM );
110  strncpy( chElementSym[11], "Mg", CHARS_ELEMENT_SYM );
111  strncpy( chElementSym[12], "Al", CHARS_ELEMENT_SYM );
112  strncpy( chElementSym[13], "Si", CHARS_ELEMENT_SYM );
113  strncpy( chElementSym[14], "P ", CHARS_ELEMENT_SYM );
114  strncpy( chElementSym[15], "S ", CHARS_ELEMENT_SYM );
115  strncpy( chElementSym[16], "Cl", CHARS_ELEMENT_SYM );
116  strncpy( chElementSym[17], "Ar", CHARS_ELEMENT_SYM );
117  strncpy( chElementSym[18], "K ", CHARS_ELEMENT_SYM );
118  strncpy( chElementSym[19], "Ca", CHARS_ELEMENT_SYM );
119  strncpy( chElementSym[20], "Sc", CHARS_ELEMENT_SYM );
120  strncpy( chElementSym[21], "Ti", CHARS_ELEMENT_SYM );
121  strncpy( chElementSym[22], "V ", CHARS_ELEMENT_SYM );
122  strncpy( chElementSym[23], "Cr", CHARS_ELEMENT_SYM );
123  strncpy( chElementSym[24], "Mn", CHARS_ELEMENT_SYM );
124  strncpy( chElementSym[25], "Fe", CHARS_ELEMENT_SYM );
125  strncpy( chElementSym[26], "Co", CHARS_ELEMENT_SYM );
126  strncpy( chElementSym[27], "Ni", CHARS_ELEMENT_SYM );
127  strncpy( chElementSym[28], "Cu", CHARS_ELEMENT_SYM );
128  strncpy( chElementSym[29], "Zn", CHARS_ELEMENT_SYM );
129 
130  strncpy( chIonStage[0], " 1", CHARS_ION_STAGE );
131  strncpy( chIonStage[1], " 2", CHARS_ION_STAGE );
132  strncpy( chIonStage[2], " 3", CHARS_ION_STAGE );
133  strncpy( chIonStage[3], " 4", CHARS_ION_STAGE );
134  strncpy( chIonStage[4], " 5", CHARS_ION_STAGE );
135  strncpy( chIonStage[5], " 6", CHARS_ION_STAGE );
136  strncpy( chIonStage[6], " 7", CHARS_ION_STAGE );
137  strncpy( chIonStage[7], " 8", CHARS_ION_STAGE );
138  strncpy( chIonStage[8], " 9", CHARS_ION_STAGE );
139  strncpy( chIonStage[9], "10", CHARS_ION_STAGE );
140  strncpy( chIonStage[10], "11", CHARS_ION_STAGE );
141  strncpy( chIonStage[11], "12", CHARS_ION_STAGE );
142  strncpy( chIonStage[12], "13", CHARS_ION_STAGE );
143  strncpy( chIonStage[13], "14", CHARS_ION_STAGE );
144  strncpy( chIonStage[14], "15", CHARS_ION_STAGE );
145  strncpy( chIonStage[15], "16", CHARS_ION_STAGE );
146  strncpy( chIonStage[16], "17", CHARS_ION_STAGE );
147  strncpy( chIonStage[17], "18", CHARS_ION_STAGE );
148  strncpy( chIonStage[18], "19", CHARS_ION_STAGE );
149  strncpy( chIonStage[19], "20", CHARS_ION_STAGE );
150  strncpy( chIonStage[20], "21", CHARS_ION_STAGE );
151  strncpy( chIonStage[21], "22", CHARS_ION_STAGE );
152  strncpy( chIonStage[22], "23", CHARS_ION_STAGE );
153  strncpy( chIonStage[23], "24", CHARS_ION_STAGE );
154  strncpy( chIonStage[24], "25", CHARS_ION_STAGE );
155  strncpy( chIonStage[25], "26", CHARS_ION_STAGE );
156  strncpy( chIonStage[26], "27", CHARS_ION_STAGE );
157  strncpy( chIonStage[27], "28", CHARS_ION_STAGE );
158  strncpy( chIonStage[28], "29", CHARS_ION_STAGE );
159  strncpy( chIonStage[29], "30", CHARS_ION_STAGE );
160  strncpy( chIonStage[30], "31", CHARS_ION_STAGE );
161 
162  strncpy( chIonRoman[0], "I", CHARS_ION_ROMAN );
163  strncpy( chIonRoman[1], "II", CHARS_ION_ROMAN );
164  strncpy( chIonRoman[2], "III", CHARS_ION_ROMAN );
165  strncpy( chIonRoman[3], "IV", CHARS_ION_ROMAN );
166  strncpy( chIonRoman[4], "V", CHARS_ION_ROMAN );
167  strncpy( chIonRoman[5], "VI", CHARS_ION_ROMAN );
168  strncpy( chIonRoman[6], "VII", CHARS_ION_ROMAN );
169  strncpy( chIonRoman[7], "VIII", CHARS_ION_ROMAN );
170  strncpy( chIonRoman[8], "IX", CHARS_ION_ROMAN );
171  strncpy( chIonRoman[9], "X", CHARS_ION_ROMAN );
172  strncpy( chIonRoman[10], "XI", CHARS_ION_ROMAN );
173  strncpy( chIonRoman[11], "XII", CHARS_ION_ROMAN );
174  strncpy( chIonRoman[12], "XIII", CHARS_ION_ROMAN );
175  strncpy( chIonRoman[13], "XIV", CHARS_ION_ROMAN );
176  strncpy( chIonRoman[14], "XV", CHARS_ION_ROMAN );
177  strncpy( chIonRoman[15], "XVI", CHARS_ION_ROMAN );
178  strncpy( chIonRoman[16], "XVII", CHARS_ION_ROMAN );
179  strncpy( chIonRoman[17], "XVIII", CHARS_ION_ROMAN );
180  strncpy( chIonRoman[18], "XIX", CHARS_ION_ROMAN );
181  strncpy( chIonRoman[19], "XX", CHARS_ION_ROMAN );
182  strncpy( chIonRoman[20], "XXI", CHARS_ION_ROMAN );
183  strncpy( chIonRoman[21], "XXII", CHARS_ION_ROMAN );
184  strncpy( chIonRoman[22], "XXIII", CHARS_ION_ROMAN );
185  strncpy( chIonRoman[23], "XXIV", CHARS_ION_ROMAN );
186  strncpy( chIonRoman[24], "XXV", CHARS_ION_ROMAN );
187  strncpy( chIonRoman[25], "XXVI", CHARS_ION_ROMAN );
188  strncpy( chIonRoman[26], "XXVII", CHARS_ION_ROMAN );
189  strncpy( chIonRoman[27], "XXVIII", CHARS_ION_ROMAN );
190  strncpy( chIonRoman[28], "XXIX", CHARS_ION_ROMAN );
191  strncpy( chIonRoman[29], "XXX", CHARS_ION_ROMAN );
192  strncpy( chIonRoman[30], "XXXI", CHARS_ION_ROMAN );
193  };
194 
195 };
197 
203 bool isElementSym( const string& chSym );
204 
205 /* elem_symbol_to_index - obtain the array index the input element symbol refers to.
206  * String length must match element symbol string length.
207  * The first letter is expected to be uppercase, and the second lowercase.
208  *
209  * \param chSym input string
210  * \return the element index, or -1 if not found
211  */
212 int elem_symbol_to_index( const string& chSym );
213 
214 #endif /* ELEMENTNAMES_H_ */
char chIonStage[LIMELM+1][CHARS_ION_STAGE]
Definition: elementnames.h:29
char chIonRoman[LIMELM+1][CHARS_ION_ROMAN]
Definition: elementnames.h:32
Definition: elementnames.h:7
bool isElementSym(const string &chSym)
Definition: elementnames.cpp:39
int elem_symbol_to_index(const string &chSym)
Definition: elementnames.cpp:9
Definition: elementnames.h:8
char chElementNameShort[LIMELM][CHARS_ELEMENT_NAME_SHORT]
Definition: elementnames.h:21
Definition: elementnames.h:12
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
Definition: elementnames.h:25
t_elementnames()
Definition: elementnames.h:36
const int LIMELM
Definition: cddefines.h:318
t_elementnames elementnames
Definition: elementnames.cpp:5
Definition: elementnames.h:8
char chElementName[LIMELM][CHARS_ELEMENT_NAME]
Definition: elementnames.h:17
Definition: elementnames.h:7
Definition: elementnames.h:7