BornAgain  1.18.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 scattering at grazing incidence
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 
31 DWBAComputation::DWBAComputation(const MultiLayer& multilayer, const SimulationOptions& options,
32  ProgressHandler& progress,
33  std::vector<SimulationElement>::iterator begin_it,
34  std::vector<SimulationElement>::iterator end_it)
35  : IComputation(multilayer, options, progress), m_begin_it(begin_it), m_end_it(end_it)
36 {
37  auto p_fresnel_map = mP_processed_sample->fresnelMap();
38  bool polarized = mP_processed_sample->containsMagneticMaterial();
39  for (const auto& layout : mP_processed_sample->layouts()) {
40  m_single_computation.addLayoutComputation(
41  new ParticleLayoutComputation(&layout, m_sim_options, polarized));
42  }
43  // scattering from rough surfaces in DWBA
44  if (mP_processed_sample->hasRoughness())
45  m_single_computation.setRoughnessComputation(
46  new RoughMultiLayerComputation(mP_processed_sample.get()));
47  if (m_sim_options.includeSpecular())
48  m_single_computation.setSpecularBinComputation(new GISASSpecularComputation(p_fresnel_map));
49 }
50 
51 DWBAComputation::~DWBAComputation() = default;
52 
53 // The normalization of the calculated scattering intensities is:
54 // For nanoparticles: rho * (scattering cross-section/scattering particle)
55 // For roughness: (scattering cross-section of area S)/S
56 // For specular peak: |R|^2 * sin(alpha_i) / solid_angle
57 // This allows them to be added and normalized together to the beam afterwards
58 void DWBAComputation::runProtected()
59 {
60  if (!mp_progress->alive())
61  return;
62  m_single_computation.setProgressHandler(mp_progress);
63  for (auto it = m_begin_it; it != m_end_it; ++it) {
64  if (!mp_progress->alive())
65  break;
66  m_single_computation.compute(*it);
67  }
68 }
Defines class DWBAComputation.
Defines class GISASSpecularComputation.
Defines class IFresnelMap.
Defines class MultiLayer.
Defines class ParticleLayoutComputation.
Defines class ProcessedLayout.
Defines class ProcessedSample.
Defines class ProgressHandler.
Defines class RoughMultiLayerComputation.
Defines class SimulationElement.
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:35
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
Computes the scattering contribution from one particle 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.