BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
DiffuseElement Class Reference

Description

Data stucture containing both input and output of a single detector cell.

Definition at line 37 of file DiffuseElement.h.

Inheritance diagram for DiffuseElement:
[legend]
Collaboration diagram for DiffuseElement:
[legend]

Public Member Functions

 DiffuseElement (const DiffuseElement &)=delete
 
 DiffuseElement (DiffuseElement &&)
 
 DiffuseElement (double wavelength, double alpha_i, double phi_i, std::unique_ptr< IPixel > pixel, const SpinMatrix &beam_polMatrices, const SpinMatrix &analyzer, bool isSpecular_, const Fluxes *fluxes_in=nullptr, const Fluxes *fluxes_out=nullptr)
 
 ~DiffuseElement ()
 
void addIntensity (double intensity)
 
double alpha (double x, double y) const
 
double alphaI () const
 
double alphaMean () const
 
const IFluxfluxIn (size_t i_layer) const
 
const IFluxfluxOut (size_t i_layer) const
 
R3 getKi () const
 
double getPhi (double x, double y) const
 
double getPhiI () const
 
double getPhiMean () const
 
R3 getQ (double x, double y) const
 Returns scattering vector Q, with Kf determined from in-pixel coordinates x,y. In-pixel coordinates take values from 0 to 1. More...
 
double integrationFactor (double x, double y) const
 
double intensity () const
 
bool isSpecular () const
 Tells if simulation element corresponds to a specular peak. More...
 
R3 meanKf () const
 
R3 meanQ () const
 
DiffuseElement pointElement (double x, double y) const
 Returns copy of this DiffuseElement with k_f given by in-pixel coordinate x,y. More...
 
const PolMatricespolMatrices () const
 Returns polarizer and analyzer matrices. More...
 
void setFluxes (const Fluxes *fluxes_in, const Fluxes *fluxes_out)
 
void setIntensity (double intensity)
 
double solidAngle () const
 
double wavelength () const
 
WavevectorInfo wavevectorInfo () const
 

Protected Attributes

const PolMatrices m_polMatrices
 

Private Member Functions

R3 getKf (double x, double y) const
 Returns outgoing wavevector Kf for in-pixel coordinates x,y. In-pixel coordinates take values from 0 to 1. More...
 

Private Attributes

const double m_alpha_i
 incident grazing angle More...
 
const Fluxesm_fluxes_in
 
const Fluxesm_fluxes_out
 
double m_intensity
 simulated intensity for detector cell More...
 
const bool m_is_specular
 
const R3 m_k_i
 cached value of k_i More...
 
const R3 m_mean_kf
 cached value of mean_kf More...
 
const double m_phi_i
 incident angle in xy plane More...
 
std::unique_ptr< IPixelm_pixel
 
const double m_wavelength
 wavelength of beam More...
 

Constructor & Destructor Documentation

◆ DiffuseElement() [1/3]

DiffuseElement::DiffuseElement ( double  wavelength,
double  alpha_i,
double  phi_i,
std::unique_ptr< IPixel pixel,
const SpinMatrix beam_polMatrices,
const SpinMatrix analyzer,
bool  isSpecular_,
const Fluxes fluxes_in = nullptr,
const Fluxes fluxes_out = nullptr 
)

Definition at line 21 of file DiffuseElement.cpp.

25  : IElement({beam_polMatrices, analyzer})
27  , m_alpha_i(alpha_i)
28  , m_phi_i(phi_i)
30  , m_mean_kf(pixel->getK(0.5, 0.5, m_wavelength))
31  , m_pixel(std::move(pixel))
32  , m_is_specular(isSpecular_)
33  , m_fluxes_in(fluxes_in)
34  , m_fluxes_out(fluxes_out)
35  , m_intensity(0.0)
36 {
37 }
R3 vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Definition: Direction.cpp:19
double m_intensity
simulated intensity for detector cell
const Fluxes * m_fluxes_in
const R3 m_k_i
cached value of k_i
const double m_alpha_i
incident grazing angle
const Fluxes * m_fluxes_out
double wavelength() const
const double m_wavelength
wavelength of beam
std::unique_ptr< IPixel > m_pixel
const R3 m_mean_kf
cached value of mean_kf
const bool m_is_specular
const double m_phi_i
incident angle in xy plane
IElement(PolMatrices polMatrices)
Definition: IElement.h:31

◆ DiffuseElement() [2/3]

DiffuseElement::DiffuseElement ( const DiffuseElement )
delete

◆ DiffuseElement() [3/3]

DiffuseElement::DiffuseElement ( DiffuseElement &&  other)

Definition at line 39 of file DiffuseElement.cpp.

40  : IElement(other.m_polMatrices)
41  , m_wavelength(other.m_wavelength)
42  , m_alpha_i(other.m_alpha_i)
43  , m_phi_i(other.m_phi_i)
44  , m_k_i(other.m_k_i)
45  , m_mean_kf(other.m_mean_kf)
46  , m_pixel(std::move(other.m_pixel))
48  , m_fluxes_in(other.m_fluxes_in)
49  , m_fluxes_out(other.m_fluxes_out)
50  , m_intensity(other.m_intensity)
51 {
52 }
const PolMatrices m_polMatrices
Definition: IElement.h:40

◆ ~DiffuseElement()

DiffuseElement::~DiffuseElement ( )
default

Member Function Documentation

◆ addIntensity()

void DiffuseElement::addIntensity ( double  intensity)
inline

Definition at line 59 of file DiffuseElement.h.

59 { m_intensity += intensity; }
double intensity() const

References intensity(), and m_intensity.

Referenced by ParticleLayoutContribution::compute(), and RoughMultiLayerContribution::compute().

Here is the call graph for this function:

◆ alpha()

double DiffuseElement::alpha ( double  x,
double  y 
) const

Definition at line 114 of file DiffuseElement.cpp.

115 {
116  return M_PI_2 - R3Util::theta(getKf(x, y));
117 }
#define M_PI_2
Definition: Constants.h:45
R3 getKf(double x, double y) const
Returns outgoing wavevector Kf for in-pixel coordinates x,y. In-pixel coordinates take values from 0 ...

References getKf(), and M_PI_2.

Referenced by alphaMean().

Here is the call graph for this function:

◆ alphaI()

double DiffuseElement::alphaI ( ) const
inline

Definition at line 54 of file DiffuseElement.h.

54 { return m_alpha_i; }

References m_alpha_i.

Referenced by GISASSpecularContribution::compute(), and ISimulation2D::normalize().

◆ alphaMean()

double DiffuseElement::alphaMean ( ) const
inline

Definition at line 56 of file DiffuseElement.h.

56 { return alpha(0.5, 0.5); }
double alpha(double x, double y) const

References alpha().

Referenced by RoughMultiLayerContribution::compute().

Here is the call graph for this function:

◆ fluxIn()

const IFlux * DiffuseElement::fluxIn ( size_t  i_layer) const

Definition at line 62 of file DiffuseElement.cpp.

63 {
64  return (*m_fluxes_in)[i_layer].get();
65 }

References m_fluxes_in.

Referenced by SumDWBA::coherentFF(), SumDWBA::coherentPolFF(), GISASSpecularContribution::compute(), and RoughMultiLayerContribution::get_sum8terms().

◆ fluxOut()

const IFlux * DiffuseElement::fluxOut ( size_t  i_layer) const

Definition at line 67 of file DiffuseElement.cpp.

68 {
69  return (*m_fluxes_out)[i_layer].get();
70 }

References m_fluxes_out.

Referenced by SumDWBA::coherentFF(), SumDWBA::coherentPolFF(), and RoughMultiLayerContribution::get_sum8terms().

◆ getKf()

R3 DiffuseElement::getKf ( double  x,
double  y 
) const
private

Returns outgoing wavevector Kf for in-pixel coordinates x,y. In-pixel coordinates take values from 0 to 1.

Definition at line 97 of file DiffuseElement.cpp.

98 {
99  return m_pixel->getK(x, y, m_wavelength);
100 }

References m_pixel, and m_wavelength.

Referenced by alpha(), and getPhi().

◆ getKi()

R3 DiffuseElement::getKi ( ) const

Definition at line 85 of file DiffuseElement.cpp.

86 {
87  return m_k_i;
88 }

References m_k_i.

Referenced by getQ(), meanQ(), and wavevectorInfo().

◆ getPhi()

double DiffuseElement::getPhi ( double  x,
double  y 
) const

Definition at line 119 of file DiffuseElement.cpp.

120 {
121  return R3Util::phi(getKf(x, y));
122 }

References getKf().

Referenced by getPhiMean().

Here is the call graph for this function:

◆ getPhiI()

double DiffuseElement::getPhiI ( ) const
inline

Definition at line 55 of file DiffuseElement.h.

55 { return m_phi_i; }

References m_phi_i.

◆ getPhiMean()

double DiffuseElement::getPhiMean ( ) const
inline

Definition at line 57 of file DiffuseElement.h.

57 { return getPhi(0.5, 0.5); }
double getPhi(double x, double y) const

References getPhi().

Here is the call graph for this function:

◆ getQ()

R3 DiffuseElement::getQ ( double  x,
double  y 
) const

Returns scattering vector Q, with Kf determined from in-pixel coordinates x,y. In-pixel coordinates take values from 0 to 1.

Definition at line 109 of file DiffuseElement.cpp.

110 {
111  return getKi() - m_pixel->getK(x, y, m_wavelength);
112 }
R3 getKi() const

References getKi(), m_pixel, and m_wavelength.

Here is the call graph for this function:

◆ integrationFactor()

double DiffuseElement::integrationFactor ( double  x,
double  y 
) const

Definition at line 129 of file DiffuseElement.cpp.

130 {
131  return m_pixel->integrationFactor(x, y);
132 }

References m_pixel.

Referenced by IInterparticleStrategy::evaluate_for_fixed_angles().

◆ intensity()

double DiffuseElement::intensity ( ) const
inline

◆ isSpecular()

bool DiffuseElement::isSpecular ( ) const
inline

Tells if simulation element corresponds to a specular peak.

Definition at line 76 of file DiffuseElement.h.

76 { return m_is_specular; }

References m_is_specular.

Referenced by GISASSpecularContribution::compute().

◆ meanKf()

R3 DiffuseElement::meanKf ( ) const

Definition at line 90 of file DiffuseElement.cpp.

91 {
92  return m_mean_kf;
93 }

References m_mean_kf.

Referenced by meanQ(), and wavevectorInfo().

◆ meanQ()

R3 DiffuseElement::meanQ ( ) const

Definition at line 102 of file DiffuseElement.cpp.

103 {
104  return getKi() - meanKf();
105 }
R3 meanKf() const

References getKi(), and meanKf().

Referenced by RoughMultiLayerContribution::compute(), DecouplingApproximationStrategy::polarizedCalculation(), SSCAStrategy::polarizedCalculation(), DecouplingApproximationStrategy::scalarCalculation(), and SSCAStrategy::scalarCalculation().

Here is the call graph for this function:

◆ pointElement()

DiffuseElement DiffuseElement::pointElement ( double  x,
double  y 
) const

Returns copy of this DiffuseElement with k_f given by in-pixel coordinate x,y.

Definition at line 72 of file DiffuseElement.cpp.

73 {
74  return {m_wavelength,
75  m_alpha_i,
76  m_phi_i,
77  std::unique_ptr<IPixel>(m_pixel->createZeroSizePixel(x, y)), // TODO simplify
82  m_fluxes_out};
83 }
const SpinMatrix & polarizerMatrix() const
Gets the polarization density matrix (in spin basis along z-axis)
Definition: PolMatrices.h:38
const SpinMatrix & analyzerMatrix() const
Gets the polarization analyzer operator (in spin basis along z-axis)
Definition: PolMatrices.h:44

References PolMatrices::analyzerMatrix(), m_alpha_i, m_fluxes_in, m_fluxes_out, m_is_specular, m_phi_i, m_pixel, IElement::m_polMatrices, m_wavelength, and PolMatrices::polarizerMatrix().

Referenced by IInterparticleStrategy::evaluate_for_fixed_angles().

Here is the call graph for this function:

◆ polMatrices()

const PolMatrices& IElement::polMatrices ( ) const
inlineinherited

◆ setFluxes()

void DiffuseElement::setFluxes ( const Fluxes fluxes_in,
const Fluxes fluxes_out 
)

Definition at line 56 of file DiffuseElement.cpp.

57 {
58  m_fluxes_in = fluxes_in;
59  m_fluxes_out = fluxes_out;
60 }

References m_fluxes_in, and m_fluxes_out.

◆ setIntensity()

void DiffuseElement::setIntensity ( double  intensity)
inline

Definition at line 58 of file DiffuseElement.h.

References intensity(), and m_intensity.

Referenced by ISimulation2D::addBackgroundIntensity(), GISASSpecularContribution::compute(), and ISimulation2D::normalize().

Here is the call graph for this function:

◆ solidAngle()

double DiffuseElement::solidAngle ( ) const

Definition at line 134 of file DiffuseElement.cpp.

135 {
136  return m_pixel->solidAngle();
137 }

References m_pixel.

Referenced by GISASSpecularContribution::compute(), IInterparticleStrategy::evaluate(), and ISimulation2D::normalize().

◆ wavelength()

double DiffuseElement::wavelength ( ) const
inline

Definition at line 53 of file DiffuseElement.h.

53 { return m_wavelength; }

References m_wavelength.

Referenced by RoughMultiLayerContribution::compute(), and wavevectorInfo().

◆ wavevectorInfo()

WavevectorInfo DiffuseElement::wavevectorInfo ( ) const

Definition at line 124 of file DiffuseElement.cpp.

125 {
126  return WavevectorInfo(getKi(), meanKf(), wavelength());
127 }
Holds all wavevector information relevant for calculating form factors.

References getKi(), meanKf(), and wavelength().

Referenced by SumDWBA::coherentFF(), and SumDWBA::coherentPolFF().

Here is the call graph for this function:

Member Data Documentation

◆ m_alpha_i

const double DiffuseElement::m_alpha_i
private

incident grazing angle

Definition at line 82 of file DiffuseElement.h.

Referenced by alphaI(), and pointElement().

◆ m_fluxes_in

const Fluxes* DiffuseElement::m_fluxes_in
private

Definition at line 88 of file DiffuseElement.h.

Referenced by fluxIn(), pointElement(), and setFluxes().

◆ m_fluxes_out

const Fluxes* DiffuseElement::m_fluxes_out
private

Definition at line 89 of file DiffuseElement.h.

Referenced by fluxOut(), pointElement(), and setFluxes().

◆ m_intensity

double DiffuseElement::m_intensity
private

simulated intensity for detector cell

Definition at line 90 of file DiffuseElement.h.

Referenced by addIntensity(), intensity(), and setIntensity().

◆ m_is_specular

const bool DiffuseElement::m_is_specular
private

Definition at line 87 of file DiffuseElement.h.

Referenced by isSpecular(), and pointElement().

◆ m_k_i

const R3 DiffuseElement::m_k_i
private

cached value of k_i

Definition at line 84 of file DiffuseElement.h.

Referenced by getKi().

◆ m_mean_kf

const R3 DiffuseElement::m_mean_kf
private

cached value of mean_kf

Definition at line 85 of file DiffuseElement.h.

Referenced by meanKf().

◆ m_phi_i

const double DiffuseElement::m_phi_i
private

incident angle in xy plane

Definition at line 83 of file DiffuseElement.h.

Referenced by getPhiI(), and pointElement().

◆ m_pixel

std::unique_ptr<IPixel> DiffuseElement::m_pixel
private

Definition at line 86 of file DiffuseElement.h.

Referenced by getKf(), getQ(), integrationFactor(), pointElement(), and solidAngle().

◆ m_polMatrices

const PolMatrices IElement::m_polMatrices
protectedinherited

Definition at line 40 of file IElement.h.

Referenced by pointElement(), and IElement::polMatrices().

◆ m_wavelength

const double DiffuseElement::m_wavelength
private

wavelength of beam

Definition at line 81 of file DiffuseElement.h.

Referenced by getKf(), getQ(), pointElement(), and wavelength().


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