"README.md" did not exist on "48464bcf4f4f6880983ecb2e6ecdabc52d529174"
Newer
Older
/*
* adiosPyFunctions.cpp
*
* Created on: Mar 13, 2017
* Author: wfg
*/
#include <iostream>
#include "adiosPyFunctions.h"
namespace adios
{
#ifdef HAVE_BOOSTPYTHON
namespace py = boost::python;
using pyCastString = py::extract<std::string>;
using pyCastSize_t = py::extract<std::size_t>;
#endif
#ifdef HAVE_PYBIND11
namespace py = pybind11;
using pyCastString = pybind11::cast<std::string>;
using pyCastSize_t = pybind11::cast<std::size_t>;
#endif
Dims ListToVector( const pyList& list )
const unsigned int length = py::len( list );
vec.reserve( length );
for( unsigned int i=0; i<length;i++ )
vec.push_back( pyCastSize_t( list[i]) );
std::map<std::string, std::string> DictToMap( const pyDict& dictionary )
pyList keys = dictionary.keys();
const unsigned int length = py::len( keys );
std::map<std::string, std::string> parameters;
for( unsigned int k = 0; k < length; ++k )
const std::string key( pyCastString( keys[k] ) );
const std::string value( pyCastString( dictionary[ keys[k] ] ) );
parameters.insert( std::make_pair( key, value ) );
dtype DType( const pyArray& array )
{
#ifdef HAVE_BOOSTPYTHON
return array.get_dtype();
#endif
#ifdef HAVE_PYBIND11
return array.dtype();
#endif
}