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

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

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

150{
151 using EqSysWrap = EquationSystemWrap<EquationSystem>;
152
155
156 py::class_<EqSysWrap, std::shared_ptr<EqSysWrap>, boost::noncopyable>(
157 "EquationSystem", py::init<LibUtilities::SessionReaderSharedPtr,
159
160 // Virtual functions that can be optionally overridden
161 .def("InitObject", &EquationSystem::InitObject,
162 &EqSysWrap::Default_v_InitObject)
163 .def("DoInitialise", &EquationSystem::DoInitialise,
164 &EqSysWrap::Default_v_DoInitialise)
165 .def("DoSolve", &EquationSystem::DoSolve, &EqSysWrap::Default_v_DoSolve)
166 .def("SetInitialConditions", &EquationSystem::SetInitialConditions,
167 &EqSysWrap::Default_v_SetInitialConditions)
168 .def("EvaluateExactSolution", &EqSysWrap::v_EvaluateExactSolution,
169 &EqSysWrap::Default_v_EvaluateExactSolution)
170 .def("LinfError", &EqSysWrap::v_LinfError,
171 &EqSysWrap::Default_v_LinfError)
172 .def("L2Error", &EqSysWrap::v_L2Error, &EqSysWrap::Default_v_L2Error)
173
174 // Fields accessors (read-only)
175 .def("GetFields", &EquationSystem_GetFields)
176 .add_property("fields", &EquationSystem_GetFields)
177
178 // Various utility functions
179 .def("GetNvariables", &EquationSystem::GetNvariables)
180 .def("GetVariable", &EquationSystem::GetVariable)
181 .def("GetNpoints", &EquationSystem::GetNpoints)
182 .def("SetInitialStep", &EquationSystem::SetInitialStep)
183 .def("ZeroPhysFields", &EquationSystem::ZeroPhysFields)
184
185 // Time accessors/properties
186 .def("GetTime", &EquationSystem::GetTime)
187 .def("SetTime", &EquationSystem::SetTime)
188 .add_property("time", &EquationSystem::GetTime,
189 &EquationSystem::SetTime)
190
191 // Timestep accessors/properties
192 .def("GetTimeStep", &EquationSystem::GetTimeStep)
193 .def("SetTimeStep", &EquationSystem::SetTimeStep)
194 .add_property("timestep", &EquationSystem::GetTimeStep,
195 &EquationSystem::SetTimeStep)
196
197 // Steps accessors/properties
198 .def("GetSteps", &EquationSystem::GetSteps)
199 .def("SetSteps", &EquationSystem::SetSteps)
200 .add_property("steps", &EquationSystem::GetSteps,
201 &EquationSystem::SetSteps)
202
203 // Print a summary
204 .def("PrintSummary", &EquationSystem_PrintSummary)
205
206 // Access functions from the session file
207 .def("GetFunction", &EquationSystem_GetFunction1)
208 .def("GetFunction", &EquationSystem_GetFunction2)
209
210 // I/O utility functions
211 .def("WriteFld", &EquationSystem_WriteFld)
212 .def("Checkpoint_Output", &EquationSystem_Checkpoint_Output)
213
214 // Factory functions.
215 .def("Create", &EquationSystem_Create)
216 .staticmethod("Create")
217 .def("Register", [](std::string const &filterName,
218 py::object &obj) { fac(filterName, obj); })
219 .staticmethod("Register");
220
222}
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.
A helper class that for factory-based classes allows std::shared_ptr<T> as something that boost::pyth...

Referenced by BOOST_PYTHON_MODULE().