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 
23 
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 
31 {
32  mP_ff.reset(other.mP_ff->clone());
35  return *this;
36 }
37 
39 
41 
43 
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 
73 {
74  return mP_ff->radialExtension();
75 }
std::complex< double > complex_t
Definition: Complex.h:20
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.
FormFactorCoherentPart & operator=(const FormFactorCoherentPart &other)
std::unique_ptr< IFormFactor > mP_ff
void setSpecularInfo(const IFresnelMap *p_fresnel_map, size_t layer_index)
FormFactorCoherentPart(IFormFactor *p_ff)
complex_t evaluate(const SimulationElement &sim_element) const
Eigen::Matrix2cd evaluatePol(const SimulationElement &sim_element) const
const IFresnelMap * mp_fresnel_map
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.
kvector_t getMeanKf() const
double getWavelength() const
kvector_t getKi() const
Holds all wavevector information relevant for calculating form factors.