BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ExportToPython.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/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 std::string Py::Export::sampleCode(const MultiLayer& sample)
21 {
22  return SampleToPython().sampleCode(sample);
23 }
24 
25 std::string Py::Export::simulationPlotCode(const ISimulation& simulation)
26 {
27  return SimulationToPython().simulationPlotCode(simulation);
28 }
29 
30 std::string Py::Export::simulationSaveCode(const ISimulation& simulation, const std::string& fname)
31 {
32  return SimulationToPython().simulationSaveCode(simulation, fname);
33 }
Defines ExportToPython namespace.
Defines interface ISimulation.
Defines class SampleToPython.
Defines class SimulationToPython.
Abstract base class, holds the infrastructure to run a simulation.
Definition: ISimulation.h:42
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:43
Generates Python code snippet from domain (C++) objects representing sample construction.
std::string sampleCode(const MultiLayer &sample)
Write a Python script that allows to run the current simulation.
std::string simulationSaveCode(const ISimulation &simulation, const std::string &fname)
Returns a Python script that runs a simulation and saves the result to a file.
std::string simulationPlotCode(const ISimulation &simulation)
Returns a Python script that runs a simulation and plots the result.
std::string sampleCode(const MultiLayer &sample)
std::string simulationSaveCode(const ISimulation &simulation, const std::string &fname)
std::string simulationPlotCode(const ISimulation &simulation)