Nektar++
Python/StdMatrixKey.cpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: StdMatrixKey.cpp
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Python wrapper for StdMatrixKey.
32//
33////////////////////////////////////////////////////////////////////////////////
34
38#include <vector>
39
40#include <boost/python/suite/indexing/map_indexing_suite.hpp>
41
42using namespace Nektar;
43using namespace Nektar::StdRegions;
44
46 const LibUtilities::ShapeType shapeType,
47 const StdExpansionSharedPtr exp,
48 const py::object &constFactorMap,
49 const py::object &varCoeffMap)
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}
66
67/**
68 * @brief Export for StdMatrixKey enumeration.
69 */
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, true>());
83
84 py::class_<StdMatrixKey>("StdMatrixKey", py::no_init)
85 .def("__init__",
86 py::make_constructor(
87 &StdMatrixKey_Init, py::default_call_policies(),
88 (py::arg("matType"), py::arg("shapeType"), py::arg("exp"),
89 py::arg("constFactorMap") = py::object(),
90 py::arg("varCoeffMap") = py::object())))
91
92 .def("GetMatrixType", &StdMatrixKey::GetMatrixType)
93 .def("GetShapeType", &StdMatrixKey::GetShapeType)
94 .def("GetNcoeffs", &StdMatrixKey::GetNcoeffs)
95 .def("GetBasis", &StdMatrixKey::GetBasis);
96}
#define NEKPY_WRAP_ENUM(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:69
void export_StdMatrixKey()
Export for StdMatrixKey enumeration.
StdMatrixKey * StdMatrixKey_Init(const MatrixType matType, const LibUtilities::ShapeType shapeType, const StdExpansionSharedPtr exp, const py::object &constFactorMap, const py::object &varCoeffMap)
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
const char *const VarCoeffTypeMap[]
Definition: StdRegions.hpp:234
const char *const ConstFactorTypeMap[]
Definition: StdRegions.hpp:385
const char *const MatrixTypeMap[]
Definition: StdRegions.hpp:139
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:402
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:403
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:347
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:346