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

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...
 
template<typename T >
void export_SharedArray ()
 
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 55 of file LibUtilities.cpp.

Function Documentation

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( _LibUtilities  )

Definition at line 79 of file LibUtilities.cpp.

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

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

◆ CreateExceptionClass()

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

Definition at line 57 of file LibUtilities.cpp.

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

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:69
BasisSharedPtr Basis_Create(const BasisKey &pts)
py::tuple Basis_GetZW(BasisSharedPtr pts)
const char *const BasisTypeMap[]
Definition: Foundations.hpp:46

References Basis_Create(), Basis_GetZW(), Nektar::LibUtilities::BasisTypeMap, Nektar::LibUtilities::BasisKey::Collocation(), Nektar::LibUtilities::Basis::GetBasisKey(), Nektar::LibUtilities::BasisKey::GetBasisType(), Nektar::LibUtilities::Basis::GetBasisType(), Nektar::LibUtilities::Basis::GetBdata(), Nektar::LibUtilities::Basis::GetDbdata(), Nektar::LibUtilities::BasisKey::GetNumModes(), Nektar::LibUtilities::Basis::GetNumModes(), Nektar::LibUtilities::BasisKey::GetNumPoints(), Nektar::LibUtilities::Basis::GetNumPoints(), Nektar::LibUtilities::BasisKey::GetPointsKey(), Nektar::LibUtilities::Basis::GetPointsKey(), Nektar::LibUtilities::BasisKey::GetPointsType(), Nektar::LibUtilities::BasisKey::GetTotNumModes(), Nektar::LibUtilities::Basis::GetTotNumModes(), Nektar::LibUtilities::BasisKey::GetTotNumPoints(), Nektar::LibUtilities::Basis::GetTotNumPoints(), Nektar::LibUtilities::Basis::GetW(), Nektar::LibUtilities::Basis::GetZ(), Nektar::LibUtilities::Basis::Initialize(), 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:74
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:67

References AllReduce(), Nektar::LibUtilities::Comm::GetRank(), Nektar::LibUtilities::Comm::GetSize(), Nektar::LibUtilities::Comm::GetType(), 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 }
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.
py::object Equation_SetConstants(py::tuple args, py::dict kwargs)
Wrapper for Equation::SetConstants.
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).
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_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).
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).

References ConstructEquation(), Equation_Evaluate1(), Equation_Evaluate2(), Equation_Evaluate3(), Equation_Evaluate4(), Equation_Evaluate5(), Equation_SetConstants(), Nektar::LibUtilities::Equation::GetExpression(), Nektar::LibUtilities::Equation::GetTime(), Nektar::LibUtilities::Equation::GetVlist(), and Nektar::LibUtilities::Equation::SetParameter().

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_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_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_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_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 Nektar::LibUtilities::Interpreter::AddConstant(), Nektar::LibUtilities::Interpreter::DefineFunction(), Nektar::LibUtilities::Interpreter::GetTime(), Interpreter_AddConstants(), Interpreter_Evaluate(), Interpreter_Evaluate2(), Interpreter_Evaluate3(), Interpreter_Evaluate4(), Interpreter_GetConstant(), Interpreter_GetParameter(), Interpreter_SetParameters(), Nektar::LibUtilities::Interpreter::SetParameter(), and Nektar::LibUtilities::Interpreter::SetRandomSeed().

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:254
const std::string kPointsTypeStr[]
Definition: Foundations.hpp:54

References Nektar::LibUtilities::PointsKey::GetNumPoints(), Nektar::LibUtilities::PointsKey::GetPointsDim(), Nektar::LibUtilities::PointsKey::GetPointsType(), Nektar::LibUtilities::PointsKey::GetTotNumPoints(), 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 136 of file Python/BasicUtils/SessionReader.cpp.

137 {
138  py::class_<SessionReader, std::shared_ptr<SessionReader>,
139  boost::noncopyable>("SessionReader", py::no_init)
140 
141  .def("CreateInstance", SessionReader_CreateInstance)
142  .staticmethod("CreateInstance")
143 
144  .def("GetSessionName", &SessionReader::GetSessionName,
145  py::return_value_policy<py::copy_const_reference>())
146 
147  .def("Finalise", &SessionReader::Finalise)
148 
149  .def("DefinesParameter", &SessionReader::DefinesParameter)
150  .def("GetParameter", &SessionReader::GetParameter,
151  py::return_value_policy<py::return_by_value>())
152 
153  .def("SetParameter", SessionReader_SetParameterInt)
154  .def("SetParameter", SessionReader_SetParameterDouble)
155 
156  .def("GetVariable", &SessionReader::GetVariable,
157  py::return_value_policy<py::copy_const_reference>())
158 
159  .def("GetComm", &SessionReader::GetComm)
160 
161  .def("GetSharedFilesystem", &SessionReader::GetSharedFilesystem);
162 }
void SessionReader_SetParameterDouble(SessionReaderSharedPtr session, std::string paramName, double paramValue)
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:251

References Nektar::LibUtilities::SessionReader::DefinesParameter(), Nektar::LibUtilities::SessionReader::Finalise(), Nektar::LibUtilities::SessionReader::GetComm(), Nektar::LibUtilities::SessionReader::GetParameter(), Nektar::LibUtilities::SessionReader::GetSessionName(), Nektar::LibUtilities::SessionReader::GetSharedFilesystem(), Nektar::LibUtilities::SessionReader::GetVariable(), SessionReader_CreateInstance(), 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:79

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

Referenced by BOOST_PYTHON_MODULE().

◆ export_SharedArray()

template<typename T >
void export_SharedArray ( )

Definition at line 201 of file SharedArray.cpp.

202 {
203  py::to_python_converter<Array<OneD, const T>, OneDArrayToPython<const T>>();
204  py::to_python_converter<Array<OneD, T>, OneDArrayToPython<T>>();
205 
208 }

◆ TranslateNekError()

void TranslateNekError ( NekError const &  e)

Definition at line 74 of file LibUtilities.cpp.

75 {
76  PyErr_SetString(NekErrorType, e.what());
77 }

References NekErrorType.

Referenced by BOOST_PYTHON_MODULE().

Variable Documentation

◆ errorStream

std::stringstream errorStream

Definition at line 53 of file LibUtilities.cpp.

Referenced by BOOST_PYTHON_MODULE().

◆ NekErrorType

PyObject* NekErrorType = nullptr

Definition at line 52 of file LibUtilities.cpp.

Referenced by BOOST_PYTHON_MODULE(), and TranslateNekError().