BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DepthProbeElement.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Computation/DepthProbeElement.h
6 //! @brief Defines class DepthProbeElement.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_CORE_COMPUTATION_DEPTHPROBEELEMENT_H
16 #define BORNAGAIN_CORE_COMPUTATION_DEPTHPROBEELEMENT_H
17 
18 #include <valarray>
19 
20 #include "Base/Vector/Vectors3D.h"
21 
22 class IAxis;
23 
25 {
26 public:
27  DepthProbeElement(double wavelength, double alpha_i, const IAxis* z_positions);
29  DepthProbeElement(DepthProbeElement&& other) noexcept;
30 
32 
34 
35  double getWavelength() const { return m_wavelength; }
36  double getAlphaI() const { return m_alpha_i; }
37  kvector_t getKi() const;
38 
39  template <typename T> void setIntensities(T&& intensities)
40  {
41  static_assert(
42  std::is_assignable<std::valarray<double>, typename std::decay<T>::type>::value,
43  "Error in DepthProbeElement::setIntensities: wrong type of input data.");
44  m_intensities = std::forward<T>(intensities);
45  }
46 
47  const std::valarray<double>& getIntensities() const { return m_intensities; }
48 
49  void setZPositions(const IAxis* z_positions) { m_z_positions = z_positions; }
50  const IAxis* getZPositions() const { return m_z_positions; }
51 
52  size_t size() const { return m_intensities.size(); }
53 
54  //! Set calculation flag (if it's false, zero intensity is assigned to the element)
55  void setCalculationFlag(bool calculation_flag) { m_calculation_flag = calculation_flag; }
56  bool isCalculated() const { return m_calculation_flag; }
57 
58 private:
59  void swapContent(DepthProbeElement& other);
60 
61  double m_wavelength, m_alpha_i; //!< the wavelength and the incident angle of the beam
62  std::valarray<double> m_intensities; //!< simulated intensity for the set of z positions
63  const IAxis* m_z_positions; //!< positions (lower z corresponds to a greater depth)
65 };
66 
67 #endif // BORNAGAIN_CORE_COMPUTATION_DEPTHPROBEELEMENT_H
Defines basic vectors in R^3 and C^3.
double getAlphaI() const
const IAxis * m_z_positions
positions (lower z corresponds to a greater depth)
void swapContent(DepthProbeElement &other)
double m_alpha_i
the wavelength and the incident angle of the beam
void setIntensities(T &&intensities)
void setCalculationFlag(bool calculation_flag)
Set calculation flag (if it's false, zero intensity is assigned to the element)
const IAxis * getZPositions() const
bool isCalculated() const
DepthProbeElement(double wavelength, double alpha_i, const IAxis *z_positions)
std::valarray< double > m_intensities
simulated intensity for the set of z positions
double getWavelength() const
DepthProbeElement & operator=(const DepthProbeElement &other)
kvector_t getKi() const
void setZPositions(const IAxis *z_positions)
size_t size() const
const std::valarray< double > & getIntensities() const
Interface for one-dimensional axes.
Definition: IAxis.h:25