BornAgain  1.19.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 reflection and scattering
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  : m_ff(std::unique_ptr<IComputeFF>(other.m_ff->clone()))
26  , m_fresnel_map(other.m_fresnel_map)
27  , m_layer_index(other.m_layer_index)
28 {
29 }
30 
32 {
33  m_ff.reset(other.m_ff->clone());
36  return *this;
37 }
38 
40 
42 
44 
46 {
47  WavevectorInfo wavevectors(sim_element.getKi(), sim_element.getMeanKf(),
48  sim_element.wavelength());
49 
50  auto in_coeffs = m_fresnel_map->getInCoefficients(sim_element, m_layer_index);
51  auto out_coeffs = m_fresnel_map->getOutCoefficients(sim_element, m_layer_index);
52  m_ff->setSpecularInfo(std::move(in_coeffs), std::move(out_coeffs));
53  return m_ff->evaluate(wavevectors);
54 }
55 
56 Eigen::Matrix2cd FormFactorCoherentPart::evaluatePol(const SimulationElement& sim_element) const
57 {
58  WavevectorInfo wavevectors(sim_element.getKi(), sim_element.getMeanKf(),
59  sim_element.wavelength());
60 
61  auto in_coeffs = m_fresnel_map->getInCoefficients(sim_element, m_layer_index);
62  auto out_coeffs = m_fresnel_map->getOutCoefficients(sim_element, m_layer_index);
63  m_ff->setSpecularInfo(std::move(in_coeffs), std::move(out_coeffs));
64  return m_ff->evaluatePol(wavevectors);
65 }
66 
67 void FormFactorCoherentPart::setSpecularInfo(const IFresnelMap* fresnel_map, size_t layer_index)
68 {
69  m_fresnel_map = fresnel_map;
70  m_layer_index = layer_index;
71 }
72 
74 {
75  return m_ff->radialExtension();
76 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines class FormFactorCoherentPart.
Defines and implements interface IFormFactor.
Defines interface 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)
void setSpecularInfo(const IFresnelMap *fresnel_map, size_t layer_index)
complex_t evaluate(const SimulationElement &sim_element) const
FormFactorCoherentPart(IComputeFF *ff)
Eigen::Matrix2cd evaluatePol(const SimulationElement &sim_element) const
std::unique_ptr< IComputeFF > m_ff
const IFresnelMap * m_fresnel_map
Abstract base class for form factor evaluations.
Definition: IComputeFF.h:39
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:34
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:45
Data stucture containing both input and output of a single detector cell.
double wavelength() const
kvector_t getMeanKf() const
kvector_t getKi() const
Holds all wavevector information relevant for calculating form factors.
Definition: filesystem.h:81