Skip to content
Snippets Groups Projects
Commit 06bc12c9 authored by Tom Fischer's avatar Tom Fischer
Browse files

[PL] Init. impl. of class SourceTermCollection.

parent 060810d7
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "SourceTermCollection.h"
namespace ProcessLib
{
void SourceTermCollection::addSourceTermsForProcessVariables(
std::vector<std::reference_wrapper<ProcessVariable>> const&
process_variables,
NumLib::LocalToGlobalIndexMap const& dof_table,
unsigned const integration_order)
{
for (int variable_id = 0;
variable_id < static_cast<int>(process_variables.size());
++variable_id)
{
ProcessVariable& pv = process_variables[variable_id];
auto sts = pv.createSourceTerms(dof_table, variable_id,
integration_order, _parameters);
std::move(sts.begin(), sts.end(), std::back_inserter(_source_terms));
}
}
void SourceTermCollection::integrateNodalSourceTerms(const double t,
GlobalVector& b) const
{
for (auto const& st : _source_terms)
st->integrateNodalSourceTerm(t, b);
}
}
/**
* \copyright
* Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include "ProcessLib/ProcessVariable.h"
#include "ProcessLib/SourceTerms/NodalSourceTerm.h"
namespace ProcessLib
{
class SourceTermCollection final
{
public:
SourceTermCollection(
std::vector<std::unique_ptr<ParameterBase>> const& parameters)
: _parameters(parameters)
{
}
void integrateNodalSourceTerms(const double t, GlobalVector& b) const;
void addSourceTermsForProcessVariables(
std::vector<std::reference_wrapper<ProcessVariable>> const&
process_variables,
NumLib::LocalToGlobalIndexMap const& dof_table,
unsigned const integration_order);
private:
std::vector<std::unique_ptr<NodalSourceTerm>> _source_terms;
std::vector<std::unique_ptr<ParameterBase>> const& _parameters;
};
} // ProcessLib
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment