BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ReSample.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Resample/Processed/ReSample.h
6 //! @brief Defines class reSample.
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_RESAMPLE_PROCESSED_RESAMPLE_H
21 #define BORNAGAIN_RESAMPLE_PROCESSED_RESAMPLE_H
22 
24 #include <heinz/Vectors3D.h>
25 #include <memory>
26 #include <vector>
27 
28 class IFlux;
29 class Material;
30 class MultiLayer;
31 class reLayout;
32 class SimulationOptions;
33 
34 using Fluxes = std::vector<std::unique_ptr<const IFlux>>;
35 
36 //! Data structure that contains all the necessary data for scattering calculations.
37 //!
38 //! If the usage of average materials is requested, layers and particles are sliced into multiple
39 //! slices and the average material is calculated for each slice.
40 
41 class reSample {
42 public:
43  //! Factory method that wraps the private constructor.
44  static reSample make(const MultiLayer& sample, const SimulationOptions& options,
45  bool forcePolarized = false);
46  reSample(const reSample&) = delete;
48 
49  size_t numberOfSlices() const;
50  const SliceStack& averageSlices() const;
51  const Slice& avgeSlice(size_t i) const;
52  const std::vector<reLayout>& layouts() const;
53  double sliceTopZ(size_t i) const;
54  double sliceBottomZ(size_t i) const;
55  bool containsMagneticMaterial() const;
56  bool polarizing() const; //!< Contains magnetic material, or nonzero magnetic field
57  bool hasRoughness() const;
58  const MultiLayer& sample() const { return m_sample; }
59 
60  Fluxes fluxesIn(const R3& k) const;
61  Fluxes fluxesOut(const R3& k) const;
62 
63  //! Fourier transform of the correlation function of roughnesses between the interfaces
64  double crossCorrSpectralFun(R3 kvec, size_t j, size_t k) const;
65 
66 private:
67  reSample(const MultiLayer& sample, bool polarized, std::vector<reLayout>&& layouts,
68  const SliceStack& refined_stack);
70  const bool m_polarized;
71  std::vector<reLayout> m_layouts; // const forbidden by &&-c'tor < needed by tests
73 };
74 
75 #endif // BORNAGAIN_RESAMPLE_PROCESSED_RESAMPLE_H
76 #endif // USER_API
std::vector< std::unique_ptr< const IFlux > > Fluxes
Defines class SliceStack.
Interface to access reflection/transmission coefficients. Realized by ScalarFlux and MatrixFlux.
Definition: IFlux.h:30
A wrapper for underlying material implementation.
Definition: Material.h:35
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:43
Collect the different options for simulation.SimulationOptions.
A stack of Slices.
Definition: SliceStack.h:38
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:31
Data structure that contains preprocessed data for a single layout.
Definition: ReLayout.h:36
Data structure that contains all the necessary data for scattering calculations.
Definition: ReSample.h:41
const Slice & avgeSlice(size_t i) const
Definition: ReSample.cpp:346
size_t numberOfSlices() const
Definition: ReSample.cpp:336
double sliceTopZ(size_t i) const
Definition: ReSample.cpp:356
static reSample make(const MultiLayer &sample, const SimulationOptions &options, bool forcePolarized=false)
Factory method that wraps the private constructor.
Definition: ReSample.cpp:309
double crossCorrSpectralFun(R3 kvec, size_t j, size_t k) const
Fourier transform of the correlation function of roughnesses between the interfaces.
Definition: ReSample.cpp:398
bool hasRoughness() const
Definition: ReSample.cpp:376
bool polarizing() const
Contains magnetic material, or nonzero magnetic field.
Definition: ReSample.cpp:371
const MultiLayer & m_sample
Definition: ReSample.h:69
std::vector< reLayout > m_layouts
Definition: ReSample.h:71
const bool m_polarized
Definition: ReSample.h:70
const std::vector< reLayout > & layouts() const
Definition: ReSample.cpp:351
bool containsMagneticMaterial() const
Definition: ReSample.cpp:366
const SliceStack m_stack
Definition: ReSample.h:72
Fluxes fluxesIn(const R3 &k) const
Definition: ReSample.cpp:384
double sliceBottomZ(size_t i) const
Definition: ReSample.cpp:361
Fluxes fluxesOut(const R3 &k) const
Definition: ReSample.cpp:391
reSample(const reSample &)=delete
const MultiLayer & sample() const
Definition: ReSample.h:58
const SliceStack & averageSlices() const
Definition: ReSample.cpp:341