25 std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table,
26 int const variable_id,
int const component_id,
27 unsigned const integration_order,
unsigned const shapefunction_order,
28 unsigned const global_dim,
29 std::vector<std::reference_wrapper<ProcessVariable>>
const&
30 all_process_variables_for_this_process)
32 DBUG(
"Constructing PythonSourceTerm from config.");
36 auto const source_term_object =
43 pybind11::object scope =
44 pybind11::module::import(
"__main__").attr(
"__dict__");
46 if (!scope.contains(source_term_object))
49 "Function `{:s}' is not defined in the python script file, or "
50 "there was no python script file specified.",
54 auto* source_term = scope[source_term_object.c_str()]
55 .cast<ProcessLib::SourceTerms::Python::
56 PythonSourceTermPythonSideInterface*>();
73 auto const global_component_id =
74 dof_table->getGlobalComponent(variable_id, component_id);
75 return std::make_unique<ProcessLib::SourceTerms::Python::PythonSourceTerm>(
78 {source_term, global_component_id, source_term_mesh,
79 all_process_variables_for_this_process, shapefunction_order}},
80 integration_order, global_dim, flush_stdout);
std::unique_ptr< SourceTerm > createPythonSourceTerm(BaseLib::ConfigTree const &config, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)