13 {
return std::make_shared<T>(mpi, mesh); }));
16 "GetSettings", [](T &self)
18 nlohmann::ordered_json outJson;
19 self.getSettings().WriteIntoJson(outJson);
20 return py::object{outJson}; });
23 "ParseSettings", [](T &self, py::object settings)
26 nlohmann::ordered_json defaultJson;
28 nlohmann::json settings_json = settings;
29 defaultJson.merge_patch(settings_json);
30 self.parseSettings(defaultJson); },
33#define DNDS_PY_DEF_SIMP_FUNC(foo) \
37 .DNDS_PY_DEF_SIMP_FUNC(SetCellAtrBasic)
41 .DNDS_PY_DEF_SIMP_FUNC(ConstructCellBary)
42 .DNDS_PY_DEF_SIMP_FUNC(ConstructCellCent)
43 .DNDS_PY_DEF_SIMP_FUNC(ConstructCellIntJacobiDet)
44 .DNDS_PY_DEF_SIMP_FUNC(ConstructCellIntPPhysics)
45 .DNDS_PY_DEF_SIMP_FUNC(ConstructCellAlignedHBox)
54 .DNDS_PY_DEF_SIMP_FUNC(ConstructFaceCent)
55 .DNDS_PY_DEF_SIMP_FUNC(ConstructFaceIntJacobiDet)
56 .DNDS_PY_DEF_SIMP_FUNC(ConstructFaceIntPPhysics)
57 .DNDS_PY_DEF_SIMP_FUNC(ConstructFaceUnitNorm)
65 .def(
"GetCellAtr", &T::GetCellAtr, py::arg(
"iCell"), py::return_value_policy::reference_internal)
66 .def(
"GetCellOrder", &T::GetCellOrder, py::arg(
"iCell"));
69 .def(
"GetFaceAtr", &T::GetFaceAtr, py::arg(
"iFace"), py::return_value_policy::reference_internal);
72 .def(
"GetCellVol", &T::GetCellVol, py::arg(
"iCell"))
73 .def(
"GetFaceArea", &T::GetFaceArea, py::arg(
"iFace"));
76 .def(
"GetGlobalVol", &T::GetGlobalVol);
78 .def(
"GetCellSmoothScaleRatio", &T::GetCellSmoothScaleRatio, py::arg(
"iCell"));
81 .def(
"GetCellJacobiDet", &T::GetCellJacobiDet, py::arg(
"iCell"), py::arg(
"iG"))
82 .def(
"GetFaceJacobiDet", &T::GetFaceJacobiDet, py::arg(
"iFace"), py::arg(
"iG"));
85 .def(
"GetFaceParamArea", &T::GetFaceParamArea, py::arg(
"iFace"));
88 .def(
"GetCellBary", &T::GetCellBary, py::arg(
"iCell"));
91 .def(
"CellIsFaceBack", &T::CellIsFaceBack, py::arg(
"iCell"), py::arg(
"iFace"));
93 .def(
"CellFaceOther", &T::CellFaceOther, py::arg(
"iCell"), py::arg(
"iFace"));
96 .def(
"GetFaceNorm", &T::GetFaceNorm, py::arg(
"iFace"), py::arg(
"iG"));
98 .def(
"GetFaceNormFromCell", &T::GetFaceNormFromCell, py::arg(
"iFace"), py::arg(
"iCell"), py::arg(
"if2c"), py::arg(
"iG"));
101 .def(
"GetFaceQuadraturePPhys", &T::GetFaceQuadraturePPhys, py::arg(
"iFace"), py::arg(
"iG"));
103 .def(
"GetFaceQuadraturePPhysFromCell", &T::GetFaceQuadraturePPhysFromCell, py::arg(
"iFace"), py::arg(
"iCell"), py::arg(
"if2c"), py::arg(
"iG"));
105 .def(
"GetFacePointFromCell", &T::GetFacePointFromCell, py::arg(
"iFace"), py::arg(
"iCell"), py::arg(
"if2c"), py::arg(
"pnt"));
108 .def(
"GetOtherCellBaryFromCell", &T::GetOtherCellBaryFromCell, py::arg(
"iCell"), py::arg(
"iCellOther"), py::arg(
"iFace"));
110 .def(
"GetOtherCellPointFromCell", &T::GetOtherCellPointFromCell, py::arg(
"iCell"), py::arg(
"iCellOther"), py::arg(
"iFace"), py::arg(
"pnt"));
112 .def(
"GetOtherCellInertiaFromCell", &T::GetOtherCellInertiaFromCell, py::arg(
"iCell"), py::arg(
"iCellOther"), py::arg(
"iFace"));
114 .def(
"GetCellQuadraturePPhys", &T::GetCellQuadraturePPhys, py::arg(
"iCell"), py::arg(
"iG"));
116 .def(
"GetCellMaxLenScale", &T::GetCellMaxLenScale, py::arg(
"iCell"));
118 .def(
"getArrayBytes", &T::getArrayBytes);
121 .def(
"to_device", [](
FiniteVolume &self,
const std::string &backend)
125#define DNDS_CFV_FV_PYBIND11_DEFINE_BuildUDof(nVarsFixed) \
127 ("BuildUDof_" + RowSize_To_PySnippet(nVarsFixed)).c_str(), \
128 [](T &self, tUDof<nVarsFixed> &u, int nVars, bool buildSon, bool buildTrans, Geom::MeshLoc varloc) \
129 { self.BuildUDof(u, nVars, buildSon, buildTrans, varloc); }, \
130 py::arg("u"), py::arg("nVars"), py::arg("buildSon") = true, \
131 py::arg("buildTrans") = true, py::arg("varloc") = Geom::MeshLoc::Cell, \
132 DNDS_PYBIND11_OSTREAM_GUARD)
134#define DNDS_CFV_FV_PYBIND11_DEFINE_BuildUGrad(nVarsFixed) \
137 ("BuildUGrad_2x" + RowSize_To_PySnippet(nVarsFixed)).c_str(), \
138 [](T &self, tUGrad<nVarsFixed, 2> &u, int nVars, bool buildSon, bool buildTrans, Geom::MeshLoc varloc) \
139 { self.BuildUGradD(u, nVars, buildSon, buildTrans, varloc); }, \
140 py::arg("u"), py::arg("nVars"), py::arg("buildSon") = true, \
141 py::arg("buildTrans") = true, py::arg("varloc") = Geom::MeshLoc::Cell, \
142 DNDS_PYBIND11_OSTREAM_GUARD) \
144 ("BuildUGrad_3x" + RowSize_To_PySnippet(nVarsFixed)).c_str(), \
145 [](T &self, tUGrad<nVarsFixed, 3> &u, int nVars, bool buildSon, bool buildTrans, Geom::MeshLoc varloc) \
146 { self.BuildUGradD(u, nVars, buildSon, buildTrans, varloc); }, \
147 py::arg("u"), py::arg("nVars"), py::arg("buildSon") = true, \
148 py::arg("buildTrans") = true, py::arg("varloc") = Geom::MeshLoc::Cell, \
149 DNDS_PYBIND11_OSTREAM_GUARD)
151#define DNDS_CFV_FV_PYBIND11_DEFINE_BuildCalls(nVarsFixed) \
153 DNDS_CFV_FV_PYBIND11_DEFINE_BuildUDof(nVarsFixed); \
154 DNDS_CFV_FV_PYBIND11_DEFINE_BuildUGrad(nVarsFixed); \