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

Detailed Description

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

Definition at line 46 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, PythonSourceTermData &&source_term_data, unsigned const integration_order, unsigned const shapefunction_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

PythonSourceTermData _source_term_data
 Auxiliary data. More...
 
std::vector< std::unique_ptr< PythonSourceTermLocalAssemblerInterface > > _local_assemblers
 Local assemblers for all elements of the source term mesh. More...
 
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,
PythonSourceTermData &&  source_term_data,
unsigned const  integration_order,
unsigned const  shapefunction_order,
unsigned const  global_dim,
bool const  flush_stdout 
)
explicit

Definition at line 29 of file PythonSourceTerm.cpp.

34  : SourceTerm(std::move(source_term_dof_table)),
35  _source_term_data(std::move(source_term_data)),
36  _flush_stdout(flush_stdout)
37 {
39  PythonSourceTermLocalAssembler>(
41  *_source_term_dof_table, shapefunction_order, _local_assemblers,
43  integration_order, _source_term_data);
44 }
bool isAxiallySymmetric() const
Definition: Mesh.h:126
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:98
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.
PythonSourceTermData _source_term_data
Auxiliary data.
void createLocalAssemblers(const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
const MeshLib::Mesh & source_term_mesh
The source term mesh, i.e., the (sub-) domain of this source term.

References _local_assemblers, _source_term_data, ProcessLib::SourceTerm::_source_term_dof_table, ProcessLib::BoundaryConditionAndSourceTerm::createLocalAssemblers(), MeshLib::Mesh::getElements(), MeshLib::Mesh::isAxiallySymmetric(), and ProcessLib::SourceTerms::Python::PythonSourceTermData::source_term_mesh.

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 69 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 64 of file PythonSourceTerm.h.

Referenced by PythonSourceTerm(), and integrate().

◆ _source_term_data

PythonSourceTermData ProcessLib::SourceTerms::Python::PythonSourceTerm::_source_term_data
private

Auxiliary data.

Definition at line 60 of file PythonSourceTerm.h.

Referenced by PythonSourceTerm().


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