26 std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table,
27 int const variable_id,
int const component_id,
28 unsigned const integration_order,
unsigned const shapefunction_order,
29 unsigned const global_dim,
30 std::vector<std::reference_wrapper<ProcessVariable>>
const&
31 all_process_variables_for_this_process)
33 DBUG(
"Constructing PythonSourceTerm from config.");
37 auto const source_term_object =
44 pybind11::object scope =
45 pybind11::module::import(
"__main__").attr(
"__dict__");
47 if (!scope.contains(source_term_object))
50 "Function `{:s}' is not defined in the python script file, or "
51 "there was no python script file specified.",
55 auto* source_term = scope[source_term_object.c_str()]
56 .cast<ProcessLib::SourceTerms::Python::
57 PythonSourceTermPythonSideInterface*>();
74 auto const global_component_id =
75 dof_table->getGlobalComponent(variable_id, component_id);
76 return std::make_unique<ProcessLib::SourceTerms::Python::PythonSourceTerm>(
79 {source_term, global_component_id, source_term_mesh,
80 all_process_variables_for_this_process, shapefunction_order}},
81 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)