Nektar++
Public Member Functions | Private Attributes | List of all members
CallbackHolderT2 Struct Reference

Helper class for holding a reference to a Python function to act as a wrapper for TimeIntegrationScheme::FunctorType1. More...

Public Member Functions

 CallbackHolderT2 (py::object cb)
 Default constructor. More...
 
void call (TimeIntegrationSchemeOperators::InArrayType &in, TimeIntegrationSchemeOperators::OutArrayType &out, const NekDouble time, const NekDouble lambda)
 C++ callback function to invoke Python function stored in m_cb. More...
 

Private Attributes

py::object m_cb
 Callback defined in Python code. More...
 

Detailed Description

Helper class for holding a reference to a Python function to act as a wrapper for TimeIntegrationScheme::FunctorType1.

This wrapper is used for TimeIntegrationSchemeOperators::DefineImplicitSolve.

Definition at line 98 of file TimeIntegrationSchemeOperators.cpp.

Constructor & Destructor Documentation

◆ CallbackHolderT2()

CallbackHolderT2::CallbackHolderT2 ( py::object  cb)
inline

Default constructor.

Definition at line 101 of file TimeIntegrationSchemeOperators.cpp.

101 : m_cb(cb)
102 {
103 }
py::object m_cb
Callback defined in Python code.

Member Function Documentation

◆ call()

void CallbackHolderT2::call ( TimeIntegrationSchemeOperators::InArrayType in,
TimeIntegrationSchemeOperators::OutArrayType out,
const NekDouble  time,
const NekDouble  lambda 
)
inline

C++ callback function to invoke Python function stored in m_cb.

Definition at line 108 of file TimeIntegrationSchemeOperators.cpp.

111 {
112 py::object ret = m_cb(in, time, lambda);
113
114 py::list outList = py::extract<py::list>(ret);
115
116 for (std::size_t i = 0; i < py::len(outList); ++i)
117 {
118 out[i] = py::extract<Array<OneD, NekDouble>>(outList[i]);
119 }
120 }

References m_cb.

Referenced by TimeIntegrationSchemeOperators_DefineImplicitSolve().

Member Data Documentation

◆ m_cb

py::object CallbackHolderT2::m_cb
private

Callback defined in Python code.

Definition at line 124 of file TimeIntegrationSchemeOperators.cpp.

Referenced by call().