BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
PyFmt.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Base/Utils/PyFmt.h
6 //! @brief Defines functions in namespace pyfmt.
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_PARAMETRIZATION_PYFMT_H
16 #define BORNAGAIN_CORE_PARAMETRIZATION_PYFMT_H
17 
18 #include "Base/Vector/Vectors3D.h"
19 #include <string>
20 
21 class RealLimits;
22 
23 //! Utility functions for writing Python code snippets.
24 
25 namespace pyfmt
26 {
27 
28 std::string scriptPreamble();
29 std::string getSampleFunctionName();
30 
31 std::string printInt(int value);
32 std::string printBool(double value);
33 std::string printDouble(double input);
34 std::string printNm(double input);
35 std::string printNm2(double input);
36 std::string printScientificDouble(double input);
37 std::string printDegrees(double input);
38 std::string printValue(double value, const std::string& units = "");
39 std::string printString(const std::string& value);
40 
41 bool isSquare(double length1, double length2, double angle);
42 bool isHexagonal(double length1, double length2, double angle);
43 std::string printKvector(const kvector_t value);
44 
45 //! Returns a string of blanks with given width. By default
46 //! the width equals standard offset in python files.
47 std::string indent(size_t width = 4u);
48 
49 } // namespace pyfmt
50 
51 #endif // BORNAGAIN_CORE_PARAMETRIZATION_PYFMT_H
Defines basic vectors in R^3 and C^3.
Limits for a real fit parameter.
Definition: RealLimits.h:25
Utility functions for writing Python code snippets.
Definition: PyFmt.cpp:22
std::string printNm(double input)
Definition: PyFmt.cpp:57
std::string getSampleFunctionName()
Definition: PyFmt.cpp:33
std::string printNm2(double input)
Definition: PyFmt.cpp:65
std::string printDegrees(double input)
Definition: PyFmt.cpp:94
bool isSquare(double length1, double length2, double angle)
Definition: PyFmt.cpp:123
std::string printDouble(double input)
Definition: PyFmt.cpp:43
std::string printKvector(const kvector_t value)
Definition: PyFmt.cpp:133
std::string printScientificDouble(double input)
Definition: PyFmt.cpp:74
std::string printBool(double value)
Definition: PyFmt.cpp:38
std::string printString(const std::string &value)
Definition: PyFmt.cpp:116
std::string printInt(int value)
std::string indent(size_t width)
Returns a string of blanks with given width.
Definition: PyFmt.cpp:141
bool isHexagonal(double length1, double length2, double angle)
Definition: PyFmt.cpp:128
std::string printValue(double value, const std::string &units)
Definition: PyFmt.cpp:104
std::string scriptPreamble()
Definition: PyFmt.cpp:24