14 #include <boost/mpl/placeholders.hpp>
29 template <
class WrappedT>
58 return m_extractIndex;
65 if (m_extractIndex < 0)
67 boost::python::extract<T &> extractor(m_pyOb);
68 if (extractor.check())
70 m_extractIndex = m_currIndex;
84 template <
class TmplLsmParticle>
91 m_pPyListVector(&pyListVector)
98 ++(this->m_currIndex);
101 TRefIterator it((*m_pPyListVector)[m_currIndex]);
102 this->m_pLm->template addParticles<TRefIterator,TmplLsmParticle>(it);
111 template <
class TmplMplVector,
class TmplLsmParticle>
113 boost::python::object &iterable,
117 PyObjectIterator it(iterable);
118 const size_t numTypes = boost::mpl::size<MplVector>::type::value;
119 PyListVector pyListVector;
120 pyListVector.reserve(numTypes);
121 for (
size_t i = 0; i < numTypes; i++)
123 pyListVector.push_back(boost::python::list());
127 boost::python::object pyOb = it.
next();
129 boost::mpl::for_each<MplVector, Wrap<boost::mpl::placeholders::_1> >(
138 throw std::runtime_error(
139 boost::python::extract<std::string>(
140 std::string(
"Could not extract C++ type from python object:")
142 boost::python::str(pyOb)
147 boost::mpl::for_each<MplVector, Wrap<boost::mpl::placeholders::_1> >(
LmAdder<LsmParticle>(lm, pyListVector));
int m_currIndex
Definition: LmParticleAdder.hpp:106
Definition: LmParticleAdder.hpp:30
PyListVector * m_pPyListVector
Definition: LmParticleAdder.hpp:108
Definition: LmParticleAdder.hpp:85
Definition: CheckPointable.cpp:16
void operator()(Wrap< T > wrappedT)
Definition: LmParticleAdder.hpp:38
Definition: PythonIterIterator.h:27
std::vector< boost::python::list > PyListVector
Definition: LmParticleAdder.hpp:82
WrappedT * m_p
Definition: LmParticleAdder.hpp:43
LmAdder(CLatticeMaster &lm, PyListVector &pyListVector)
Definition: LmParticleAdder.hpp:88
PtrWrap(WrappedT &t)
Definition: LmParticleAdder.hpp:33
bool hasNext() const
Definition: PythonIterIterator.hpp:32
CLatticeMaster * m_pLm
Definition: LmParticleAdder.hpp:107
Definition: LatticeMaster.h:117
void operator()(Wrap< T >)
Definition: LmParticleAdder.hpp:96
Definition: LmParticleAdder.hpp:25
Definition: LmParticleAdder.h:26
value_type next()
Definition: PythonIterIterator.hpp:38
bpu::PythonIterIterator< boost::python::object > PyObjectIterator
Definition: LmParticleAdder.hpp:81