BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ExportToPython.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Export/ExportToPython.cpp
6 //! @brief Implements ExportToPython namespace.
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 
19 
20 namespace
21 {
22 std::string simulationCode(const Simulation& simulation,
23  SimulationToPython::EMainType mainFunctionType)
24 {
25  std::unique_ptr<Simulation> sim(simulation.clone());
26  sim->prepareSimulation();
27 
28  SimulationToPython generator;
29  return generator.generateSimulationCode(*sim, mainFunctionType);
30 }
31 } // namespace
32 
33 std::string ExportToPython::generateSampleCode(const MultiLayer& multilayer)
34 {
35  SampleToPython generator;
36  return generator.generateSampleCode(multilayer);
37 }
38 
39 std::string ExportToPython::generateSimulationCode(const Simulation& simulation)
40 {
42 }
43 
44 std::string ExportToPython::generatePyExportTest(const Simulation& simulation)
45 {
47 }
Defines ExportToPython namespace.
Defines class GISASSimulation.
Defines class SampleToPython.
Defines class SimulationToPython.
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
Generates Python code snippet from domain (C++) objects representing sample construction.
std::string generateSampleCode(const MultiLayer &multilayer)
Write a Python script that allows to run the current simulation.
@ SAVE_DATA
main function saves intensity data
@ RUN_SIMULATION
main function runs simulation
std::string generateSimulationCode(const Simulation &simulation, EMainType mainType)
Returns a Python script that sets up a simulation and runs it if invoked as main program.
Pure virtual base class of OffSpecularSimulation, GISASSimulation and SpecularSimulation.
Definition: Simulation.h:38
virtual Simulation * clone() const =0
std::string generateSimulationCode(const Simulation &simulation)
std::string generatePyExportTest(const Simulation &simulation)
std::string generateSampleCode(const MultiLayer &multilayer)
std::string simulationCode(const Simulation &simulation, SimulationToPython::EMainType mainFunctionType)