SST  13.0.0
StructuralSimulationToolkit
SST::SSTElementPythonModule Class Reference

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 ()
 
SSTElementPythonModuleCodecreatePrimaryModule (char *code, const std::string &filename)
 Create the top level python module (i.e. More...
 
SSTElementPythonModuleCodecreatePrimaryModule ()
 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
 
SSTElementPythonModuleCodeprimary_code_module
 

Detailed Description

Base class for python modules in element libraries.

Element libraries can include a class derived from this class and create a python module hierarchy.

Constructor & Destructor Documentation

◆ SSTElementPythonModule()

SST::SSTElementPythonModule::SSTElementPythonModule ( const std::string &  library)

Constructor for SSTElementPythonModule. Must be called by derived class.

Parameters
libraryname of the element library the module is part of. Primary module name will be sst.library and submodules under this can also be created.

Member Function Documentation

◆ createPrimaryModule() [1/2]

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' > $@
///         
Parameters
codecode to be compiled
filenamefilname used when reporting errors

References SST::Output::fatal(), and SST::Simulation_impl::getSimulationOutput().

◆ createPrimaryModule() [2/2]

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().


The documentation for this class was generated from the following files: