SST
9.1.0
StructuralSimulationToolkit
|
Base class for python modules in element libraries. More...
#include <element_python.h>
Public Member Functions | |
SSTElementPythonModule (std::string library) | |
Constructor for SSTElementPythonModule. Must be called by derived class. More... | |
void | addPrimaryModule (char *file) |
void | addSubModule (std::string name, char *file) |
virtual void * | load () |
SSTElementPythonModuleCode * | createPrimaryModule (char *code=NULL, std::string filename="") |
Create the 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 | ( | 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 | ( | char * | code = NULL , |
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::getSimulationOutput().