OGS
PythonSourceTerm.cpp
Go to the documentation of this file.
1 
11 #include "PythonSourceTerm.h"
12 
13 #include <pybind11/pybind11.h>
14 
15 #include <iostream>
16 
17 #include "FlushStdoutGuard.h"
22 
23 namespace ProcessLib
24 {
25 namespace SourceTerms
26 {
27 namespace Python
28 {
30  std::unique_ptr<NumLib::LocalToGlobalIndexMap> source_term_dof_table,
31  PythonStData&& source_term_data, unsigned const integration_order,
32  unsigned const global_dim, bool const flush_stdout)
33  : SourceTerm(std::move(source_term_dof_table)),
34  _source_term_data(std::move(source_term_data)),
35  _flush_stdout(flush_stdout)
36 {
41  NumLib::IntegrationOrder{integration_order},
44 }
45 
46 void PythonSourceTerm::integrate(const double t, const GlobalVector& x,
47  GlobalVector& b, GlobalMatrix* Jac) const
48 {
49  FlushStdoutGuard guard(_flush_stdout);
50 
53  *_source_term_dof_table, t, x, b, Jac);
54 }
55 
56 } // namespace Python
57 } // namespace SourceTerms
58 } // namespace ProcessLib
Global vector based on Eigen vector.
Definition: EigenVector.h:28
bool isAxiallySymmetric() const
Definition: Mesh.h:131
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:103
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const _source_term_dof_table
Definition: SourceTerm.h:35
virtual void assemble(std::size_t const source_term_element_id, NumLib::LocalToGlobalIndexMap const &source_term_dof_table, double const t, const GlobalVector &x, GlobalVector &b, GlobalMatrix *Jac)=0
PythonSourceTerm(std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, PythonStData &&source_term_data, unsigned const integration_order, unsigned const global_dim, bool const flush_stdout)
std::vector< std::unique_ptr< PythonSourceTermLocalAssemblerInterface > > _local_assemblers
Local assemblers for all elements of the source term mesh.
void integrate(const double t, GlobalVector const &x, GlobalVector &b, GlobalMatrix *jac) const override
PythonStData _source_term_data
Auxiliary data used by the local assemblers.
static const double t
void createLocalAssemblersPython(const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, NumLib::IntegrationOrder const integration_order, ExtraCtorArgs &&... extra_ctor_args)
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)
MeshLib::Mesh const & bc_or_st_mesh
The domain, where this BC or ST will be applied.
Definition: BcOrStData.h:46