CreateNodalSourceTerm.cpp 1.65 KB
Newer Older
1
/**
2
 * \file
3
 * \copyright
4
 * Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org)
5
6
7
8
9
10
11
12
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "CreateNodalSourceTerm.h"

13
#include "BaseLib/ConfigTree.h"
Dmitry Yu. Naumov's avatar
Dmitry Yu. Naumov committed
14
#include "BaseLib/Logging.h"
15
#include "NodalSourceTerm.h"
Dmitry Yu. Naumov's avatar
Dmitry Yu. Naumov committed
16
#include "ParameterLib/Utils.h"
17
18
19

namespace ProcessLib
{
20
std::unique_ptr<SourceTerm> createNodalSourceTerm(
21
    BaseLib::ConfigTree const& config, MeshLib::Mesh const& st_mesh,
22
23
    std::unique_ptr<NumLib::LocalToGlobalIndexMap> dof_table,
    std::size_t const source_term_mesh_id, const int variable_id,
24
    const int component_id,
25
    std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
26
27
28
29
30
{
    DBUG("Constructing NodalSourceTerm from config.");
    //! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__type}
    config.checkConfigParameter("type", "Nodal");

31
    //! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__Nodal__parameter}
32
    auto const param_name = config.getConfigParameter<std::string>("parameter");
33
    DBUG("Using parameter {:s} as nodal source term.", param_name);
34

35
36
    auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
                                                      &st_mesh);
37

38
39
    return std::make_unique<NodalSourceTerm>(std::move(dof_table),
                                             source_term_mesh_id, st_mesh,
40
                                             variable_id, component_id, param);
41
42
43
}

}  // namespace ProcessLib