Nektar++
Classes | Functions
Python/EquationSystem.cpp File Reference
#include <LibUtilities/Python/BasicUtils/NekFactory.hpp>
#include <LibUtilities/Python/NekPyConfig.hpp>
#include <SolverUtils/EquationSystem.h>
#include <SolverUtils/Python/EquationSystem.h>

Go to the source code of this file.

Classes

class  DummyEquationSystem
 Dummy equation system that can be used for Python testing. More...
 

Functions

EquationSystemSharedPtr EquationSystem_Create (std::string eqnSysName, LibUtilities::SessionReaderSharedPtr session, SpatialDomains::MeshGraphSharedPtr mesh)
 
Array< OneD, MultiRegions::ExpListSharedPtrEquationSystem_GetFields (EquationSystemSharedPtr eqSys)
 
void EquationSystem_PrintSummary (EquationSystemSharedPtr eqSys)
 
std::shared_ptr< SessionFunctionEquationSystem_GetFunction1 (EquationSystemSharedPtr eqSys, std::string name)
 
std::shared_ptr< SessionFunctionEquationSystem_GetFunction2 (EquationSystemSharedPtr eqSys, std::string name, MultiRegions::ExpListSharedPtr field)
 
void EquationSystem_WriteFld (EquationSystemSharedPtr eqSys, std::string name)
 
void EquationSystem_Checkpoint_Output (EquationSystemSharedPtr eqSys, int n)
 
void export_EquationSystem (py::module &m)
 

Function Documentation

◆ EquationSystem_Checkpoint_Output()

void EquationSystem_Checkpoint_Output ( EquationSystemSharedPtr  eqSys,
int  n 
)

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

145{
146 eqSys->Checkpoint_Output(n);
147}

◆ EquationSystem_Create()

EquationSystemSharedPtr EquationSystem_Create ( std::string  eqnSysName,
LibUtilities::SessionReaderSharedPtr  session,
SpatialDomains::MeshGraphSharedPtr  mesh 
)

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

109{
111 GetEquationSystemFactory().CreateInstance(eqnSysName, session, mesh);
112 return ret;
113}
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
EquationSystemFactory & GetEquationSystemFactory()

References Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), and Nektar::SolverUtils::GetEquationSystemFactory().

◆ EquationSystem_GetFields()

Array< OneD, MultiRegions::ExpListSharedPtr > EquationSystem_GetFields ( EquationSystemSharedPtr  eqSys)

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

117{
118 return eqSys->UpdateFields();
119}

◆ EquationSystem_GetFunction1()

std::shared_ptr< SessionFunction > EquationSystem_GetFunction1 ( EquationSystemSharedPtr  eqSys,
std::string  name 
)

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

128{
129 return eqSys->GetFunction(name);
130}

References CellMLToNektar.pycml::name.

◆ EquationSystem_GetFunction2()

std::shared_ptr< SessionFunction > EquationSystem_GetFunction2 ( EquationSystemSharedPtr  eqSys,
std::string  name,
MultiRegions::ExpListSharedPtr  field 
)

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

135{
136 return eqSys->GetFunction(name, field);
137}

References FilterPython_Function::field, and CellMLToNektar.pycml::name.

◆ EquationSystem_PrintSummary()

void EquationSystem_PrintSummary ( EquationSystemSharedPtr  eqSys)

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

122{
123 eqSys->PrintSummary(std::cout);
124}

◆ EquationSystem_WriteFld()

void EquationSystem_WriteFld ( EquationSystemSharedPtr  eqSys,
std::string  name 
)

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

140{
141 eqSys->WriteFld(name);
142}

References CellMLToNektar.pycml::name.

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