BornAgain  1.18.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 scattering at grazing incidence
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 #ifndef BORNAGAIN_CORE_MULTILAYER_LAYERFILLLIMITS_H
16 #define BORNAGAIN_CORE_MULTILAYER_LAYERFILLLIMITS_H
17 
19 #include <cstddef>
20 #include <utility>
21 #include <vector>
22 
23 //! Helper class for the graded layer approximation. Generates limits for each layer, indicating
24 //! the region of the layer (along z) that contains particle(s)
25 //!
26 //! The constructor takes the bottom layer z-coordinates as parameter. This means that for N
27 //! layers, only N-1 coordinates need to be passed (the last layer is assumed to be semi-infinite).
28 //! @ingroup algorithms_internal
29 
31 {
32 public:
33  LayerFillLimits(std::vector<double> layers_bottomz);
34 
35  //! Particle limits are given in global coordinates
36  void update(ParticleLimits particle_limits, double offset = 0.0);
37 
38  //! Returns the filled region limits for each layer (in local layer coordinates)
39  std::vector<ZLimits> layerZLimits() const;
40 
41 private:
42  size_t layerIndexTop(double top_z) const;
43  size_t layerIndexBottom(double bottom_z) const;
44  void updateLayerLimits(size_t i_layer, ZLimits limits);
45  std::vector<double> m_layers_bottomz;
46  std::vector<ZLimits> m_layer_fill_limits;
47 };
48 
49 #endif // BORNAGAIN_CORE_MULTILAYER_LAYERFILLLIMITS_H
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:41
Vertical extension of a particle, specified by bottom and top z coordinate.
Definition: ZLimits.h:21