Nektar++
Functions
SolverUtils.cpp File Reference
#include <LibUtilities/Python/NekPyConfig.hpp>

Go to the source code of this file.

Functions

void export_EquationSystem (py::module &m)
 
void export_Filter (py::module &m)
 
void export_SessionFunction (py::module &m)
 
void export_UnsteadySystem (py::module &m)
 
 PYBIND11_MODULE (_SolverUtils, m)
 

Function Documentation

◆ export_EquationSystem()

void export_EquationSystem ( py::module &  m)

Definition at line 149 of file Python/EquationSystem.cpp.

150{
151 using EqSysWrap = EquationSystemWrap<EquationSystem>;
153
156
157 py::classh<EquationSystem, EqSysWrap>(m, "EquationSystem")
160
161 // Virtual functions that can be optionally overridden
162 .def("InitObject", &EqSysPub::v_InitObject)
163 .def("DoInitialise", &EqSysPub::v_DoInitialise)
164 .def("DoSolve", &EqSysPub::v_DoSolve)
165 .def("SetInitialConditions", &EqSysPub::v_SetInitialConditions)
166 .def("EvaluateExactSolution", &EqSysWrap::EvaluateExactSolution)
167 .def("LinfError", &EqSysWrap::LinfError)
168 .def("L2Error", &EqSysWrap::L2Error)
169
170 // Fields accessors (read-only)
171 .def("GetFields", &EquationSystem_GetFields)
172 .def_property_readonly("fields", &EquationSystem_GetFields)
173
174 // Various utility functions
175 .def("GetNvariables", &EquationSystem::GetNvariables)
176 .def("GetVariable", &EquationSystem::GetVariable)
177 .def("GetNpoints", &EquationSystem::GetNpoints)
178 .def("SetInitialStep", &EquationSystem::SetInitialStep)
179 .def("ZeroPhysFields", &EquationSystem::ZeroPhysFields)
180
181 // Time accessors/properties
182 .def("GetTime", &EquationSystem::GetTime)
183 .def("SetTime", &EquationSystem::SetTime)
184 .def_property("time", &EquationSystem::GetTime,
185 &EquationSystem::SetTime)
186
187 // Timestep accessors/properties
188 .def("GetTimeStep", &EquationSystem::GetTimeStep)
189 .def("SetTimeStep", &EquationSystem::SetTimeStep)
190 .def_property("timestep", &EquationSystem::GetTimeStep,
191 &EquationSystem::SetTimeStep)
192
193 // Steps accessors/properties
194 .def("GetSteps", &EquationSystem::GetSteps)
195 .def("SetSteps", &EquationSystem::SetSteps)
196 .def_property("steps", &EquationSystem::GetSteps,
197 &EquationSystem::SetSteps)
198
199 // Print a summary
200 .def("PrintSummary", &EquationSystem_PrintSummary)
201
202 // Access functions from the session file
203 .def("GetFunction", &EquationSystem_GetFunction1)
204 .def("GetFunction", &EquationSystem_GetFunction2)
205
206 // I/O utility functions
207 .def("WriteFld", &EquationSystem_WriteFld)
208 .def("Checkpoint_Output", &EquationSystem_Checkpoint_Output)
209
210 // Factory functions.
211 .def_static("Create", &EquationSystem_Create)
212 .def_static("Register", [](std::string &filterName, py::object &obj) {
213 fac(filterName, obj, filterName);
214 });
215}
void EquationSystem_Checkpoint_Output(EquationSystemSharedPtr eqSys, int n)
std::shared_ptr< SessionFunction > EquationSystem_GetFunction1(EquationSystemSharedPtr eqSys, std::string name)
void EquationSystem_WriteFld(EquationSystemSharedPtr eqSys, std::string name)
EquationSystemSharedPtr EquationSystem_Create(std::string eqnSysName, LibUtilities::SessionReaderSharedPtr session, SpatialDomains::MeshGraphSharedPtr mesh)
Array< OneD, MultiRegions::ExpListSharedPtr > EquationSystem_GetFields(EquationSystemSharedPtr eqSys)
void EquationSystem_PrintSummary(EquationSystemSharedPtr eqSys)
std::shared_ptr< SessionFunction > EquationSystem_GetFunction2(EquationSystemSharedPtr eqSys, std::string name, MultiRegions::ExpListSharedPtr field)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
EquationSystemFactory & GetEquationSystemFactory()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
EquationSystem wrapper to handle virtual function calls in EquationSystem and its subclasses.

Referenced by PYBIND11_MODULE().

◆ export_Filter()

void export_Filter ( py::module &  m)

Definition at line 158 of file Python/Filter.cpp.

159{
161
162 // Wrapper for the Filter class. Note that since Filter contains a pure
163 // virtual function, we need the FilterWrap helper class to handle this for
164 // us. In the lightweight wrappers above, we therefore need to ensure we're
165 // passing std::shared_ptr<Filter> as the first argument, otherwise they
166 // won't accept objects constructed from Python.
167 py::classh<Filter, FilterWrap>(m, "Filter")
170
171 .def("Initialise", &FilterPublic::v_Initialise)
172 .def("Update", &FilterPublic::v_Update)
173 .def("Finalise", &FilterPublic::v_Finalise)
174 .def("IsTimeDependent", &FilterPublic::v_IsTimeDependent)
175
176 // Factory functions.
177 .def_static("Create", &Filter_Create)
178
179 .def_static("Register", [](std::string &filterName, py::object &obj) {
180 fac(filterName, obj, filterName);
181 });
182}
FilterSharedPtr Filter_Create(py::args args, const py::kwargs &kwargs)
Lightweight wrapper for Filter factory creation function.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
virtual bool v_IsTimeDependent()=0
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)=0
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
FilterFactory & GetFilterFactory()

References Filter_Create(), Nektar::SolverUtils::GetFilterFactory(), Nektar::SolverUtils::Filter::v_Finalise(), Nektar::SolverUtils::Filter::v_Initialise(), Nektar::SolverUtils::Filter::v_IsTimeDependent(), and Nektar::SolverUtils::Filter::v_Update().

Referenced by PYBIND11_MODULE().

◆ 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().

◆ export_UnsteadySystem()

void export_UnsteadySystem ( py::module &  m)

Definition at line 50 of file Python/UnsteadySystem.cpp.

51{
53
54 py::classh<UnsteadySystem, EquationSystem, USWrap>(m, "UnsteadySystem")
55
58
59 // Add properties for time integration
60 .def_readonly("ode", &PublicUS::m_ode,
61 py::return_value_policy::reference)
62 .def_property_readonly("int_scheme",
63 &UnsteadySystem::GetTimeIntegrationScheme,
64 py::return_value_policy::reference_internal);
65}
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.

References Nektar::SolverUtils::UnsteadySystem::m_ode.

Referenced by PYBIND11_MODULE().

◆ PYBIND11_MODULE()

PYBIND11_MODULE ( _SolverUtils  ,
 
)

Definition at line 42 of file SolverUtils.cpp.

43{
48}
void export_UnsteadySystem(py::module &m)
void export_Filter(py::module &m)
void export_SessionFunction(py::module &m)
void export_EquationSystem(py::module &m)

References export_EquationSystem(), export_Filter(), export_SessionFunction(), and export_UnsteadySystem().