SST
13.1.0
Structural Simulation Toolkit
|
Base class for python modules in element libraries. More...
#include <element_python.h>
Public Member Functions | |
SSTElementPythonModule (const std::string &library) | |
Constructor for SSTElementPythonModule. Must be called by derived class. More... | |
virtual void * | load () |
SSTElementPythonModuleCode * | createPrimaryModule (char *code, const std::string &filename) |
Create the top level python module (i.e. More... | |
SSTElementPythonModuleCode * | createPrimaryModule () |
Create and empty top level python module (i.e. More... | |
Protected Attributes | |
std::string | library |
std::string | pylibrary |
std::string | sstlibrary |
char * | primary_module |
std::vector< std::pair< std::string, char * > > | sub_modules |
SSTElementPythonModuleCode * | primary_code_module |
Base class for python modules in element libraries.
Element libraries can include a class derived from this class and create a python module hierarchy.
SST::SSTElementPythonModule::SSTElementPythonModule | ( | const std::string & | library | ) |
Constructor for SSTElementPythonModule. Must be called by derived class.
library | name of the element library the module is part of. Primary module name will be sst.library and submodules under this can also be created. |
SSTElementPythonModuleCode * SST::SSTElementPythonModule::createPrimaryModule | ( | ) |
Create and empty top level python module (i.e.
the one named sst.library)
References SST::Output::fatal(), and SST::Simulation_impl::getSimulationOutput().
SSTElementPythonModuleCode * SST::SSTElementPythonModule::createPrimaryModule | ( | char * | code, |
const std::string & | filename | ||
) |
Create the top level python module (i.e.
the one named sst.library) Python files will need to be turned into a char array (code parameter). One way to do this is to use the following in your Makefile:
%.inc: %.py /// od -v -t x1 < $< | sed -e 's/^[^ ]*[ ]*//g' -e '/^\s*$$/d' -e 's/\([0-9a-f]*\)[ $$]*/0x\1,/g' > $@ ///
code | code to be compiled |
filename | filname used when reporting errors |
References SST::Output::fatal(), and SST::Simulation_impl::getSimulationOutput().