BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DepthProbeElement Class Reference
Collaboration diagram for DepthProbeElement:

Public Member Functions

 DepthProbeElement (double wavelength, double alpha_i, const IAxis *z_positions)
 
 DepthProbeElement (const DepthProbeElement &other)
 
 DepthProbeElement (DepthProbeElement &&other) noexcept
 
 ~DepthProbeElement ()
 
DepthProbeElementoperator= (const DepthProbeElement &other)
 
double getWavelength () const
 
double getAlphaI () const
 
kvector_t getKi () const
 
template<typename T >
void setIntensities (T &&intensities)
 
const std::valarray< double > & getIntensities () const
 
void setZPositions (const IAxis *z_positions)
 
const IAxisgetZPositions () const
 
size_t size () const
 
void setCalculationFlag (bool calculation_flag)
 
bool isCalculated () const
 

Private Member Functions

void swapContent (DepthProbeElement &other)
 

Private Attributes

double m_wavelength
 
double m_alpha_i
 
std::valarray< double > m_intensities
 
const IAxism_z_positions
 
bool m_calculation_flag
 

Detailed Description

Definition at line 24 of file DepthProbeElement.h.

Constructor & Destructor Documentation

◆ DepthProbeElement() [1/3]

DepthProbeElement::DepthProbeElement ( double  wavelength,
double  alpha_i,
const IAxis z_positions 
)

Definition at line 20 of file DepthProbeElement.cpp.

21  : m_wavelength(wavelength), m_alpha_i(alpha_i), m_z_positions(z_positions),
22  m_calculation_flag(true)
23 {
24  if (!z_positions)
25  throw std::runtime_error(
26  "Error in DepthProbeElement::DepthProbeElement: z positions are not specified");
27  m_intensities.resize(z_positions->size(), 0.0);
28 }
const IAxis * m_z_positions
positions (lower z corresponds to a greater depth)
double m_alpha_i
the wavelength and the incident angle of the beam
std::valarray< double > m_intensities
simulated intensity for the set of z positions
virtual size_t size() const =0
retrieve the number of bins

References m_intensities, and IAxis::size().

Here is the call graph for this function:

◆ DepthProbeElement() [2/3]

DepthProbeElement::DepthProbeElement ( const DepthProbeElement other)

Definition at line 30 of file DepthProbeElement.cpp.

◆ DepthProbeElement() [3/3]

DepthProbeElement::DepthProbeElement ( DepthProbeElement &&  other)
noexcept

Definition at line 37 of file DepthProbeElement.cpp.

39  m_intensities(std::move(other.m_intensities)), m_z_positions(other.m_z_positions),
41 {
42 }

◆ ~DepthProbeElement()

DepthProbeElement::~DepthProbeElement ( )
default

Member Function Documentation

◆ operator=()

DepthProbeElement & DepthProbeElement::operator= ( const DepthProbeElement other)

Definition at line 46 of file DepthProbeElement.cpp.

47 {
48  if (this != &other) {
49  DepthProbeElement tmp(other);
50  tmp.swapContent(*this);
51  }
52  return *this;
53 }

References swapContent().

Here is the call graph for this function:

◆ getWavelength()

double DepthProbeElement::getWavelength ( ) const
inline

Definition at line 35 of file DepthProbeElement.h.

35 { return m_wavelength; }

References m_wavelength.

◆ getAlphaI()

double DepthProbeElement::getAlphaI ( ) const
inline

Definition at line 36 of file DepthProbeElement.h.

36 { return m_alpha_i; }

References m_alpha_i.

◆ getKi()

kvector_t DepthProbeElement::getKi ( ) const

Definition at line 55 of file DepthProbeElement.cpp.

56 {
58 }
BasicVector3D< double > vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Creates a vector<double> as a wavevector with given wavelength and angles.
const double phi_i_0

References m_alpha_i, m_wavelength, phi_i_0, and vecOfLambdaAlphaPhi().

Here is the call graph for this function:

◆ setIntensities()

template<typename T >
void DepthProbeElement::setIntensities ( T &&  intensities)
inline

Definition at line 39 of file DepthProbeElement.h.

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  }

References m_intensities.

Referenced by DepthProbeComputationTerm::compute().

◆ getIntensities()

const std::valarray<double>& DepthProbeElement::getIntensities ( ) const
inline

Definition at line 47 of file DepthProbeElement.h.

47 { return m_intensities; }

References m_intensities.

◆ setZPositions()

void DepthProbeElement::setZPositions ( const IAxis z_positions)
inline

Definition at line 49 of file DepthProbeElement.h.

49 { m_z_positions = z_positions; }

References m_z_positions.

◆ getZPositions()

const IAxis* DepthProbeElement::getZPositions ( ) const
inline

Definition at line 50 of file DepthProbeElement.h.

50 { return m_z_positions; }

References m_z_positions.

Referenced by DepthProbeComputationTerm::compute().

◆ size()

size_t DepthProbeElement::size ( ) const
inline

Definition at line 52 of file DepthProbeElement.h.

52 { return m_intensities.size(); }

References m_intensities.

◆ setCalculationFlag()

void DepthProbeElement::setCalculationFlag ( bool  calculation_flag)
inline

Set calculation flag (if it's false, zero intensity is assigned to the element)

Definition at line 55 of file DepthProbeElement.h.

55 { m_calculation_flag = calculation_flag; }

References m_calculation_flag.

◆ isCalculated()

bool DepthProbeElement::isCalculated ( ) const
inline

Definition at line 56 of file DepthProbeElement.h.

56 { return m_calculation_flag; }

References m_calculation_flag.

Referenced by DepthProbeComputationTerm::compute().

◆ swapContent()

void DepthProbeElement::swapContent ( DepthProbeElement other)
private

Definition at line 60 of file DepthProbeElement.cpp.

61 {
64  m_intensities.swap(other.m_intensities);
67 }
void swap(OutputDataIterator< TValue, TContainer > &left, OutputDataIterator< TValue, TContainer > &right)
make Swappable

References m_alpha_i, m_calculation_flag, m_intensities, m_wavelength, m_z_positions, and swap().

Referenced by operator=().

Here is the call graph for this function:

Member Data Documentation

◆ m_wavelength

double DepthProbeElement::m_wavelength
private

Definition at line 61 of file DepthProbeElement.h.

Referenced by getKi(), getWavelength(), and swapContent().

◆ m_alpha_i

double DepthProbeElement::m_alpha_i
private

the wavelength and the incident angle of the beam

Definition at line 61 of file DepthProbeElement.h.

Referenced by getAlphaI(), getKi(), and swapContent().

◆ m_intensities

std::valarray<double> DepthProbeElement::m_intensities
private

simulated intensity for the set of z positions

Definition at line 62 of file DepthProbeElement.h.

Referenced by DepthProbeElement(), getIntensities(), setIntensities(), size(), and swapContent().

◆ m_z_positions

const IAxis* DepthProbeElement::m_z_positions
private

positions (lower z corresponds to a greater depth)

Definition at line 63 of file DepthProbeElement.h.

Referenced by getZPositions(), setZPositions(), and swapContent().

◆ m_calculation_flag

bool DepthProbeElement::m_calculation_flag
private

Definition at line 64 of file DepthProbeElement.h.

Referenced by isCalculated(), setCalculationFlag(), and swapContent().


The documentation for this class was generated from the following files: