Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
common.hh File Reference

Go to the source code of this file.

Classes

struct  Python::Conversion< T >
 Conversion of C type T from and to PyObject*. More...
 

Namespaces

namespace  Python
 

Functions

bool Python::isModule (const Reference &ref)
 Check if python object is a module.
 
void Python::start ()
 Start embedded python interpreter.
 
void Python::stop ()
 Stop embedded python interpreter.
 
Module Python::import (const std::string &moduleName)
 Import python module given by name.
 
Module Python::createModule (const std::string &moduleName)
 Create python module given by name.
 
Module Python::main ()
 Obtain the main module.
 
void Python::run (const std::string &code)
 Run python code given as string.
 
void Python::run (const std::string &code, Reference &module)
 Run python code given as string in specified module.
 
Module::AutoRunCodeStream Python::runStream ()
 Obtain a stream to feed the code with multiple lines of python code.
 
Module::AutoRunCodeStream Python::runStream (Module module)
 Obtain a stream to feed the code with multiple lines of python code for execution in specified module.
 
void Python::runFile (const std::string &fileName)
 Run python code in file given by name.
 
void Python::runFile (const std::string &fileName, Module module)
 Run python code in file given by name in specified module.
 
Reference Python::evaluate (const std::string &expression)
 Evaluate python expression given as string.
 
Reference Python::evaluate (const std::string &expression, Module module)
 
template<class T >
Reference Python::makeObject (const T &t)
 Create python object from C++ object.
 
template<typename... Ts>
Reference Python::makeTuple (const Ts &... ts)
 create a Python tuple
 
template<typename... Ts>
Reference Python::tuple (const Ts &... ts)
 
Reference Python::dict ()
 Create an empty Python tuple.
 
int Python::size (const Reference &s)
 Get size of a python sequence.
 
Reference Python::iter (const Reference &seq)
 Get iterator of iterable object.
 
Reference Python::next (const Reference &iter)
 Get next item from iterator.
 
Reference Python::getItem (const Reference &seq, int i)
 Get item of sequence.
 
Reference Python::getItem (const Reference &dict, const Reference &k)
 Get item of dictionary.
 
template<class V >
void Python::setItem (Reference &seq, int i, const V &v)
 Set item of sequence.
 
template<class K , class V >
void Python::setItem (Reference &dict, const K &k, const V &v)
 Set item of dictionary.
 
bool Python::isSequence (const Reference &ref)
 Check if python object is some sequence.
 
bool Python::isDict (const Reference &ref)
 Check if python object is a dictionary.
 
bool Python::isCallable (const Reference &ref)
 Check if python object is callable.
 
Reference Python::keys (const Reference &dict)
 Get keys of python dictionary.
 
template<class Signature , template< class > class DerivativeTraits = Dune::Functions::DefaultDerivativeTraits>
auto Python::makeFunction (const Reference &f)
 Create a callable function for given signature.
 
template<class Signature , template< class > class DerivativeTraits = Dune::Functions::DefaultDerivativeTraits, class... R>
auto Python::makeDifferentiableFunction (const R &... f)
 Create a callable differentiable function for given signature.
 
void Python::handlePythonError (const std::string &origin, const std::string &message)
 If a python error occurred throw an exception and clear python error indicator.