OGS
ProcessLib::SourceTerms::Python::PythonSourceTerm Class Referencefinal

Detailed Description

A source term whose values are computed by a Python script.

Definition at line 44 of file PythonSourceTerm.h.

#include <PythonSourceTerm.h>

Inheritance diagram for ProcessLib::SourceTerms::Python::PythonSourceTerm:
[legend]
Collaboration diagram for ProcessLib::SourceTerms::Python::PythonSourceTerm:
[legend]

Public Member Functions

 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)
 
void integrate (const double t, GlobalVector const &x, GlobalVector &b, GlobalMatrix *jac) const override
 
- Public Member Functions inherited from ProcessLib::SourceTerm
 SourceTerm (std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table)
 
virtual ~SourceTerm ()=default
 

Private Attributes

PythonStData _source_term_data
 Auxiliary data used by the local assemblers.
 
std::vector< std::unique_ptr< PythonSourceTermLocalAssemblerInterface > > _local_assemblers
 Local assemblers for all elements of the source term mesh.
 
bool const _flush_stdout
 

Additional Inherited Members

- Protected Attributes inherited from ProcessLib::SourceTerm
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const _source_term_dof_table
 

Constructor & Destructor Documentation

◆ PythonSourceTerm()

ProcessLib::SourceTerms::Python::PythonSourceTerm::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 )
explicit

Definition at line 29 of file PythonSourceTerm.cpp.

33 : SourceTerm(std::move(source_term_dof_table)),
34 _source_term_data(std::move(source_term_data)),
35 _flush_stdout(flush_stdout)
36{
38 PythonSourceTermLocalAssembler>(
41 NumLib::IntegrationOrder{integration_order},
44}
bool isAxiallySymmetric() const
Definition Mesh.h:137
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
SourceTerm(std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table)
Definition SourceTerm.h:23
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const _source_term_dof_table
Definition SourceTerm.h:35
std::vector< std::unique_ptr< PythonSourceTermLocalAssemblerInterface > > _local_assemblers
Local assemblers for all elements of the source term mesh.
PythonStData _source_term_data
Auxiliary data used by the local assemblers.
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)
MeshLib::Mesh const & bc_or_st_mesh
The domain, where this BC or ST will be applied.
Definition BcOrStData.h:46

References _local_assemblers, _source_term_data, ProcessLib::SourceTerm::_source_term_dof_table, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_mesh, ProcessLib::BoundaryConditionAndSourceTerm::createLocalAssemblersPython(), MeshLib::Mesh::getElements(), and MeshLib::Mesh::isAxiallySymmetric().

Member Function Documentation

◆ integrate()

void ProcessLib::SourceTerms::Python::PythonSourceTerm::integrate ( const double t,
GlobalVector const & x,
GlobalVector & b,
GlobalMatrix * jac ) const
overridevirtual

Implements ProcessLib::SourceTerm.

Definition at line 46 of file PythonSourceTerm.cpp.

48{
49 FlushStdoutGuard guard(_flush_stdout);
50
53 *_source_term_dof_table, t, x, b, Jac);
54}
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
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)

References _flush_stdout, _local_assemblers, ProcessLib::SourceTerm::_source_term_dof_table, ProcessLib::SourceTerms::Python::PythonSourceTermLocalAssemblerInterface::assemble(), and NumLib::SerialExecutor::executeMemberOnDereferenced().

Member Data Documentation

◆ _flush_stdout

bool const ProcessLib::SourceTerms::Python::PythonSourceTerm::_flush_stdout
private

Whether or not to flush standard output before and after each call to Python code. Ensures right order of output messages and therefore simplifies debugging.

Definition at line 66 of file PythonSourceTerm.h.

Referenced by integrate().

◆ _local_assemblers

std::vector<std::unique_ptr<PythonSourceTermLocalAssemblerInterface> > ProcessLib::SourceTerms::Python::PythonSourceTerm::_local_assemblers
private

Local assemblers for all elements of the source term mesh.

Definition at line 61 of file PythonSourceTerm.h.

Referenced by PythonSourceTerm(), and integrate().

◆ _source_term_data

PythonStData ProcessLib::SourceTerms::Python::PythonSourceTerm::_source_term_data
private

Auxiliary data used by the local assemblers.

Definition at line 57 of file PythonSourceTerm.h.

Referenced by PythonSourceTerm().


The documentation for this class was generated from the following files: