gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
AtomicElement.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2017, Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
4 http://www.fpvidal.net/
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation and/or
15 other materials provided with the distribution.
16 
17 3. Neither the name of the Bangor University nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 
34 
35 #ifndef __AtomicElement_h
36 #define __AtomicElement_h
37 
38 
69 //******************************************************************************
70 // Include
71 //******************************************************************************
72 #ifndef __gVirtualXRayConfig_h
74 #endif
75 
76 #include <iostream>
77 #include <vector>
78 #include <string>
79 
80 
81 //******************************************************************************
82 // defines
83 //******************************************************************************
84 
85 
86 //******************************************************************************
87 // namespace
88 //******************************************************************************
89 namespace gVirtualXRay {
90 
91 
92 //******************************************************************************
93 // Class declaration
94 //******************************************************************************
95 class AtomicElement;
96 
97 
98 //******************************************************************************
99 // Function declarations
100 //******************************************************************************
101 
102 //------------------------------------------------------------------------------
104 /*
105 * @param anOutputSream: the stream in which an element is going
106 * to be printed
107 * @param anElement: the element to send into the stream
108 * @return the output stream
109 */
110 //------------------------------------------------------------------------------
111 std::ostream& operator<<(std::ostream& anOutputSream,
112  const gVirtualXRay::AtomicElement& anElement);
113 
114 
115 //------------------------------------------------------------------------------
117 /*
118 * @param anInputSream: the stream from which an element is going to be read
119 * @param anElement: the element to read from the stream
120 * @return the input stream
121 */
122 //------------------------------------------------------------------------------
123 std::istream& operator>>(std::istream& anInputSream,
124  gVirtualXRay::AtomicElement& anElement);
125 
126 
127 //==============================================================================
132 //==============================================================================
134 //------------------------------------------------------------------------------
135 {
136 //******************************************************************************
137 public:
138  //--------------------------------------------------------------------------
140  /*
141  * @param aName: the name of the element
142  * @param aSymbol: the symbol of the element
143  * @param aZNumber: the atomic number (Z) of the element
144  * @param aMolarMass: the molar mass of the element (in g/mol))
145  * @param aDensity: the density of the element (in g/cm3)
146  * @param aState: the state of the element
147  * @param aVoxelSize: the size of a voxel
148  */
149  //--------------------------------------------------------------------------
150  AtomicElement(const std::string& aName = "",
151  const std::string& aSymbol = "",
152  unsigned short aZNumber = 0,
153  double aMolarMass = 0,
154  double aDensity = 0,
155  const std::string& aState = "");
156 
157 
158  //--------------------------------------------------------------------------
160  /*
161  * @param anElement: the element to copy
162  */
163  //--------------------------------------------------------------------------
164  AtomicElement(const AtomicElement& anElement);
165 
166 
167  //--------------------------------------------------------------------------
169  //--------------------------------------------------------------------------
170  ~AtomicElement();
171 
172 
173  //--------------------------------------------------------------------------
175  /*
176  * @param aName: the name of the element
177  */
178  //--------------------------------------------------------------------------
179  void setName(const std::string& aName);
180 
181 
182  //--------------------------------------------------------------------------
184  /*
185  * @param aSymbol: the symbol of the element
186  */
187  //--------------------------------------------------------------------------
188  void setSymbol(const std::string& aSymbol);
189 
190 
191  //--------------------------------------------------------------------------
193  /*
194  * @param aZNumber: the atomic number (Z) of the element
195  */
196  //--------------------------------------------------------------------------
197  void setAtomicNumber(unsigned short aZNumber);
198 
199 
200  //--------------------------------------------------------------------------
202  /*
203  * @param aMolarMass: the molar mass of the element
204  */
205  //--------------------------------------------------------------------------
206  void setMolarMass(double aMolarMass);
207 
208 
209  //--------------------------------------------------------------------------
211  /*
212  * @param aDensity: the density of the element
213  */
214  //--------------------------------------------------------------------------
215  void setDensity(double aDensity);
216 
217 
218  //--------------------------------------------------------------------------
220  /*
221  * @param aState: the state of the element
222  */
223  //--------------------------------------------------------------------------
224  void setState(const std::string& aState);
225 
226 
227  //--------------------------------------------------------------------------
230  /*
231  * @param anEnergy: the energy
232  * @return the corresponding linear attenuation coefficient
233  */
234  //--------------------------------------------------------------------------
235  double getMassAttenuationTotal(double anEnergy);
236 
237 
238  //--------------------------------------------------------------------------
241  /*
242  * @param anEnergy: the energy
243  * @return the corresponding linear attenuation coefficient
244  */
245  //--------------------------------------------------------------------------
246  double getMU(double anEnergy);
247 
248 
249  //--------------------------------------------------------------------------
251  /*
252  * @return the name of the element
253  */
254  //--------------------------------------------------------------------------
255  const std::string& getName() const;
256 
257 
258  //--------------------------------------------------------------------------
260  /*
261  * @return the symbol of the element
262  */
263  //--------------------------------------------------------------------------
264  const std::string& getSymbol() const;
265 
266 
267  //--------------------------------------------------------------------------
269  /*
270  * @return the atomic number (Z) of the element
271  */
272  //--------------------------------------------------------------------------
273  unsigned short getAtomicNumber() const;
274 
275 
276  //--------------------------------------------------------------------------
278  /*
279  * @return the atomic number (Z) of the element
280  */
281  //--------------------------------------------------------------------------
282  unsigned short getZ() const;
283 
284 
285  //--------------------------------------------------------------------------
287  /*
288  * @return the atomic number (Z) of the element
289  */
290  //--------------------------------------------------------------------------
291  unsigned short Z() const;
292 
293 
294  //--------------------------------------------------------------------------
296  /*
297  * @return the molar mass of the element
298  */
299  //--------------------------------------------------------------------------
300  double getMolarMass() const;
301 
302 
303  //--------------------------------------------------------------------------
305  /*
306  * @return the density of the element
307  */
308  //--------------------------------------------------------------------------
309  double getDensity() const;
310 
311 
312  //--------------------------------------------------------------------------
314  /*
315  * @return the state of the element
316  */
317  //--------------------------------------------------------------------------
318  const std::string& getState() const;
319 
320 
321  //--------------------------------------------------------------------------
324  /*
325  * @return the number of energy channels
326  */
327  //--------------------------------------------------------------------------
328  unsigned int getEnergyChannelNumber() const;
329 
330 
331  //--------------------------------------------------------------------------
334  /*
335  * @return the smallest energy step
336  */
337  //--------------------------------------------------------------------------
338  double getSmallestEnergyStep() const;
339 
340 
341  //--------------------------------------------------------------------------
343  /*
344  * @param anElement: the element to copy
345  */
346  //--------------------------------------------------------------------------
347  AtomicElement& operator=(const AtomicElement& anElement);
348 
349 
350  double getEnergyChannel(unsigned int i) const;
351  double getMassAttenuationCoefficientChannel(unsigned int i) const;
352  void printSummary() const;
353 
354 
355 //*****************************************************************************
356 protected:
357 
358  std::string m_name;
359  std::string m_symbol;
360  unsigned short m_atomic_number;
361  double m_molar_mass;
362  double m_density;
363  std::string m_state;
364 
366  std::vector<double> m_p_energy_set;
367 
370 
371  // std::vector<double> m_p_coherent_scattering_set;
372  // std::vector<double> m_p_incoherent_scattering_set;
373  // std::vector<double> m_p_photo_electric_absorption_set;
374  // std::vector<double> m_p_pair_production_in_nuclear_field_set;
375  // std::vector<double> m_p_pair_production_in_electron_field_set;
376  // std::vector<double> m_p_total_attenuation_without_coherent_scattering;
377 };
378 
379 
380 } // namespace gVirtualXRay
381 
382 
383 //******************************************************************************
384 #include "AtomicElement.inl"
385 
386 
387 #endif // __AtomicElement_h
void setDensity(double aDensity)
Set the density of the element.
double getDensity() const
Accessor on the density of the element.
std::vector< double > m_p_mass_attenuation_coefficient_set
The mass attenuation coefficient set corresponding to the energy set.
double m_density
The density of the element.
void setName(const std::string &aName)
Set the name of the element.
unsigned short m_atomic_number
The atomic number of the element.
Class to manage elements in material.
std::vector< double > m_p_energy_set
The energy set.
double getMU(double anEnergy)
void setAtomicNumber(unsigned short aZNumber)
Set the atomic number (Z) of the element.
unsigned short getAtomicNumber() const
Accessor on the atomic number (Z) of the element.
double getEnergyChannel(unsigned int i) const
std::string m_name
The name of the element.
unsigned short Z() const
Accessor on the atomic number (Z) of the element.
void setSymbol(const std::string &aSymbol)
Set the symbol of the element.
void setMolarMass(double aMolarMass)
Set the molar mass of the element.
std::string m_symbol
The symbol of the element.
std::istream & operator>>(std::istream &anInputSream, gVirtualXRay::AtomicElement &anElement)
operator >>
double getMolarMass() const
Accessor on the molar mass of the element.
double getMassAttenuationCoefficientChannel(unsigned int i) const
std::string m_state
The state of the element.
const std::string & getName() const
Accessor on the name of the element.
double getSmallestEnergyStep() const
AtomicElement is a class to manage elements in material.
unsigned int getEnergyChannelNumber() const
double getMassAttenuationTotal(double anEnergy)
AtomicElement(const std::string &aName="", const std::string &aSymbol="", unsigned short aZNumber=0, double aMolarMass=0, double aDensity=0, const std::string &aState="")
Default Constructor.
void setState(const std::string &aState)
Set the state of the element.
std::ostream & operator<<(std::ostream &anOutputSream, const gVirtualXRay::AtomicElement &anElement)
operator <<
double m_molar_mass
The molar mass of the element.
const std::string & getSymbol() const
Accessor on the symbol of the element.
const std::string & getState() const
Accessor on the state of the element.
AtomicElement & operator=(const AtomicElement &anElement)
Copy operator.
unsigned short getZ() const
Accessor on the atomic number (Z) of the element.