BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DWBAComputation.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Core/Computation/DWBAComputation.cpp
6 //! @brief Implements class DWBAComputation.
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 
25 
26 static_assert(std::is_copy_constructible<DWBAComputation>::value == false,
27  "DWBAComputation should not be copy constructable");
28 static_assert(std::is_copy_assignable<DWBAComputation>::value == false,
29  "DWBAComputation should not be copy assignable");
30 
32  ProgressHandler& progress,
33  std::vector<SimulationElement>::iterator begin_it,
34  std::vector<SimulationElement>::iterator end_it,
35  bool forcePolarized)
36  : IComputation(multilayer, options, progress, forcePolarized)
37  , m_begin_it(begin_it)
38  , m_end_it(end_it)
39 {
40  const IFresnelMap* p_fresnel_map = m_processed_sample->fresnelMap();
41  bool polarized = m_processed_sample->containsMagneticMaterial() || forcePolarized;
42 
43  for (const ProcessedLayout& layout : m_processed_sample->layouts()) {
46  }
47  // scattering from rough surfaces in DWBA
48  if (m_processed_sample->hasRoughness())
53 }
54 
56 
57 // The normalization of the calculated scattering intensities is:
58 // For nanoparticles: rho * (scattering cross-section/scattering particle)
59 // For roughness: (scattering cross-section of area S)/S
60 // For specular peak: |R|^2 * sin(alpha_i) / solid_angle
61 // This allows them to be added and normalized together to the beam afterwards
63 {
64  if (!m_progress->alive())
65  return;
67  for (auto it = m_begin_it; it != m_end_it; ++it) {
68  if (!m_progress->alive())
69  break;
71  }
72 }
Defines class DWBAComputation.
Defines class GISASSpecularComputation.
Defines interface IFresnelMap.
Defines class MultiLayer.
Defines class ParticleLayoutComputation.
Defines class ProcessedLayout.
Defines class ProcessedSample.
Defines class ProgressHandler.
Defines class RoughMultiLayerComputation.
Defines class SimulationElement.
void runProtected() override
DWBAComputation(const MultiLayer &multilayer, const SimulationOptions &options, ProgressHandler &progress, std::vector< SimulationElement >::iterator begin_it, std::vector< SimulationElement >::iterator end_it, bool forcePolarized=false)
DWBASingleComputation m_single_computation
Contains the information, necessary to calculate the Fresnel coefficients.
~DWBAComputation() override
std::vector< SimulationElement >::iterator m_begin_it
These iterators define the span of detector bins this simulation will work on.
std::vector< SimulationElement >::iterator m_end_it
void addLayoutComputation(ParticleLayoutComputation *p_layout_comp)
void compute(SimulationElement &elem) const
void setRoughnessComputation(RoughMultiLayerComputation *p_roughness_comp)
void setProgressHandler(ProgressHandler *p_progress)
void setSpecularBinComputation(GISASSpecularComputation *p_spec_comp)
Computes the specular signal in the bin where q_parallel = 0.
Interface for a single-threaded computation with given range of SimulationElements and ProgressHandle...
Definition: IComputation.h:39
ProgressHandler * m_progress
Definition: IComputation.h:52
std::unique_ptr< ProcessedSample > m_processed_sample
Definition: IComputation.h:54
SimulationOptions m_sim_options
Definition: IComputation.h:51
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:34
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:41
Computes the scattering contribution from one particle layout.
Data structure that contains preprocessed data for a single layout.
Maintains information about progress of a computation.
Computes the diffuse reflection from the rough interfaces of a multilayer.
Collect the different options for simulation.
bool includeSpecular() const
matrixFFVector_t polarized(const SimulationElement &sim_element, const std::vector< FormFactorCoherentSum > &ff_wrappers)