Nektar++
Functions
Python/SessionFunction.cpp File Reference
#include <FieldUtils/Interpolator.h>
#include <LibUtilities/Python/BasicUtils/SharedArray.hpp>
#include <LibUtilities/Python/NekPyConfig.hpp>
#include <SolverUtils/Core/SessionFunction.h>

Go to the source code of this file.

Functions

std::shared_ptr< SessionFunctionSessionFunction_Init (const LibUtilities::SessionReaderSharedPtr session, const MultiRegions::ExpListSharedPtr field, std::string functionName)
 
std::string SessionFunction_Describe (std::shared_ptr< SessionFunction > func, std::string fieldName)
 
Array< OneD, MultiRegions::ExpListSharedPtrSessionFunction_Evaluate_ExpList (std::shared_ptr< SessionFunction > func, std::vector< std::string > fieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > explists, NekDouble time)
 
Array< OneD, MultiRegions::ExpListSharedPtrSessionFunction_Evaluate (std::shared_ptr< SessionFunction > func, py::list fieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > explists, NekDouble time)
 
Array< OneD, MultiRegions::ExpListSharedPtrSessionFunction_Evaluate1 (std::shared_ptr< SessionFunction > func, py::list fieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > explists)
 
void export_SessionFunction (py::module &m)
 

Function Documentation

◆ export_SessionFunction()

void export_SessionFunction ( py::module &  m)

Definition at line 93 of file Python/SessionFunction.cpp.

94{
95 py::class_<SessionFunction, std::shared_ptr<SessionFunction>>(
96 m, "SessionFunction")
97 .def(py::init<>(&SessionFunction_Init))
98 .def("Describe", &SessionFunction_Describe)
99 .def("Evaluate", &SessionFunction_Evaluate)
100 .def("Evaluate", &SessionFunction_Evaluate1);
101}
std::string SessionFunction_Describe(std::shared_ptr< SessionFunction > func, std::string fieldName)
Array< OneD, MultiRegions::ExpListSharedPtr > SessionFunction_Evaluate1(std::shared_ptr< SessionFunction > func, py::list fieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > explists)
std::shared_ptr< SessionFunction > SessionFunction_Init(const LibUtilities::SessionReaderSharedPtr session, const MultiRegions::ExpListSharedPtr field, std::string functionName)
Array< OneD, MultiRegions::ExpListSharedPtr > SessionFunction_Evaluate(std::shared_ptr< SessionFunction > func, py::list fieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > explists, NekDouble time)

References SessionFunction_Describe(), SessionFunction_Evaluate(), SessionFunction_Evaluate1(), and SessionFunction_Init().

Referenced by PYBIND11_MODULE().

◆ SessionFunction_Describe()

std::string SessionFunction_Describe ( std::shared_ptr< SessionFunction func,
std::string  fieldName 
)

Definition at line 51 of file Python/SessionFunction.cpp.

53{
54 return func->Describe(fieldName);
55}

Referenced by export_SessionFunction().

◆ SessionFunction_Evaluate()

Array< OneD, MultiRegions::ExpListSharedPtr > SessionFunction_Evaluate ( std::shared_ptr< SessionFunction func,
py::list  fieldNames,
Array< OneD, MultiRegions::ExpListSharedPtr explists,
NekDouble  time 
)

Definition at line 65 of file Python/SessionFunction.cpp.

68{
69 std::vector<std::string> fields(py::len(fieldNames));
70
71 for (std::size_t i = 0; i < py::len(fieldNames); ++i)
72 {
73 fields[i] = py::cast<std::string>(fieldNames[i]);
74 }
75
76 if (explists.size() == 0)
77 {
78 throw new ErrorUtil::NekError("List of fields is empty");
79 }
80
81 // Check first entry in list to guess which version of this function needs
82 // to be called.
83 return SessionFunction_Evaluate_ExpList(func, fields, explists, time);
84}
Nektar::ErrorUtil::NekError NekError
Array< OneD, MultiRegions::ExpListSharedPtr > SessionFunction_Evaluate_ExpList(std::shared_ptr< SessionFunction > func, std::vector< std::string > fieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > explists, NekDouble time)

References SessionFunction_Evaluate_ExpList().

Referenced by export_SessionFunction(), and SessionFunction_Evaluate1().

◆ SessionFunction_Evaluate1()

Array< OneD, MultiRegions::ExpListSharedPtr > SessionFunction_Evaluate1 ( std::shared_ptr< SessionFunction func,
py::list  fieldNames,
Array< OneD, MultiRegions::ExpListSharedPtr explists 
)

Definition at line 86 of file Python/SessionFunction.cpp.

89{
90 return SessionFunction_Evaluate(func, fieldNames, explists, 0.0);
91}

References SessionFunction_Evaluate().

Referenced by export_SessionFunction().

◆ SessionFunction_Evaluate_ExpList()

Array< OneD, MultiRegions::ExpListSharedPtr > SessionFunction_Evaluate_ExpList ( std::shared_ptr< SessionFunction func,
std::vector< std::string >  fieldNames,
Array< OneD, MultiRegions::ExpListSharedPtr explists,
NekDouble  time 
)

Definition at line 57 of file Python/SessionFunction.cpp.

60{
61 func->Evaluate(fieldNames, explists, time);
62 return explists;
63}

Referenced by SessionFunction_Evaluate().

◆ SessionFunction_Init()

std::shared_ptr< SessionFunction > SessionFunction_Init ( const LibUtilities::SessionReaderSharedPtr  session,
const MultiRegions::ExpListSharedPtr  field,
std::string  functionName 
)

Definition at line 43 of file Python/SessionFunction.cpp.

46{
48 functionName);
49}
General purpose memory allocation routines with the ability to allocate from thread specific memory p...

References FilterPython_Function::field.

Referenced by export_SessionFunction().