BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorCoherentPart.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Fresnel/FormFactorCoherentPart.cpp
6 //! @brief Implements class FormFactorCoherentPart.
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 
21 
22 FormFactorCoherentPart::FormFactorCoherentPart(IFormFactor* p_ff) : mP_ff(p_ff) {}
23 
24 FormFactorCoherentPart::FormFactorCoherentPart(const FormFactorCoherentPart& other)
25  : mP_ff(other.mP_ff->clone()), mp_fresnel_map(other.mp_fresnel_map),
26  m_layer_index(other.m_layer_index)
27 {
28 }
29 
30 FormFactorCoherentPart& FormFactorCoherentPart::operator=(const FormFactorCoherentPart& other)
31 {
32  mP_ff.reset(other.mP_ff->clone());
33  mp_fresnel_map = other.mp_fresnel_map;
34  m_layer_index = other.m_layer_index;
35  return *this;
36 }
37 
38 FormFactorCoherentPart& FormFactorCoherentPart::operator=(FormFactorCoherentPart&&) = default;
39 
40 FormFactorCoherentPart::FormFactorCoherentPart(FormFactorCoherentPart&&) = default;
41 
42 FormFactorCoherentPart::~FormFactorCoherentPart() = default;
43 
44 complex_t FormFactorCoherentPart::evaluate(const SimulationElement& sim_element) const
45 {
46  WavevectorInfo wavevectors(sim_element.getKi(), sim_element.getMeanKf(),
47  sim_element.getWavelength());
48 
49  auto P_in_coeffs = mp_fresnel_map->getInCoefficients(sim_element, m_layer_index);
50  auto P_out_coeffs = mp_fresnel_map->getOutCoefficients(sim_element, m_layer_index);
51  mP_ff->setSpecularInfo(std::move(P_in_coeffs), std::move(P_out_coeffs));
52  return mP_ff->evaluate(wavevectors);
53 }
54 
55 Eigen::Matrix2cd FormFactorCoherentPart::evaluatePol(const SimulationElement& sim_element) const
56 {
57  WavevectorInfo wavevectors(sim_element.getKi(), sim_element.getMeanKf(),
58  sim_element.getWavelength());
59 
60  auto P_in_coeffs = mp_fresnel_map->getInCoefficients(sim_element, m_layer_index);
61  auto P_out_coeffs = mp_fresnel_map->getOutCoefficients(sim_element, m_layer_index);
62  mP_ff->setSpecularInfo(std::move(P_in_coeffs), std::move(P_out_coeffs));
63  return mP_ff->evaluatePol(wavevectors);
64 }
65 
66 void FormFactorCoherentPart::setSpecularInfo(const IFresnelMap* p_fresnel_map, size_t layer_index)
67 {
68  mp_fresnel_map = p_fresnel_map;
69  m_layer_index = layer_index;
70 }
71 
72 double FormFactorCoherentPart::radialExtension() const
73 {
74  return mP_ff->radialExtension();
75 }
Defines class FormFactorCoherentPart.
Defines and implements pure virtual interface IFormFactor.
Defines class IFresnelMap.
Defines and implements class ILayerRTCoefficients.
Defines class SimulationElement.
Defines WavevectorInfo.
Information about single particle form factor and specular info of the embedding layer.
Pure virtual base class for all form factors.
Definition: IFormFactor.h:40
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:30
virtual std::unique_ptr< const ILayerRTCoefficients > getOutCoefficients(const SimulationElement &sim_element, size_t layer_index) const =0
Retrieves the amplitude coefficients for a (time-reversed) outgoing wavevector.
std::unique_ptr< const ILayerRTCoefficients > getInCoefficients(const T &sim_element, size_t layer_index) const
Retrieves the amplitude coefficients for an incoming wavevector.
Definition: IFresnelMap.h:41
Data stucture containing both input and output of a single detector cell.
Holds all wavevector information relevant for calculating form factors.