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< UIDuidSetFromStringContainer (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 > &)
 

Function Documentation

◆ blockDataIDFromString() [1/3]

BlockDataID walberla::python_coupling::blockDataIDFromString ( BlockStorage bs,
const std::string &  stringID 
)

◆ blockDataIDFromString() [2/3]

BlockDataID walberla::python_coupling::blockDataIDFromString ( IBlock block,
const std::string &  stringID 
)

◆ blockDataIDFromString() [3/3]

BlockDataID walberla::python_coupling::blockDataIDFromString ( StructuredBlockStorage bs,
const std::string &  stringID 
)

◆ configBegin()

config::Iterator walberla::python_coupling::configBegin ( int  argc,
char **  argv 
)

◆ configEnd()

config::Iterator walberla::python_coupling::configEnd ( )
inline

◆ createConfig()

shared_ptr< Config > walberla::python_coupling::createConfig ( int  argc,
char **  argv 
)

◆ createConfigFromPythonScript()

shared_ptr< Config > walberla::python_coupling::createConfigFromPythonScript ( const std::string &  ,
const std::string &  ,
const std::vector< std::string > &   
)

◆ createConfigIteratorFromPythonScript()

config::Iterator walberla::python_coupling::createConfigIteratorFromPythonScript ( const std::string &  ,
const std::string &  ,
const std::vector< std::string > &   
)

◆ createSharedPtrFromPythonObject()

template<typename T >
shared_ptr<T> walberla::python_coupling::createSharedPtrFromPythonObject ( boost::python::object  pythonObject)

◆ decodeException()

std::string walberla::python_coupling::decodeException ( )
inline

◆ DictWrapper::has< std::function< void()> >()

template<>
bool walberla::python_coupling::DictWrapper::has< std::function< void()> > ( const std::string &  name)
inline

◆ exportBasicWalberlaDatastructures()

void walberla::python_coupling::exportBasicWalberlaDatastructures ( )

◆ exportMPI()

void walberla::python_coupling::exportMPI ( )

◆ for_each_noncopyable_type()

template<typename Sequence , typename F >
void walberla::python_coupling::for_each_noncopyable_type ( const F &  f)

◆ globalPythonSliceToCellInterval()

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

◆ importModuleOrFile()

void walberla::python_coupling::importModuleOrFile ( const std::string &  ,
const std::vector< std::string > &   
)

◆ initWalberlaForPythonModule()

void walberla::python_coupling::initWalberlaForPythonModule ( )

◆ isCppEqualToPythonType()

template<typename T >
static bool walberla::python_coupling::isCppEqualToPythonType ( PyTypeObject *  obj)
inlinestatic

◆ isCppEqualToPythonType< bool >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< bool > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< double >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< double > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< float >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< float > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< int16_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int16_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< int32_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int32_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< int64_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int64_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< int8_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int8_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< uint16_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint16_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< uint32_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint32_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< uint64_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint64_t > ( PyTypeObject *  o)
inline

◆ isCppEqualToPythonType< uint8_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint8_t > ( PyTypeObject *  o)
inline

◆ isTypeRegisteredInBoostPython()

template<typename T >
bool walberla::python_coupling::isTypeRegisteredInBoostPython ( )

◆ localPythonSliceToCellInterval()

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

◆ maskFromFlagList()

template<typename FField >
FField::value_type walberla::python_coupling::maskFromFlagList ( const shared_ptr< StructuredBlockStorage > &  ,
ConstBlockDataID  ,
const std::vector< std::string > &   
)

◆ pythonIterableToStdVector()

template<typename T >
std::vector< T > walberla::python_coupling::pythonIterableToStdVector ( const boost::python::object &  iterable)
inline

◆ runPythonObject()

void walberla::python_coupling::runPythonObject ( boost::python::object  obj)
inline

◆ terminateOnPythonException()

void walberla::python_coupling::terminateOnPythonException ( const std::string  message)
inline

◆ testBlockData()

template<typename TypeList >
boost::python::object walberla::python_coupling::testBlockData ( IBlock block,
BlockDataID  blockDataID 
)

◆ uidSetFromStringContainer()

template<typename UID , typename StringContainer >
Set< UID > walberla::python_coupling::uidSetFromStringContainer ( const StringContainer &  )