Nektar++
Functions
Python/StdMatrixKey.cpp File Reference
#include <vector>
#include <StdRegions/StdExpansion.h>
#include <StdRegions/StdMatrixKey.h>
#include <LibUtilities/Python/NekPyConfig.hpp>
#include <boost/python/suite/indexing/map_indexing_suite.hpp>

Go to the source code of this file.

Functions

StdMatrixKeyStdMatrixKey_Init (const MatrixType matType, const LibUtilities::ShapeType shapeType, const StdExpansionSharedPtr exp, const py::object &constFactorMap, const py::object &varCoeffMap)
 
void export_StdMatrixKey ()
 Export for StdMatrixKey enumeration. More...
 

Function Documentation

◆ export_StdMatrixKey()

void export_StdMatrixKey ( )

Export for StdMatrixKey enumeration.

Definition at line 70 of file Python/StdMatrixKey.cpp.

References Nektar::StdRegions::ConstFactorTypeMap, Nektar::StdRegions::StdMatrixKey::GetBasis(), Nektar::StdRegions::StdMatrixKey::GetMatrixType(), Nektar::StdRegions::StdMatrixKey::GetNcoeffs(), Nektar::StdRegions::StdMatrixKey::GetShapeType(), Nektar::StdRegions::MatrixTypeMap, NEKPY_WRAP_ENUM, StdMatrixKey_Init(), and Nektar::StdRegions::VarCoeffTypeMap.

Referenced by BOOST_PYTHON_MODULE().

71 {
75 
76  // Wrapper for constant factor map.
77  py::class_<ConstFactorMap>("ConstFactorMap")
78  .def(py::map_indexing_suite<ConstFactorMap>());
79 
80  // Wrapper for variable coefficients map.
81  py::class_<VarCoeffMap>("VarCoeffMap")
82  .def(py::map_indexing_suite<VarCoeffMap>());
83 
84  py::class_<StdMatrixKey>("StdMatrixKey", py::no_init)
85  .def("__init__", py::make_constructor(
86  &StdMatrixKey_Init, py::default_call_policies(),
87  (py::arg("matType"), py::arg("shapeType"), py::arg("exp"),
88  py::arg("constFactorMap") = py::object(),
89  py::arg("varCoeffMap") = py::object())))
90 
91  .def("GetMatrixType", &StdMatrixKey::GetMatrixType)
92  .def("GetShapeType", &StdMatrixKey::GetShapeType)
93  .def("GetNcoeffs", &StdMatrixKey::GetNcoeffs)
94  .def("GetBasis", &StdMatrixKey::GetBasis)
95  ;
96 }
StdMatrixKey * StdMatrixKey_Init(const MatrixType matType, const LibUtilities::ShapeType shapeType, const StdExpansionSharedPtr exp, const py::object &constFactorMap, const py::object &varCoeffMap)
const char *const ConstFactorTypeMap[]
Definition: StdRegions.hpp:282
const char *const MatrixTypeMap[]
Definition: StdRegions.hpp:149
const char *const VarCoeffTypeMap[]
Definition: StdRegions.hpp:232
#define NEKPY_WRAP_ENUM(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:56

◆ StdMatrixKey_Init()

StdMatrixKey* StdMatrixKey_Init ( const MatrixType  matType,
const LibUtilities::ShapeType  shapeType,
const StdExpansionSharedPtr  exp,
const py::object &  constFactorMap,
const py::object &  varCoeffMap 
)

Definition at line 45 of file Python/StdMatrixKey.cpp.

References Nektar::StdRegions::NullConstFactorMap, and Nektar::StdRegions::NullVarCoeffMap.

Referenced by export_StdMatrixKey().

50 {
53 
54  if (!constFactorMap.is_none())
55  {
56  tmp = py::extract<ConstFactorMap>(constFactorMap);
57  }
58 
59  if (!varCoeffMap.is_none())
60  {
61  tmp2 = py::extract<VarCoeffMap>(varCoeffMap);
62  }
63 
64  return new StdMatrixKey(matType, shapeType, *exp, tmp, tmp2);
65 }
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:265
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:295