waLBerla 7.3
Loading...
Searching...
No Matches
walberla::python_coupling Namespace Reference

Namespaces

namespace  detail
namespace  internal

Classes

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

Functions

void runPythonObject (py::object obj)
template<>
bool DictWrapper::has< std::function< void()> > (const char *name)
void exportBasicWalberlaDatastructures (py::module_ &m)
void exportMPI (py::module_ &m)
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 > &)
void initWalberlaForPythonModule ()
template<typename F>
void for_each_noncopyable_type (const F &)
template<typename Type, typename... Types, typename F>
void for_each_noncopyable_type (const F &f)
template<py::return_value_policy Policy = py::return_value_policy::reference_internal, typename T>
py::iterator make_owning_iterator (T obj)
template<typename T>
static bool isCppEqualToPythonType (std::string n)
template<>
bool isCppEqualToPythonType< float > (std::string n)
template<>
bool isCppEqualToPythonType< double > (std::string n)
template<>
bool isCppEqualToPythonType< uint8_t > (std::string n)
template<>
bool isCppEqualToPythonType< uint16_t > (std::string n)
template<>
bool isCppEqualToPythonType< uint32_t > (std::string n)
template<>
bool isCppEqualToPythonType< uint64_t > (std::string n)
template<>
bool isCppEqualToPythonType< int8_t > (std::string n)
template<>
bool isCppEqualToPythonType< int16_t > (std::string n)
template<>
bool isCppEqualToPythonType< int32_t > (std::string n)
template<>
bool isCppEqualToPythonType< int64_t > (std::string n)
template<typename T>
std::vector< T > pythonIterableToStdVector (const py::object &iterable)
CellInterval globalPythonSliceToCellInterval (const shared_ptr< StructuredBlockStorage > &blocks, py::tuple indexTuple)
 Creates a CellInterval as subset from the complete domain-cell-bounding-box based on a Python slice.
template<typename... Types>
py::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< ConfigcreateConfigFromPythonScript (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< ConfigcreateConfig (int argc, char **argv)
config::Iterator configBegin (int argc, char **argv)
config::Iterator configEnd ()

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

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

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

◆ exportBasicWalberlaDatastructures()

void walberla::python_coupling::exportBasicWalberlaDatastructures ( py::module_ & m)

◆ exportMPI()

void walberla::python_coupling::exportMPI ( py::module_ & m)

◆ for_each_noncopyable_type() [1/2]

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

◆ for_each_noncopyable_type() [2/2]

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

◆ globalPythonSliceToCellInterval()

CellInterval walberla::python_coupling::globalPythonSliceToCellInterval ( const shared_ptr< StructuredBlockStorage > & blocks,
py::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 coordinate 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>
bool walberla::python_coupling::isCppEqualToPythonType ( std::string n)
inlinestatic

◆ isCppEqualToPythonType< double >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< double > ( std::string n)
inline

◆ isCppEqualToPythonType< float >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< float > ( std::string n)
inline

◆ isCppEqualToPythonType< int16_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int16_t > ( std::string n)
inline

◆ isCppEqualToPythonType< int32_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int32_t > ( std::string n)
inline

◆ isCppEqualToPythonType< int64_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int64_t > ( std::string n)
inline

◆ isCppEqualToPythonType< int8_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< int8_t > ( std::string n)
inline

◆ isCppEqualToPythonType< uint16_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint16_t > ( std::string n)
inline

◆ isCppEqualToPythonType< uint32_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint32_t > ( std::string n)
inline

◆ isCppEqualToPythonType< uint64_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint64_t > ( std::string n)
inline

◆ isCppEqualToPythonType< uint8_t >()

template<>
bool walberla::python_coupling::isCppEqualToPythonType< uint8_t > ( std::string n)
inline

◆ make_owning_iterator()

template<py::return_value_policy Policy = py::return_value_policy::reference_internal, typename T>
py::iterator walberla::python_coupling::make_owning_iterator ( T obj)

◆ 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 py::object & iterable)
inline

◆ runPythonObject()

void walberla::python_coupling::runPythonObject ( py::object obj)
inline

◆ testBlockData()

template<typename... Types>
py::object walberla::python_coupling::testBlockData ( IBlock & block,
BlockDataID blockDataID )

◆ uidSetFromStringContainer()

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