Nektar++
Typedefs | Functions | Variables
LibUtilities.cpp File Reference
#include <sstream>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/Python/BasicUtils/SharedArray.hpp>
#include <LibUtilities/Python/NekPyConfig.hpp>

Go to the source code of this file.

Typedefs

using NekError = Nektar::ErrorUtil::NekError
 

Functions

void export_Basis ()
 Basis exports. More...
 
void export_Comm ()
 Export for Comm communicator. More...
 
void export_Interpreter ()
 
void export_Equation ()
 
void export_Points ()
 Points exports. More...
 
void export_SessionReader ()
 SessionReader exports. More...
 
void export_ShapeType ()
 Export for ShapeType enumeration. More...
 
void export_TimeIntegrationScheme ()
 
void export_TimeIntegrationSchemeOperators ()
 
template<typename T >
void export_NekMatrix ()
 
PyObject * CreateExceptionClass (const char *name, PyObject *baseTypeObj=PyExc_Exception)
 
void TranslateNekError (NekError const &e)
 
 BOOST_PYTHON_MODULE (_LibUtilities)
 

Variables

PyObject * NekErrorType = nullptr
 
std::stringstream errorStream
 

Typedef Documentation

◆ NekError

Definition at line 58 of file LibUtilities.cpp.

Function Documentation

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( _LibUtilities  )

Definition at line 82 of file LibUtilities.cpp.

83{
84 np::initialize();
85
86 // Register the NekError exception.
88 py::register_exception_translator<NekError>(&TranslateNekError);
89
90 // Set a stringstream as an error sink to avoid duplicate output.
92
99 export_SharedArray<double>();
100 export_SharedArray<const double>();
101 export_SharedArray<Array<OneD, double>>();
102 export_SharedArray<const Array<OneD, double>>();
104 export_Comm();
107}
void export_Comm()
Export for Comm communicator.
void export_Basis()
Basis exports.
PyObject * NekErrorType
void TranslateNekError(NekError const &e)
void export_Equation()
PyObject * CreateExceptionClass(const char *name, PyObject *baseTypeObj=PyExc_Exception)
void export_ShapeType()
Export for ShapeType enumeration.
Definition: ShapeType.cpp:44
std::stringstream errorStream
void export_Points()
Points exports.
void export_TimeIntegrationSchemeOperators()
void export_SessionReader()
SessionReader exports.
template void export_NekMatrix< double >()
static void SetErrorStream(std::ostream &o)
Definition: ErrorUtil.hpp:71

References CreateExceptionClass(), errorStream, export_Basis(), export_Comm(), export_Equation(), export_Interpreter(), export_NekMatrix< double >(), export_Points(), export_SessionReader(), export_ShapeType(), export_TimeIntegrationScheme(), export_TimeIntegrationSchemeOperators(), NekErrorType, Nektar::ErrorUtil::SetErrorStream(), and TranslateNekError().

◆ CreateExceptionClass()

PyObject * CreateExceptionClass ( const char *  name,
PyObject *  baseTypeObj = PyExc_Exception 
)

Definition at line 60 of file LibUtilities.cpp.

62{
63 std::string qualifiedName0 = std::string("NekPy.LibUtilities.") + name;
64
65 PyObject *typeObj = PyErr_NewException(
66 const_cast<char *>(qualifiedName0.c_str()), baseTypeObj, nullptr);
67
68 if (!typeObj)
69 {
70 py::throw_error_already_set();
71 }
72
73 py::scope().attr(name) = py::handle<>(py::borrowed(typeObj));
74 return typeObj;
75}

References CellMLToNektar.pycml::name.

Referenced by BOOST_PYTHON_MODULE().

◆ export_Basis()

void export_Basis ( )

Basis exports.

Definition at line 55 of file Python/Foundations/Basis.cpp.

56{
57 // Enumerator for basis type
59
60 py::class_<BasisKey>(
61 "BasisKey", py::init<const BasisType &, const int, const PointsKey &>())
62
63 .def("GetNumModes", &BasisKey::GetNumModes)
64 .def("GetTotNumModes", &BasisKey::GetTotNumModes)
65 .def("GetNumPoints", &BasisKey::GetNumPoints)
66 .def("GetTotNumPoints", &BasisKey::GetTotNumPoints)
67 .def("GetBasisType", &BasisKey::GetBasisType)
68 .def("GetPointsKey", &BasisKey::GetPointsKey)
69 .def("GetPointsType", &BasisKey::GetPointsType)
70 .def("Collocation", &BasisKey::Collocation);
71
72 py::class_<Basis, std::shared_ptr<Basis>>("Basis", py::no_init)
73
74 .def("Create", &Basis_Create)
75 .staticmethod("Create")
76
77 .def("GetNumModes", &Basis::GetNumModes)
78 .def("GetTotNumModes", &Basis::GetTotNumModes)
79 .def("GetNumPoints", &Basis::GetNumPoints)
80 .def("GetTotNumPoints", &Basis::GetTotNumPoints)
81 .def("GetBasisType", &Basis::GetBasisType)
82 .def("GetPointsKey", &Basis::GetPointsKey)
83 .def("GetBasisKey", &Basis::GetBasisKey)
84 .def("GetPointsType", &Basis::GetBasisType)
85 .def("Initialize", &Basis::Initialize)
86
87 .def("GetZ", &Basis::GetZ,
88 py::return_value_policy<py::copy_const_reference>())
89 .def("GetW", &Basis::GetW,
90 py::return_value_policy<py::copy_const_reference>())
91 .def("GetZW", &Basis_GetZW)
92
93 .def("GetBdata", &Basis::GetBdata,
94 py::return_value_policy<py::copy_const_reference>())
95 .def("GetDbdata", &Basis::GetDbdata,
96 py::return_value_policy<py::copy_const_reference>());
97}
#define NEKPY_WRAP_ENUM(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:71
BasisSharedPtr Basis_Create(const BasisKey &pts)
py::tuple Basis_GetZW(BasisSharedPtr pts)
const char *const BasisTypeMap[]
Definition: Foundations.hpp:44

References Basis_Create(), Basis_GetZW(), Nektar::LibUtilities::BasisTypeMap, and NEKPY_WRAP_ENUM.

Referenced by BOOST_PYTHON_MODULE().

◆ export_Comm()

void export_Comm ( )

Export for Comm communicator.

Definition at line 53 of file Python/Communication/Comm.cpp.

54{
55 // Export ReduceOperator enum
57
58 py::class_<Comm, std::shared_ptr<Comm>, boost::noncopyable>("Comm",
59 py::no_init)
60 .def("GetSize", &Comm::GetSize)
61 .def("GetRank", &Comm::GetRank)
62 .def("GetType", &Comm::GetType,
63 py::return_value_policy<py::copy_const_reference>())
64 .def("AllReduce", &AllReduce<double>)
65 .def("AllReduce", &AllReduce<int>)
66 .def("AllReduce", &AllReduce<long>)
67 .def("AllReduce", &AllReduce<Array<OneD, NekDouble>>);
68}
T AllReduce(CommSharedPtr &comm, T toReduce, ReduceOperator oper)
const char *const ReduceOperatorMap[]
Definition: Comm.h:72
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:65

References AllReduce(), NEKPY_WRAP_ENUM, and Nektar::LibUtilities::ReduceOperatorMap.

Referenced by BOOST_PYTHON_MODULE().

◆ export_Equation()

void export_Equation ( )

Definition at line 196 of file Python/BasicUtils/Equation.cpp.

197{
198 py::class_<Equation, std::shared_ptr<Equation>, boost::noncopyable>(
199 "Equation", py::no_init)
200
201 .def("__init__", py::make_constructor(ConstructEquation))
202
203 .def("Evaluate", Equation_Evaluate1)
204 .def("Evaluate", Equation_Evaluate2)
205 .def("Evaluate", Equation_Evaluate3)
206 .def("Evaluate", Equation_Evaluate4)
207 .def("Evaluate", Equation_Evaluate5)
208
209 .def("SetParameter", &Equation::SetParameter)
210 .def("SetConstants", py::raw_function(Equation_SetConstants))
211 .def("GetExpression", &Equation::GetExpression)
212 .def("GetVlist", &Equation::GetVlist)
213
214 .def("GetTime", &Equation::GetTime);
215}
py::object Equation_SetConstants(py::tuple args, py::dict kwargs)
Wrapper for Equation::SetConstants.
std::shared_ptr< Equation > ConstructEquation(std::shared_ptr< Interpreter > evaluator, std::string expr, std::string vlist)
Construct an equation object from an expression string expr and a list of variables vlist.
Array< OneD, NekDouble > Equation_Evaluate5(std::shared_ptr< Equation > equation, const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, const Array< OneD, const NekDouble > &t)
Wrapper for Equation::Evaluate (overloaded for Array parameters + Array time).
NekDouble Equation_Evaluate2(std::shared_ptr< Equation > equation, const NekDouble x, const NekDouble y=0, const NekDouble z=0, const NekDouble t=0)
Wrapper for Equation::Evaluate (overloaded for constant parameters).
NekDouble Equation_Evaluate1(std::shared_ptr< Equation > equation)
Wrapper for Equation::Evaluate (overloaded for no parameters).
Array< OneD, NekDouble > Equation_Evaluate4(std::shared_ptr< Equation > equation, const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, const NekDouble t)
Wrapper for Equation::Evaluate (overloaded for Array parameters + constant time).
Array< OneD, NekDouble > Equation_Evaluate3(std::shared_ptr< Equation > equation, const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z)
Wrapper for Equation::Evaluate (overloaded for Array parameters).

References ConstructEquation(), Equation_Evaluate1(), Equation_Evaluate2(), Equation_Evaluate3(), Equation_Evaluate4(), Equation_Evaluate5(), and Equation_SetConstants().

Referenced by BOOST_PYTHON_MODULE().

◆ export_Interpreter()

void export_Interpreter ( )

Definition at line 226 of file Python/Interpreter/Interpreter.cpp.

227{
228 py::class_<Interpreter, std::shared_ptr<Interpreter>, boost::noncopyable>(
229 "Interpreter", py::init<>())
230
231 .def("SetRandomSeed", &Interpreter::SetRandomSeed)
232
233 .def("AddConstants", py::raw_function(Interpreter_AddConstants))
234 .def("AddConstant", &Interpreter::AddConstant)
235 .def("GetConstant", Interpreter_GetConstant)
236
237 .def("SetParameters", py::raw_function(Interpreter_SetParameters))
238 .def("SetParameter", &Interpreter::SetParameter)
239 .def("GetParameter", Interpreter_GetParameter)
240
241 .def("GetTime", &Interpreter::GetTime)
242 .def("DefineFunction", &Interpreter::DefineFunction)
243
244 .def("Evaluate", Interpreter_Evaluate)
245 .def("Evaluate", Interpreter_Evaluate2)
246 .def("Evaluate", Interpreter_Evaluate3)
247 .def("Evaluate", Interpreter_Evaluate4)
248
249 ;
250}
NekDouble Interpreter_Evaluate2(std::shared_ptr< Interpreter > interpreter, const int id, const NekDouble x, const NekDouble y, const NekDouble z, const NekDouble t)
Wrapper for Interpreter::Evaluate (only constant parameters).
Array< OneD, NekDouble > Interpreter_Evaluate4(std::shared_ptr< Interpreter > interpreter, const int expression_id, const std::vector< Array< OneD, const NekDouble > > &points)
Wrapper for Interpreter::Evaluate (zero or more arrays).
NekDouble Interpreter_Evaluate(std::shared_ptr< Interpreter > interpreter, const int id)
Wrapper for Interpreter::Evaluate (only constant or parameter).
NekDouble Interpreter_GetParameter(std::shared_ptr< Interpreter > interpreter, std::string paramName)
Wrapper for Interpreter::GetParameter.
py::object Interpreter_SetParameters(py::tuple args, py::dict kwargs)
Wrapper for Interpreter::SetParameters.
Array< OneD, NekDouble > Interpreter_Evaluate3(std::shared_ptr< Interpreter > interpreter, const int id, const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, const Array< OneD, const NekDouble > &t)
Wrapper for Interpreter::Evaluate (vectorised version of the evaluation method that will allow the sa...
NekDouble Interpreter_GetConstant(std::shared_ptr< Interpreter > interpreter, std::string constantName)
Wrapper for Interpreter::GetConstant.
py::object Interpreter_AddConstants(py::tuple args, py::dict kwargs)
Wrapper for Interpreter::AddConstants.

References Interpreter_AddConstants(), Interpreter_Evaluate(), Interpreter_Evaluate2(), Interpreter_Evaluate3(), Interpreter_Evaluate4(), Interpreter_GetConstant(), Interpreter_GetParameter(), and Interpreter_SetParameters().

Referenced by BOOST_PYTHON_MODULE().

◆ export_NekMatrix()

template<typename T >
void export_NekMatrix ( )

Definition at line 92 of file NekMatrix.cpp.

93{
94 py::to_python_converter<std::shared_ptr<NekMatrix<T, StandardMatrixTag>>,
96}

◆ export_Points()

void export_Points ( )

Points exports.

Definition at line 70 of file Python/Foundations/Points.cpp.

71{
74 "Characterise the type of points.\n"
75 "\n"
76 "Sample usage: PointsType.GaussLobattoLegendre\n"
77 "\n"
78 "Available point types:\n"
79 "\tNoPointsType: No points type.\n"
80 "\tGaussGaussLegendre: 1D Gauss-Gauss-Legendre quadrature points.\n"
81 "\tGaussRadauMLegendre: 1D Gauss-Radau-Legendre quadrature points,\n"
82 "\t\tpinned at x=-1.\n"
83 "\tGaussRadauPLegendre: 1D Gauss-Radau-Legendre quadrature points,\n"
84 "\t\tpinned at x=1.\n"
85 "\tGaussLobattoLegendre: 1D Gauss-Lobatto-Legendre quadrature points.\n"
86 "\tGaussGaussChebyshev: 1D Gauss-Gauss-Chebyshev quadrature points.\n"
87 "\tGaussRadauMChebyshev: 1D Gauss-Radau-Chebyshev quadrature points,\n"
88 "\t\tpinned at x=-1.\n"
89 "\tGaussRadauPChebyshev: 1D Gauss-Radau-Chebyshev quadrature points,\n"
90 "\t\tpinned at x=1.\n"
91 "\tGaussLobattoChebyshev: 1D Gauss-Lobatto-Legendre quadrature points\n"
92 "\tGaussRadauMAlpha0Beta1: Gauss Radau pinned at x=-1,\n"
93 "\t\talpha = 0, beta = 1\n"
94 "\tGaussRadauMAlpha0Beta2: Gauss Radau pinned at x=-1,\n"
95 "\t\talpha = 0, beta = 2\n"
96 "\tGaussRadauMAlpha1Beta0: Gauss Radau pinned at x=-1,\n"
97 "\t\talpha = 1, beta = 0\n"
98 "\tGaussRadauMAlpha2Beta0: Gauss Radau pinned at x=-1,\n"
99 "\t\talpha = 2, beta = 0\n"
100 "\tGaussKronrodLegendre: 1D Gauss-Kronrod-Legendre quadrature points.\n"
101 "\tGaussRadauKronrodMLegendre: 1D Gauss-Radau-Kronrod-Legendre "
102 "quadrature\n"
103 "\t\tpoints, pinned at x=-1.\n"
104 "\tGaussRadauKronrodMAlpha1Beta0: 1D Gauss-Radau-Kronrod-Legendre\n"
105 "\t\tpinned at x=-1, alpha = 1, beta = 0\n"
106 "\tGaussLobattoKronrodLegendre: 1D Lobatto Kronrod quadrature points.\n"
107 "\tPolyEvenlySpaced: 1D Evenly-spaced points using Lagrange "
108 "polynomial.\n"
109 "\tFourierEvenlySpaced: 1D Evenly-spaced points using Fourier Fit.\n"
110 "\tFourierSingleModeSpaced: 1D Non Evenly-spaced points for Single "
111 "Mode\n"
112 "\t\tanalysis.\n"
113 "\tBoundaryLayerPoints: 1D power law distribution for boundary layer "
114 "points.\n"
115 "\tBoundaryLayerPointsRev: 1D power law distribution for boundary "
116 "layer\n"
117 "\t\tpoints.\n"
118 "\tNodalTriElec: 2D Nodal Electrostatic Points on a Triangle.\n"
119 "\tNodalTriFekete: 2D Nodal Fekete Points on a Triangle.\n"
120 "\tNodalTriEvenlySpaced: 2D Evenly-spaced points on a Triangle.\n"
121 "\tNodalTetEvenlySpaced: 3D Evenly-spaced points on a Tetrahedron.\n"
122 "\tNodalTetElec: 3D Nodal Electrostatic Points on a Tetrahedron.\n"
123 "\tNodalPrismEvenlySpaced: 3D Evenly-spaced points on a Prism.\n"
124 "\tNodalPrismElec: 3D electrostatically spaced points on a Prism.\n"
125 "\tNodalTriSPI: 2D Nodal Symmetric positive internal triangle\n"
126 "\t\t(Whitherden, Vincent).\n"
127 "\tNodalTetSPI: 3D Nodal Symmetric positive internal tet\n"
128 "\t\t(Whitherden, Vincent).\n"
129 "\tNodalPrismSPI: 3D prism SPI.\n"
130 "\tNodalQuadElec: 2D GLL for quad.\n"
131 "\tNodalHexElec: 3D GLL for hex");
132
133 py::class_<PointsKey>(
134 "PointsKey",
135 "Create a PointsKey which uniquely defines quadrature points.\n"
136 "\n"
137 "Args:\n"
138 "\tnQuadPoints (integer): The number of quadrature points.\n"
139 "\tpointsType (PointsType object): The type of quadrature points.",
140 py::init<const int, const PointsType &>())
141
142 .def("GetNumPoints", &PointsKey::GetNumPoints,
143 "Get the number of quadrature points in PointsKey.\n"
144 "\n"
145 "Args:\n"
146 "\tNone\n"
147 "Returns:\n"
148 "\tInteger defining the number of quadrature points in PointsKey.")
149 .def("GetPointsType", &PointsKey::GetPointsType,
150 "Get the type of points in PointsKey.\n"
151 "\n"
152 "Args:\n"
153 "\tNone\n"
154 "Returns:\n"
155 "\tPointsType object specifying the type of points in PointsKey.")
156 .def("GetPointsDim", &PointsKey::GetPointsDim,
157 "Get the dimension of the PointsKey.\n"
158 "\n"
159 "Args:\n"
160 "\tNone\n"
161 "Returns:\n"
162 "\tInteger characterising the dimension of the PointsKey (e.g. 2\n"
163 "\tfor 2D PointsKey).")
164 .def("GetTotNumPoints", &PointsKey::GetTotNumPoints,
165 "Get the total number of points in PointsKey.\n"
166 "\n"
167 "Args:\n"
168 "\tNone\n"
169 "Returns:\n"
170 "\tInteger defining the total number of points in PointsKey.");
171
172 py::class_<Points<double>, std::shared_ptr<Points<double>>,
173 boost::noncopyable>(
174 "Points",
175 "Create a set of points which can be used to calculate\n"
176 "quadrature zeros, weights etc."
177 "\n"
178 "Args:\n"
179 "\tNone",
180 py::no_init)
181 .def("Create", &Points_Create,
182 "Create a Points object using PointsKey.\n"
183 "\n"
184 "Args:\n"
185 "\tpointsKey (PointsKey object): The PointsKey to be used to\n"
186 "\tcreate points.\n"
187 "Returns:\n"
188 "\tPoints object created with the given PointsKey.")
189 .staticmethod("Create")
190
191 .def("Initialise", &Points<double>::Initialize,
192 "Initialise Points object by calculating points, weights\n"
193 "and differentiation matrix.\n"
194 "\n"
195 "Args:\n"
196 "\tNone\n"
197 "Returns:\n"
198 "\tNone")
199 .def("GetPointsDim", &Points<double>::GetPointsDim,
200 "Get the dimension of the Points object.\n"
201 "\n"
202 "Args:\n"
203 "\tNone\n"
204 "Returns:\n"
205 "\tInteger characterising the dimension of the Points object\n"
206 "\t(e.g. 2 for 2D Points object).")
207 .def("GetPointsType", &Points<double>::GetPointsType,
208 "Get the type of points in Points object.\n"
209 "\n"
210 "Args:\n"
211 "\tNone\n"
212 "Returns:\n"
213 "\tPointsType object specifying the type of points in Points\n"
214 "\tobject.")
215 .def("GetNumPoints", &Points<double>::GetNumPoints,
216 "Get the number of quadrature points in Points object.\n"
217 "\n"
218 "Args:\n"
219 "\tNone\n"
220 "Returns:\n"
221 "\tInteger defining the number of quadrature points in Points\n"
222 "\tobject.")
223 .def("GetTotNumPoints", &Points<double>::GetTotNumPoints,
224 "Get the total number of points in Points object.\n"
225 "\n"
226 "Args:\n"
227 "\tNone\n"
228 "Returns:\n"
229 "\tInteger defining the total number of points in Points\n"
230 "\tobject.")
231
232 .def("GetZ", &Points<double>::GetZ,
233 py::return_value_policy<py::copy_const_reference>(),
234 "Get quadrature zeros.\n"
235 "\n"
236 "Args:\n"
237 "\tNone\n"
238 "Returns:\n"
239 "\tNumPy ndarray of length equal to the number of quadrature\n"
240 "\tpoints, containing quadrature zeros.")
241 .def("GetW", &Points<double>::GetW,
242 py::return_value_policy<py::copy_const_reference>(),
243 "Get quadrature weights.\n"
244 "\n"
245 "Args:\n"
246 "\tNone\n"
247 "Returns:\n"
248 "\tNumPy ndarray of length equal to the number of quadrature\n"
249 "\tpoints, containing quadrature weights.")
250 .def("GetZW", &Points_GetZW,
251 "Get quadrature zeros and weights.\n"
252 "\n"
253 "Args:\n"
254 "\tNone\n"
255 "Returns:\n"
256 "\tTuple containing the quadrature zeros and quadrature weights,\n"
257 "\ti.e. (Points.GetZ(), Points.GetW()).")
258 .def("GetD", &Points_GetD,
259 "Get the differentiation matrix.\n"
260 "\n"
261 "Args:\n"
262 "\tNone\n"
263 "Returns:\n"
264 "\tNumPy ndarray of n x n dimensions, where n is equal to\n"
265 "\tthe number of quadrature points, containing the\n"
266 "\tdifferentiation matrix.")
267 .def("GetD", &Points_GetD2,
268 "Get the differentiation matrix.\n"
269 "\n"
270 "Args:\n"
271 "\tdir (Direction object): The direction of the desired\n"
272 "\tdifferentiation matrix.\n"
273 "Returns:\n"
274 "\tNumPy ndarray of n x n dimensions, where n is equal to\n"
275 "\tthe number of quadrature points containing the\n"
276 "\tdifferentiation matrix.");
277}
#define NEKPY_WRAP_ENUM_STRING_DOCS(ENUMNAME, MAPNAME, DOCSTRING)
py::tuple Points_GetZW(PointsSharedPtr pts)
MatrixSharedPtrType Points_GetD(PointsSharedPtr pts)
PointsSharedPtr Points_Create(const PointsKey &pts)
MatrixSharedPtrType Points_GetD2(PointsSharedPtr pts, Direction dir)
Stores a set of points of datatype DataT, defined by a PointKey.
Definition: Points.h:235
const std::string kPointsTypeStr[]
Definition: Foundations.hpp:52

References Nektar::LibUtilities::kPointsTypeStr, NEKPY_WRAP_ENUM_STRING_DOCS, Points_Create(), Points_GetD(), Points_GetD2(), and Points_GetZW().

Referenced by BOOST_PYTHON_MODULE().

◆ export_SessionReader()

void export_SessionReader ( )

SessionReader exports.

Currently wrapped functions:

  • SessionReader::CreateInstance for creating objects
  • SessionReader::GetSessionName to return the session name
  • SessionReader::Finalise to deal with finalising things

Definition at line 146 of file Python/BasicUtils/SessionReader.cpp.

147{
148 py::class_<SessionReader, std::shared_ptr<SessionReader>,
149 boost::noncopyable>("SessionReader", py::no_init)
150
151 .def("CreateInstance", SessionReader_CreateInstance)
152 .staticmethod("CreateInstance")
153
154 .def("GetSessionName", &SessionReader::GetSessionName,
155 py::return_value_policy<py::copy_const_reference>())
156
157 .def("Finalise", &SessionReader::Finalise)
158
159 .def("DefinesParameter", &SessionReader::DefinesParameter)
160 .def("GetParameter", &SessionReader::GetParameter,
161 py::return_value_policy<py::return_by_value>())
162 .def("GetParameters", &SessionReader_GetParameters)
163
164 .def("SetParameter", SessionReader_SetParameterInt)
165 .def("SetParameter", SessionReader_SetParameterDouble)
166
167 .def("DefinesSolverInfo", &SessionReader::DefinesSolverInfo)
168 .def("GetSolverInfo", &SessionReader::GetSolverInfo,
169 py::return_value_policy<py::copy_const_reference>())
170 .def("SetSolverInfo", &SessionReader::SetSolverInfo)
171
172 .def("GetVariable", &SessionReader::GetVariable,
173 py::return_value_policy<py::copy_const_reference>())
174 .def("GetVariables", SessionReader_GetVariables)
175
176 .def("GetFunction", SessionReader_GetFunction1)
177 .def("GetFunction", SessionReader_GetFunction2)
178
179 .def("GetComm", &SessionReader::GetComm)
180
181 .def("GetSharedFilesystem", &SessionReader::GetSharedFilesystem);
182}
EquationSharedPtr SessionReader_GetFunction2(SessionReaderSharedPtr session, std::string func, std::string var)
void SessionReader_SetParameterDouble(SessionReaderSharedPtr session, std::string paramName, double paramValue)
EquationSharedPtr SessionReader_GetFunction1(SessionReaderSharedPtr session, std::string func, int var)
py::dict SessionReader_GetParameters(SessionReaderSharedPtr s)
Function to wrap SessionReader::GetParameters.
py::list SessionReader_GetVariables(SessionReaderSharedPtr s)
Function to wrap SessionReader::GetVariables.
SessionReaderSharedPtr SessionReader_CreateInstance(py::list &ns)
void SessionReader_SetParameterInt(SessionReaderSharedPtr session, std::string paramName, int paramValue)
static void Finalise(gs_data *pGsh)
Deallocates the GSLib mapping data.
Definition: GsLib.hpp:248

References Gs::Finalise(), SessionReader_CreateInstance(), SessionReader_GetFunction1(), SessionReader_GetFunction2(), SessionReader_GetParameters(), SessionReader_GetVariables(), SessionReader_SetParameterDouble(), and SessionReader_SetParameterInt().

Referenced by BOOST_PYTHON_MODULE().

◆ export_ShapeType()

void export_ShapeType ( )

Export for ShapeType enumeration.

Definition at line 44 of file ShapeType.cpp.

45{
47}
const char *const ShapeTypeMap[SIZE_ShapeType]
Definition: ShapeType.hpp:75

References NEKPY_WRAP_ENUM, and Nektar::LibUtilities::ShapeTypeMap.

Referenced by BOOST_PYTHON_MODULE().

◆ export_TimeIntegrationScheme()

void export_TimeIntegrationScheme ( )

Definition at line 42 of file Python/TimeIntegration/TimeIntegrationScheme.cpp.

43{
44 // Very lightweight class around the time-integration scheme. Mostly this is
45 // here for debugging purposes rather than to provide a full wrapper around
46 // this class.
47 py::class_<TimeIntegrationScheme, std::shared_ptr<TimeIntegrationScheme>,
48 boost::noncopyable>("TimeIntegrationScheme", py::no_init)
49 .def("GetFullName", &TimeIntegrationScheme::GetFullName)
50 .def("GetName", &TimeIntegrationScheme::GetName)
51 .def("GetVariant", &TimeIntegrationScheme::GetVariant)
52 .def("GetOrder", &TimeIntegrationScheme::GetOrder)
53
54 .def("GetTimeStability", &TimeIntegrationScheme::GetTimeStability)
55 .def("GetNumIntegrationPhases",
56 &TimeIntegrationScheme::GetNumIntegrationPhases);
57}

Referenced by BOOST_PYTHON_MODULE().

◆ export_TimeIntegrationSchemeOperators()

void export_TimeIntegrationSchemeOperators ( )

Definition at line 151 of file TimeIntegrationSchemeOperators.cpp.

152{
154 std::shared_ptr<TimeIntegrationSchemeOperators>,
155 boost::noncopyable>("TimeIntegrationSchemeOperators",
156 py::init<>())
158 .def("DefineProjection",
160 .def("DefineImplicitSolve",
162}
void TimeIntegrationSchemeOperators_DefineOdeRhs(TimeIntegrationSchemeOperatorsSharedPtr op, py::object callback)
void TimeIntegrationSchemeOperators_DefineImplicitSolve(TimeIntegrationSchemeOperatorsSharedPtr op, py::object callback)
void TimeIntegrationSchemeOperators_DefineProjection(TimeIntegrationSchemeOperatorsSharedPtr op, py::object callback)
Binds a set of functions for use by time integration schemes.

References TimeIntegrationSchemeOperators_DefineImplicitSolve(), TimeIntegrationSchemeOperators_DefineOdeRhs(), and TimeIntegrationSchemeOperators_DefineProjection().

Referenced by BOOST_PYTHON_MODULE().

◆ TranslateNekError()

void TranslateNekError ( NekError const &  e)

Definition at line 77 of file LibUtilities.cpp.

78{
79 PyErr_SetString(NekErrorType, e.what());
80}

References NekErrorType.

Referenced by BOOST_PYTHON_MODULE().

Variable Documentation

◆ errorStream

std::stringstream errorStream

Definition at line 56 of file LibUtilities.cpp.

Referenced by BOOST_PYTHON_MODULE().

◆ NekErrorType

PyObject* NekErrorType = nullptr

Definition at line 55 of file LibUtilities.cpp.

Referenced by BOOST_PYTHON_MODULE(), and TranslateNekError().