BornAgain  1.19.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 reflection and scattering
4 //
5 //! @file Sample/Processed/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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SAMPLE_PROCESSED_PROCESSEDSAMPLE_H
21 #define BORNAGAIN_SAMPLE_PROCESSED_PROCESSEDSAMPLE_H
22 
23 #include "Sample/Slice/Slice.h"
24 #include <map>
25 #include <memory>
26 #include <vector>
27 
28 struct HomogeneousRegion;
29 class IFresnelMap;
30 class LayerRoughness;
31 class MultiLayer;
32 class ProcessedLayout;
33 class SimulationOptions;
34 
35 //! Data structure that contains all the necessary data for scattering calculations.
36 //!
37 //! If the usage of average materials is requested, layers and particles are sliced into multiple
38 //! slices and the average material is calculated for each slice.
39 //!
40 //! @ingroup algorithms_internal
41 
43 public:
44  ProcessedSample(const MultiLayer& sample, const SimulationOptions& options,
45  bool forcePolarized = false);
47 
48  size_t numberOfSlices() const;
49  const std::vector<Slice>& slices() const;
50  const std::vector<Slice>& averageSlices() const;
51  const std::vector<ProcessedLayout>& layouts() const;
52  const IFresnelMap* fresnelMap() const;
53  double crossCorrelationLength() const;
54  kvector_t externalField() const;
55  const LayerRoughness* bottomRoughness(size_t i) const;
56  double sliceTopZ(size_t i) const;
57  double sliceBottomZ(size_t i) const;
58  bool containsMagneticMaterial() const;
59  bool hasRoughness() const;
60 
61  //! Fourier transform of the correlation function of roughnesses between
62  //! the interfaces
63  double crossCorrSpectralFun(const kvector_t kvec, size_t j, size_t k) const;
64 
65 private:
66  void initSlices(const MultiLayer& sample, const SimulationOptions& options);
67  void initLayouts(const MultiLayer& sample);
68  void addSlice(double thickness, const Material& material,
69  const LayerRoughness* p_roughness = nullptr);
70  void addNSlices(size_t n, double thickness, const Material& material,
71  const LayerRoughness* p_roughness = nullptr);
72  void initBFields();
73  void mergeRegionMap(const std::map<size_t, std::vector<HomogeneousRegion>>& region_map);
74  void initFresnelMap(const SimulationOptions& sim_options);
75 
76  std::unique_ptr<IFresnelMap> m_fresnel_map;
77  std::vector<Slice> m_slices;
78  double m_top_z;
80  std::vector<ProcessedLayout> m_layouts;
83  std::map<size_t, std::vector<HomogeneousRegion>> m_region_map;
84 };
85 
86 #endif // BORNAGAIN_SAMPLE_PROCESSED_PROCESSEDSAMPLE_H
87 #endif // USER_API
Defines class Slice.
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:34
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:41
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
void initSlices(const MultiLayer &sample, const SimulationOptions &options)
bool hasRoughness() const
double sliceTopZ(size_t i) const
kvector_t externalField() const
ProcessedSample(const MultiLayer &sample, const SimulationOptions &options, bool forcePolarized=false)
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 > m_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.