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 
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()) {
41  new ParticleLayoutComputation(&layout, m_sim_options, polarized));
42  }
43  // scattering from rough surfaces in DWBA
44  if (mP_processed_sample->hasRoughness())
49 }
50 
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
59 {
60  if (!mp_progress->alive())
61  return;
63  for (auto it = m_begin_it; it != m_end_it; ++it) {
64  if (!mp_progress->alive())
65  break;
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.
void runProtected() override
DWBASingleComputation m_single_computation
Contains the information, necessary to calculate the Fresnel coefficients.
~DWBAComputation() override
DWBAComputation(const MultiLayer &multilayer, const SimulationOptions &options, ProgressHandler &progress, std::vector< SimulationElement >::iterator begin_it, std::vector< SimulationElement >::iterator end_it)
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:35
std::unique_ptr< ProcessedSample > mP_processed_sample
Definition: IComputation.h:50
ProgressHandler * mp_progress
Definition: IComputation.h:48
SimulationOptions m_sim_options
Definition: IComputation.h:47
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.
bool includeSpecular() const