24 VariationalReconstruction_
26 {
return std::make_shared<T>(mpi, mesh); }),
27 py::arg(
"mpi"), py::arg(
"mesh"))
28 .def(
"ConstructMetrics", &T::ConstructMetrics,
31 "ConstructBaseAndWeight",
32 [](T &self,
typename T::tFGetBoundaryWeight f)
34 self.ConstructBaseAndWeight(
37 py::gil_scoped_acquire scope_gil;
41 py::arg(
"map_bcId_iOrder_to_bCweight"),
44 "ConstructBaseAndWeight_map",
45 [](T &self,
const std::map<std::pair<Geom::t_index, int>,
real> &m)
47 self.ConstructBaseAndWeight(
50 if (m.count({id, order}))
51 return m.at({id, order});
56 py::arg(
"map_bcId_iOrder_to_bCweight"),
58 .def(
"ConstructRecCoeff", &T::ConstructRecCoeff,
62 VariationalReconstruction_
63 .def(
"SetPeriodicTransformations3d", [](T &self, std::array<int, 3> Seq123)
64 { self.SetPeriodicTransformations(Seq123); }, py::arg(
"Seq123"))
65 .def(
"SetPeriodicTransformations2d", [](T &self, std::array<int, 2> Seq123)
66 { self.SetPeriodicTransformations(Seq123); }, py::arg(
"Seq123"))
67 .def(
"SetPeriodicTransformationsNoOp", [](T &self)
68 { self.SetPeriodicTransformations(); });
70 VariationalReconstruction_
72 "ParseSettings", [](T &self, py::object settings)
75 nlohmann::ordered_json defaultJson;
77 nlohmann::json settings_json = settings;
78 defaultJson.merge_patch(settings_json);
79 self.parseSettings(defaultJson); },
81 VariationalReconstruction_
83 "GetCellBary", &T::GetCellBary, py::arg(
"iCell"));
85#define DNDS_CFV_VR_PYBIND11_DEFINE_BuildURec(nVarsFixed) \
86 VariationalReconstruction_.def( \
87 ("BuildURec_" + RowSize_To_PySnippet(nVarsFixed)).c_str(), \
88 [](T &self, tURec<nVarsFixed> &u, int nVars, bool buildSon, bool buildTrans) \
89 { self.BuildURec(u, nVars, buildSon, buildTrans); }, \
90 py::arg("u"), py::arg("nVars"), py::arg("buildSon") = true, py::arg("buildTrans") = true, \
91 DNDS_PYBIND11_OSTREAM_GUARD)
92#define DNDS_CFV_VR_PYBIND11_DEFINE_BuildUGrad(nVarsFixed) \
93 VariationalReconstruction_.def( \
94 ("BuildUGrad_" + RowSize_To_PySnippet(nVarsFixed)).c_str(), \
95 [](T &self, tUGrad<nVarsFixed, dim> &u, int nVars, bool buildSon, bool buildTrans) \
96 { self.BuildUGrad(u, nVars, buildSon, buildTrans); }, \
97 py::arg("u"), py::arg("nVars"), py::arg("buildSon") = true, py::arg("buildTrans") = true, \
98 DNDS_PYBIND11_OSTREAM_GUARD)
107#define DNDS_CFV_VR_PYBIND11_DEFINE_BuildCalls(nVarsFixed) \
109 DNDS_CFV_VR_PYBIND11_DEFINE_BuildURec(nVarsFixed); \
110 DNDS_CFV_VR_PYBIND11_DEFINE_BuildUGrad(nVarsFixed); \
112 if constexpr (dim == 2)
129#undef DNDS_CFV_VR_PYBIND11_DEFINE_BuildUDof
130#undef DNDS_CFV_VR_PYBIND11_DEFINE_BuildURec
131#undef DNDS_CFV_VR_PYBIND11_DEFINE_BuildUGrad
132#undef DNDS_CFV_VR_PYBIND11_DEFINE_BuildCalls
134 VariationalReconstruction_
135 .def_property_readonly(
"matrixAAInvB", &T::get_matrixAAInvB)
136 .def_property_readonly(
"vectorAInvB", &T::get_vectorAInvB);
138 VariationalReconstruction_
139 .def(
"GetFaceNorm", &T::GetFaceNorm,
140 py::arg(
"iFace"), py::arg(
"iG"))
141 .def(
"GetFaceNormFromCell", &T::GetFaceNormFromCell,
142 py::arg(
"iFace"), py::arg(
"iCell"), py::arg(
"if2c"), py::arg(
"ig"))
143 .def(
"GetCellVol", &T::GetCellVol, py::arg(
"iCell"))
144 .def(
"GetFaceArea", &T::GetFaceArea, py::arg(
"iFace"));