DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
VRDefines_bind.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "DNDS/Array_bind.hpp"
8#include "VRDefines.hpp"
10
11namespace DNDS::CFV
12{
13 // is alias really necessary?
14 template <int nVarsFixed>
15 inline void pybind11_define_tURec_alias(py::module_ &m, py::module_ &m_dnds)
16 {
17 m.attr(("tURec_" + RowSize_To_PySnippet(nVarsFixed)).c_str()) =
18 pybind11_ArrayDOF_get_class<DynamicSize, nVarsFixed>(m_dnds);
19 }
20
21 template <int nVarsFixed>
22 inline void pybind11_define_tUDof_alias(py::module_ &m, py::module_ &m_dnds)
23 {
24 m.attr(("tUDof_" + RowSize_To_PySnippet(nVarsFixed)).c_str()) =
25 pybind11_ArrayDOF_get_class<nVarsFixed, 1>(m_dnds);
26 }
27
28 template <int nVarsFixed>
29 inline void pybind11_define_tUGrad_alias(py::module_ &m, py::module_ &m_dnds)
30 {
31 m.attr(("tUGrad_2x" + RowSize_To_PySnippet(nVarsFixed)).c_str()) =
32 pybind11_ArrayDOF_get_class<2, nVarsFixed>(m_dnds);
33 m.attr(("tUGrad_3x" + RowSize_To_PySnippet(nVarsFixed)).c_str()) =
34 pybind11_ArrayDOF_get_class<3, nVarsFixed>(m_dnds);
35 }
36
37 inline void pybind11_define_tVVecPair_alias(py::module_ &m, py::module_ &m_dnds)
38 {
39 m.attr("tVVecPair") =
40 pybind11_ArrayEigenVectorPair_get_class<DynamicSize, DynamicSize>(m_dnds);
41 }
42
43 inline void pybind11_define_tMatsPair_alias(py::module_ &m, py::module_ &m_dnds)
44 {
45 m.attr("tMatsPair") =
46 pybind11_ArrayEigenUniMatrixBatchPair_get_class<DynamicSize, DynamicSize>(m_dnds);
47 }
48
49 using tPy_RecAtr = py::classh<RecAtr>;
50 inline void pybind11_define_RecAtr(py::module_ &m)
51 {
52 auto RecAtr_ = tPy_RecAtr(m, "RecAtr");
53 RecAtr_.def(py::init());
54 RecAtr_
55 .def_readwrite("intOrder", &RecAtr::intOrder)
56 .def_readwrite("NDIFF", &RecAtr::NDIFF)
57 .def_readwrite("NDOF", &RecAtr::NDOF)
58 .def_readwrite("Order", &RecAtr::Order)
59 .def_readwrite("relax", &RecAtr::relax);
60 }
61
63 {
64 pybind11_Array_define<RecAtr>(m);
65 pybind11_ParArray_define<RecAtr>(m);
66 pybind11_ArrayTransformer_define<ParArray<RecAtr>>(m);
67 pybind11_ParArrayPair_define<RecAtr>(m);
68 m.attr("tRecAtrPair") =
69 pybind11_ParArrayPair_get_class<RecAtr>(m);
70 }
71
72 // TODO: tVecsPair, tVMatPair, tCoeffPair, t3VecsPair, t3VecPair, t3MatPair
73
74 inline void pybind11_VRDefines_define(py::module_ &m, py::module_ &m_dnds)
75 {
76#define DNDS_CFV_DEFINE_ALIAS(nVarsFixed) \
77 { \
78 pybind11_define_tURec_alias<nVarsFixed>(m, m_dnds); \
79 pybind11_define_tUDof_alias<nVarsFixed>(m, m_dnds); \
80 pybind11_define_tUGrad_alias<nVarsFixed>(m, m_dnds); \
81 }
90#undef DNDS_CFV_DEFINE_ALIAS
91
96 }
97}
pybind11 bindings for ArrayDof, mirroring the C++ vector-space operations (norm, dot,...
pybind11 bindings for Array / ParArray / ArrayPair.
Shared pybind11 plumbing used by every *_bind.hpp in DNDS (buffer-protocol type check,...
#define DNDS_CFV_DEFINE_ALIAS(nVarsFixed)
void pybind11_define_tUDof_alias(py::module_ &m, py::module_ &m_dnds)
void pybind11_define_tURec_alias(py::module_ &m, py::module_ &m_dnds)
void pybind11_VRDefines_define(py::module_ &m, py::module_ &m_dnds)
void pybind11_define_tUGrad_alias(py::module_ &m, py::module_ &m_dnds)
void pybind11_define_tMatsPair_alias(py::module_ &m, py::module_ &m_dnds)
void pybind11_define_tVVecPair_alias(py::module_ &m, py::module_ &m_dnds)
py::classh< RecAtr > tPy_RecAtr
void pybind11_define_RecAtr(py::module_ &m)
void pybind11_define_RecAtrArrayPair_and_alias(py::module_ &m)
DNDS_CONSTANT const rowsize DynamicSize
Template parameter flag: "row width is set at runtime but uniform".
Definition Defines.hpp:277
std::string RowSize_To_PySnippet(rowsize rs)
Encode a rowsize constant as a short Python-binding snippet: "<number>" for fixed,...
Definition Defines.hpp:294