BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ProcessedSample.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Computation/ProcessedSample.h
6 //! @brief Defines class ProcessedSample.
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 
15 #ifndef BORNAGAIN_CORE_COMPUTATION_PROCESSEDSAMPLE_H
16 #define BORNAGAIN_CORE_COMPUTATION_PROCESSEDSAMPLE_H
17 
18 #include "Sample/Slice/Slice.h"
19 #include <map>
20 #include <memory>
21 #include <vector>
22 
23 struct HomogeneousRegion;
24 class IFresnelMap;
25 class LayerRoughness;
26 class MultiLayer;
27 class ProcessedLayout;
28 class SimulationOptions;
29 
30 //! Data structure that contains all the necessary data for scattering calculations.
31 //!
32 //! If the usage of average materials is requested, layers and particles are sliced into multiple
33 //! slices and the average material is calculated for each slice.
34 //!
35 //! @ingroup algorithms_internal
36 
38 {
39 public:
40  ProcessedSample(const MultiLayer& sample, const SimulationOptions& options);
42 
43  size_t numberOfSlices() const;
44  const std::vector<Slice>& slices() const;
45  const std::vector<Slice>& averageSlices() const;
46  const std::vector<ProcessedLayout>& layouts() const;
47  const IFresnelMap* fresnelMap() const;
48  double crossCorrelationLength() const;
49  kvector_t externalField() const;
50  const LayerRoughness* bottomRoughness(size_t i) const;
51  double sliceTopZ(size_t i) const;
52  double sliceBottomZ(size_t i) const;
53  bool containsMagneticMaterial() const;
54  bool hasRoughness() const;
55 
56  //! Fourier transform of the correlation function of roughnesses between
57  //! the interfaces
58  double crossCorrSpectralFun(const kvector_t kvec, size_t j, size_t k) const;
59 
60 private:
61  void initSlices(const MultiLayer& sample, const SimulationOptions& options);
62  void initLayouts(const MultiLayer& sample);
63  void addSlice(double thickness, const Material& material,
64  const LayerRoughness* p_roughness = nullptr);
65  void addNSlices(size_t n, double thickness, const Material& material,
66  const LayerRoughness* p_roughness = nullptr);
67  void initBFields();
68  void mergeRegionMap(const std::map<size_t, std::vector<HomogeneousRegion>>& region_map);
69  void initFresnelMap(const SimulationOptions& sim_options);
70  std::unique_ptr<IFresnelMap> mP_fresnel_map;
71  std::vector<Slice> m_slices;
72  double m_top_z;
74  std::vector<ProcessedLayout> m_layouts;
77  std::map<size_t, std::vector<HomogeneousRegion>> m_region_map;
78 };
79 
80 #endif // BORNAGAIN_CORE_COMPUTATION_PROCESSEDSAMPLE_H
Defines class Slice.
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:30
A roughness of interface between two layers.
A wrapper for underlying material implementation.
Definition: Material.h:29
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
Data structure that contains preprocessed data for a single layout.
Data structure that contains all the necessary data for scattering calculations.
void initLayouts(const MultiLayer &sample)
const std::vector< Slice > & slices() const
std::vector< Slice > m_slices
std::map< size_t, std::vector< HomogeneousRegion > > m_region_map
ProcessedSample(const MultiLayer &sample, const SimulationOptions &options)
void initSlices(const MultiLayer &sample, const SimulationOptions &options)
bool hasRoughness() const
double sliceTopZ(size_t i) const
kvector_t externalField() const
void addSlice(double thickness, const Material &material, const LayerRoughness *p_roughness=nullptr)
void addNSlices(size_t n, double thickness, const Material &material, const LayerRoughness *p_roughness=nullptr)
void mergeRegionMap(const std::map< size_t, std::vector< HomogeneousRegion >> &region_map)
double sliceBottomZ(size_t i) const
void initFresnelMap(const SimulationOptions &sim_options)
bool containsMagneticMaterial() const
std::unique_ptr< IFresnelMap > mP_fresnel_map
const IFresnelMap * fresnelMap() const
double m_crossCorrLength
kvector_t m_ext_field
size_t numberOfSlices() const
double crossCorrSpectralFun(const kvector_t kvec, size_t j, size_t k) const
Fourier transform of the correlation function of roughnesses between the interfaces.
const std::vector< Slice > & averageSlices() const
const std::vector< ProcessedLayout > & layouts() const
double crossCorrelationLength() const
const LayerRoughness * bottomRoughness(size_t i) const
std::vector< ProcessedLayout > m_layouts
Collect the different options for simulation.
Struct that contains information on a single homogeneous region of a particle inside a single layer.