Loading [MathJax]/extensions/tex2jax.js
OGS
SourceTermCollection.cpp
Go to the documentation of this file.
1
12
13#include <range/v3/view/filter.hpp>
14
15namespace ProcessLib
16{
18 std::vector<std::reference_wrapper<ProcessVariable>> const&
19 process_variables,
20 NumLib::LocalToGlobalIndexMap const& dof_table,
21 unsigned const integration_order,
22 const MeshLib::Mesh& bulk_mesh)
23{
24 for (int variable_id = 0;
25 variable_id < static_cast<int>(process_variables.size());
26 ++variable_id)
27 {
28 ProcessVariable& pv = process_variables[variable_id];
29 auto sts =
30 pv.createSourceTerms(dof_table, variable_id, integration_order,
31 _parameters, process_variables, bulk_mesh);
32
33 std::move(sts.begin(), sts.end(), std::back_inserter(_source_terms));
34 }
35}
36
37void SourceTermCollection::integrate(const double t, GlobalVector const& x,
38 GlobalVector& b, GlobalMatrix* jac) const
39{
40 // For parallel computing with DDC, a partition may not have source term
41 // but a nullptr is assigned to its element in _source_terms.
42 auto non_nullptr = [](std::unique_ptr<SourceTermBase> const& st)
43 { return st != nullptr; };
44
45 for (auto const& st : _source_terms | ranges::views::filter(non_nullptr))
46 {
47 st->integrate(t, x, b, jac);
48 }
49}
50
51} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
std::vector< std::unique_ptr< SourceTermBase > > createSourceTerms(const NumLib::LocalToGlobalIndexMap &dof_table, const int variable_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, const MeshLib::Mesh &bulk_mesh)
void integrate(const double t, GlobalVector const &x, GlobalVector &b, GlobalMatrix *jac) const
void addSourceTermsForProcessVariables(std::vector< std::reference_wrapper< ProcessVariable > > const &process_variables, NumLib::LocalToGlobalIndexMap const &dof_table, unsigned const integration_order, const MeshLib::Mesh &bulk_mesh)
std::vector< std::unique_ptr< SourceTermBase > > _source_terms
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & _parameters