BornAgain  1.19.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 reflection and scattering
4 //
5 //! @file Core/Export/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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_CORE_EXPORT_PYFMT_H
21 #define BORNAGAIN_CORE_EXPORT_PYFMT_H
22 
23 #include "Base/Vector/Vectors3D.h"
24 #include <string>
25 
26 //! Utility functions for writing Python code snippets.
27 
28 namespace pyfmt {
29 
30 std::string printImportedSymbols(const std::string& code);
31 
32 std::string printInt(int value);
33 std::string printBool(double value);
34 std::string printDouble(double input);
35 std::string printLightDouble(double input);
36 std::string printNm(double input);
37 std::string printNm2(double input);
38 std::string printScientificDouble(double input);
39 std::string printDegrees(double input);
40 std::string printValue(double value, const std::string& units = "");
41 std::string printString(const std::string& value);
42 
43 bool isSquare(double length1, double length2, double angle);
44 bool isHexagonal(double length1, double length2, double angle);
45 std::string printKvector(const kvector_t value);
46 
47 //! Returns a string of blanks with given width. By default
48 //! the width equals standard offset in python files.
49 std::string indent(size_t width = 4u);
50 
51 } // namespace pyfmt
52 
53 #endif // BORNAGAIN_CORE_EXPORT_PYFMT_H
54 #endif // USER_API
Defines basic vectors in Z^3, R^3, C^3.
Utility functions for writing Python code snippets.
Definition: PyFmt.cpp:22
std::string printNm(double input)
Definition: PyFmt.cpp:74
std::string printNm2(double input)
Definition: PyFmt.cpp:82
std::string printDegrees(double input)
Definition: PyFmt.cpp:111
bool isSquare(double length1, double length2, double angle)
Definition: PyFmt.cpp:137
std::string printDouble(double input)
Definition: PyFmt.cpp:41
std::string printKvector(const kvector_t value)
Definition: PyFmt.cpp:147
std::string printScientificDouble(double input)
Definition: PyFmt.cpp:91
std::string printBool(double value)
Definition: PyFmt.cpp:36
std::string printImportedSymbols(const std::string &code)
Definition: PyFmt.cpp:24
std::string printLightDouble(double input)
prints double as an integer, if possible within standard accuracy
Definition: PyFmt.cpp:56
std::string printString(const std::string &value)
Definition: PyFmt.cpp:130
std::string printInt(int value)
std::string indent(size_t width)
Returns a string of blanks with given width.
Definition: PyFmt.cpp:155
bool isHexagonal(double length1, double length2, double angle)
Definition: PyFmt.cpp:142
std::string printValue(double value, const std::string &units)
Definition: PyFmt.cpp:118