MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / ExportFESpace

Function ExportFESpace

comp/python_comp.hpp:71–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70 template <typename FES, typename BASE=FESpace>
71 auto ExportFESpace (py::module & m, string pyname, bool module_local = false)
72 {
73 auto docu = FES::GetDocu();
74 string docstring = docu.GetPythonDocString();
75 // string docuboth = docu.short_docu + "\n\n" + docu.long_docu;
76 auto pyspace = py::class_<FES, shared_ptr<FES>,BASE> (m, pyname.c_str(), docstring.c_str(), py::module_local(module_local));
77
78 pyspace
79 .def(py::init([pyspace](shared_ptr<MeshAccess> ma, py::kwargs kwargs)
80 {
81 py::list info;
82 info.append(ma);
83 auto flags = CreateFlagsFromKwArgs(kwargs, pyspace, info);
84 auto fes = make_shared<FES>(ma,flags);
85 fes->Update();
86 fes->FinalizeUpdate();
87 // connect_auto_update(fes.get());
88 fes -> ConnectAutoUpdate();
89 return fes;
90 }),py::arg("mesh"))
91
92 .def(py::pickle(&fesPickle,
93 (shared_ptr<FES>(*)(py::tuple)) fesUnpickle<FES>))
94 ;
95
96 pyspace.def_static("__flags_doc__", [docu]()
97 {
98 py::dict flags_doc;
99 for (auto & flagdoc : FES::GetDocu().arguments)
100 flags_doc[get<0> (flagdoc).c_str()] = get<1> (flagdoc);
101 return flags_doc;
102 });
103
104 return pyspace;
105 }
106}
107#endif // NGSOLVE_PYTHON_COMP_HPP

Callers

nothing calls this directly

Calls 3

argFunction · 0.85
UpdateMethod · 0.45
FinalizeUpdateMethod · 0.45

Tested by

no test coverage detected