BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
numericutils.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/utils/numericutils.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_UTILS_NUMERICUTILS_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_UTILS_NUMERICUTILS_H
17 
18 #include "mvvm/model_export.h"
19 
20 namespace ModelView {
21 
22 namespace Utils {
23 
24 //! Returns true if two doubles agree within epsilon*tolerance.
25 MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor = 1.0);
26 
27 //! Produces random integer values uniformly distributed on the closed interval [low, high].
28 MVVM_MODEL_EXPORT int RandInt(int low, int high);
29 
30 //! Produces random FLOAT values uniformly distributed on the interval [low, high).
31 MVVM_MODEL_EXPORT double RandDouble(double low, double high);
32 
33 } // namespace Utils
34 
35 } // namespace ModelView
36 
37 #endif // BORNAGAIN_MVVM_MODEL_MVVM_UTILS_NUMERICUTILS_H
MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor=1.0)
Returns true if two doubles agree within epsilon*tolerance.
MVVM_MODEL_EXPORT double RandDouble(double low, double high)
Produces random FLOAT values uniformly distributed on the interval [low, high).
MVVM_MODEL_EXPORT int RandInt(int low, int high)
Produces random integer values uniformly distributed on the closed interval [low, high].
materialitems.h Collection of materials to populate MaterialModel.