BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
LayerFillLimits.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Scattering/LayerFillLimits.h
6 //! @brief Defines class LayerFillLimits.
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_SCATTERING_LAYERFILLLIMITS_H
21 #define BORNAGAIN_SAMPLE_SCATTERING_LAYERFILLLIMITS_H
22 
24 #include <cstddef>
25 #include <utility>
26 #include <vector>
27 
28 //! Helper class for the graded layer approximation. Generates limits for each layer, indicating
29 //! the region of the layer (along z) that contains particle(s)
30 //!
31 //! The constructor takes the bottom layer z-coordinates as parameter. This means that for N
32 //! layers, only N-1 coordinates need to be passed (the last layer is assumed to be semi-infinite).
33 //! @ingroup algorithms_internal
34 
36 public:
37  LayerFillLimits(std::vector<double> layers_bottomz);
38 
39  //! Particle limits are given in global coordinates
40  void update(ParticleLimits particle_limits, double offset = 0.0);
41 
42  //! Returns the filled region limits for each layer (in local layer coordinates)
43  std::vector<ZLimits> layerZLimits() const;
44 
45 private:
46  size_t layerIndexTop(double top_z) const;
47  size_t layerIndexBottom(double bottom_z) const;
48  void updateLayerLimits(size_t i_layer, ZLimits limits);
49  std::vector<double> m_layers_bottomz;
50  std::vector<ZLimits> m_layer_fill_limits;
51 };
52 
53 #endif // BORNAGAIN_SAMPLE_SCATTERING_LAYERFILLLIMITS_H
54 #endif // USER_API
Defines class ZLimits.
Helper class for the graded layer approximation.
LayerFillLimits(std::vector< double > layers_bottomz)
std::vector< ZLimits > m_layer_fill_limits
std::vector< ZLimits > layerZLimits() const
Returns the filled region limits for each layer (in local layer coordinates)
std::vector< double > m_layers_bottomz
void updateLayerLimits(size_t i_layer, ZLimits limits)
void update(ParticleLimits particle_limits, double offset=0.0)
Particle limits are given in global coordinates.
size_t layerIndexTop(double top_z) const
size_t layerIndexBottom(double bottom_z) const
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:45
Vertical extension of a particle, specified by bottom and top z coordinate.
Definition: ZLimits.h:26