walberla::python_coupling Namespace Reference

Namespaces

 internal
 

Classes

struct  BlockDataNotConvertible
 
class  BlockDataToObjectTester
 
struct  combine_vectors
 
class  DictWrapper
 
class  Dispatcher
 
struct  list_of_pairs
 
class  Manager
 
class  ModuleScope
 
struct  NonCopyableWrap
 
struct  NoSuchBlockData
 
class  PythonCallback
 Run a Python function from C++ code. More...
 
class  Shell
 
class  TimeloopIntercept
 

Functions

void exportBasicWalberlaDatastructures ()
 
void exportMPI ()
 
void runPythonObject (boost::python::object obj)
 
template<>
bool DictWrapper::has< std::function< void()> > (const std::string &name)
 
BlockDataID blockDataIDFromString (BlockStorage &bs, const std::string &stringID)
 
BlockDataID blockDataIDFromString (IBlock &block, const std::string &stringID)
 
BlockDataID blockDataIDFromString (StructuredBlockStorage &bs, const std::string &stringID)
 
template<typename UID , typename StringContainer >
Set< UID > uidSetFromStringContainer (const StringContainer &)
 
template<typename FField >
FField::value_type maskFromFlagList (const shared_ptr< StructuredBlockStorage > &, ConstBlockDataID, const std::vector< std::string > &)
 
template<typename T >
static bool isCppEqualToPythonType (PyTypeObject *obj)
 
template<>
bool isCppEqualToPythonType< bool > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< float > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< double > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< uint8_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< uint16_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< uint32_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< uint64_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< int8_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< int16_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< int32_t > (PyTypeObject *o)
 
template<>
bool isCppEqualToPythonType< int64_t > (PyTypeObject *o)
 
template<typename T >
bool isTypeRegisteredInBoostPython ()
 
std::string decodeException ()
 
void terminateOnPythonException (const std::string message)
 
void initWalberlaForPythonModule ()
 
template<typename Sequence , typename F >
void for_each_noncopyable_type (const F &f)
 
template<typename T >
std::vector< T > pythonIterableToStdVector (const boost::python::object &iterable)
 
template<typename T >
shared_ptr< T > createSharedPtrFromPythonObject (boost::python::object pythonObject)
 
CellInterval globalPythonSliceToCellInterval (const shared_ptr< StructuredBlockStorage > &blocks, boost::python::tuple indexTuple)
 Creates a CellInterval as subset from the complete domain-cell-bounding-box based on a Python slice. More...
 
template<typename Field_T >
CellInterval localPythonSliceToCellInterval (const Field_T &field, boost::python::tuple indexTuple)
 Creates a CellInterval based on a Python Slice as subset of a field. More...
 
template<typename TypeList >
boost::python::object testBlockData (IBlock &block, BlockDataID blockDataID)
 
void importModuleOrFile (const std::string &, const std::vector< std::string > &)
 
Functions to load config directly from script
shared_ptr< Config > createConfigFromPythonScript (const std::string &, const std::string &, const std::vector< std::string > &)
 
config::Iterator createConfigIteratorFromPythonScript (const std::string &, const std::string &, const std::vector< std::string > &)
 
General Functions - fallback to non-python
shared_ptr< Config > createConfig (int argc, char **argv)
 
config::Iterator configBegin (int argc, char **argv)
 
config::Iterator configEnd ()
 

Function Documentation

BlockDataID walberla::python_coupling::blockDataIDFromString ( BlockStorage &  bs,
const std::string &  stringID 
)
BlockDataID walberla::python_coupling::blockDataIDFromString ( IBlock &  block,
const std::string &  stringID 
)
BlockDataID walberla::python_coupling::blockDataIDFromString ( StructuredBlockStorage &  bs,
const std::string &  stringID 
)
config::Iterator walberla::python_coupling::configBegin ( int  argc,
char **  argv 
)
config::Iterator walberla::python_coupling::configEnd ( )
inline
shared_ptr< Config > walberla::python_coupling::createConfig ( int  argc,
char **  argv 
)
shared_ptr< Config > walberla::python_coupling::createConfigFromPythonScript ( const std::string &  ,
const std::string &  ,
const std::vector< std::string > &   
)
config::Iterator walberla::python_coupling::createConfigIteratorFromPythonScript ( const std::string &  ,
const std::string &  ,
const std::vector< std::string > &   
)
template<typename T >
shared_ptr<T> walberla::python_coupling::createSharedPtrFromPythonObject ( boost::python::object  pythonObject)
std::string walberla::python_coupling::decodeException ( )
inline
template<>
bool walberla::python_coupling::DictWrapper::has< std::function< void()> > ( const std::string &  name)
inline
void walberla::python_coupling::exportBasicWalberlaDatastructures ( )
void walberla::python_coupling::exportMPI ( )
template<typename Sequence , typename F >
void walberla::python_coupling::for_each_noncopyable_type ( const F &  f)
CellInterval walberla::python_coupling::globalPythonSliceToCellInterval ( const shared_ptr< StructuredBlockStorage > &  blocks,
boost::python::tuple  indexTuple 
)
inline

Creates a CellInterval as subset from the complete domain-cell-bounding-box based on a Python slice.

Example: Python Slice: [ :, 3, -1 ] and a domain size of ( 3,4,5 )

  • x coordinate is the complete valid x-range indicated by the semicolon: i.e. [0,3)
  • y coordinate is just a normal index i.e. the range from [3,4)
  • z coordiante is the first valid coordinate from the back [4,5)

Python slices are tuples with slice classes as entry. Each slice has start, stop and step. Steps are not supported since they can not be encoded in a CellInterval

void walberla::python_coupling::importModuleOrFile ( const std::string &  ,
const std::vector< std::string > &   
)
void walberla::python_coupling::initWalberlaForPythonModule ( )
template<typename T >
static bool walberla::python_coupling::isCppEqualToPythonType ( PyTypeObject *  obj)
inlinestatic
template<>
bool walberla::python_coupling::isCppEqualToPythonType< bool > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< double > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< float > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< int16_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< int32_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< int64_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< int8_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint16_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint32_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint64_t > ( PyTypeObject *  o)
inline
template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint8_t > ( PyTypeObject *  o)
inline
template<typename T >
bool walberla::python_coupling::isTypeRegisteredInBoostPython ( )
template<typename Field_T >
CellInterval walberla::python_coupling::localPythonSliceToCellInterval ( const Field_T &  field,
boost::python::tuple  indexTuple 
)

Creates a CellInterval based on a Python Slice as subset of a field.

Similar to globalPythonSliceToCellInterval() with the following additional features:

  • slice may have a forth component: [ :, 3, -1, 'g' ] with the only valid entry 'g' for ghost layers
  • if this ghost layer marker is present, coordinate 0 addresses the outermost ghost layer, otherwise the first inner cell is addressed
template<typename FField >
FField::value_type walberla::python_coupling::maskFromFlagList ( const shared_ptr< StructuredBlockStorage > &  ,
ConstBlockDataID  ,
const std::vector< std::string > &   
)
template<typename T >
std::vector< T > walberla::python_coupling::pythonIterableToStdVector ( const boost::python::object &  iterable)
inline
void walberla::python_coupling::runPythonObject ( boost::python::object  obj)
inline
void walberla::python_coupling::terminateOnPythonException ( const std::string  message)
inline
template<typename TypeList >
boost::python::object walberla::python_coupling::testBlockData ( IBlock &  block,
BlockDataID  blockDataID 
)
template<typename UID , typename StringContainer >
Set< UID > walberla::python_coupling::uidSetFromStringContainer ( const StringContainer &  )