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{
23 for (int variable_id = 0;
24 variable_id < static_cast<int>(process_variables.size());
25 ++variable_id)
26 {
27 ProcessVariable& pv = process_variables[variable_id];
28 auto sts =
29 pv.createSourceTerms(dof_table, variable_id, integration_order,
30 _parameters, process_variables);
31
32 std::move(sts.begin(), sts.end(), std::back_inserter(_source_terms));
33 }
34}
35
36void SourceTermCollection::integrate(const double t, GlobalVector const& x,
37 GlobalVector& b, GlobalMatrix* jac) const
38{
39 // For parallel computing with DDC, a partition may not have source term
40 // but a nullptr is assigned to its element in _source_terms.
41 auto non_nullptr = [](std::unique_ptr<SourceTerm> const& st)
42 { return st != nullptr; };
43
44 for (auto const& st : _source_terms | ranges::views::filter(non_nullptr))
45 {
46 st->integrate(t, x, b, jac);
47 }
48}
49
50} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
std::vector< std::unique_ptr< SourceTerm > > 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)
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)
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & _parameters
std::vector< std::unique_ptr< SourceTerm > > _source_terms