From 164dbee774b31fd855ab0694daa6475a69c378c6 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 24 Oct 2017 06:31:47 +0200 Subject: [PATCH] [PL/SourceTerms] Impl. of createNodalSourceTerm. --- .../SourceTerms/CreateNodalSourceTerm.cpp | 35 +++++++++++++++++++ .../SourceTerms/CreateNodalSourceTerm.h | 22 ++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp create mode 100644 ProcessLib/SourceTerms/CreateNodalSourceTerm.h diff --git a/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp b/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp new file mode 100644 index 00000000000..990703d9014 --- /dev/null +++ b/ProcessLib/SourceTerms/CreateNodalSourceTerm.cpp @@ -0,0 +1,35 @@ +/** + * \copyright + * Copyright (c) 2012-2017, 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 "CreateNodalSourceTerm.h" + +#include "BaseLib/FileTools.h" +#include "ProcessLib/Utils/ProcessUtils.h" +#include "NodalSourceTerm.h" + +namespace ProcessLib +{ +std::unique_ptr<NodalSourceTerm> createNodalSourceTerm( + BaseLib::ConfigTree const& config, + const NumLib::LocalToGlobalIndexMap& dof_table, std::size_t const mesh_id, + std::size_t const node_id, const int variable_id, const int component_id) +{ + DBUG("Constructing NodalSourceTerm from config."); + //! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__type} + config.checkConfigParameter("type", "Nodal"); + + //! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__Nodal__value} + auto const nodal_value = config.getConfigParameter<double>("value"); + DBUG("Using value %f as nodal source term", nodal_value); + + return std::make_unique<NodalSourceTerm>( + dof_table, mesh_id, node_id, variable_id, component_id, nodal_value); +} + +} // namespace ProcessLib diff --git a/ProcessLib/SourceTerms/CreateNodalSourceTerm.h b/ProcessLib/SourceTerms/CreateNodalSourceTerm.h new file mode 100644 index 00000000000..e480133b5d6 --- /dev/null +++ b/ProcessLib/SourceTerms/CreateNodalSourceTerm.h @@ -0,0 +1,22 @@ +/** + * \copyright + * Copyright (c) 2012-2017, 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 <memory> +#include "ProcessLib/Process.h" + +namespace ProcessLib +{ +std::unique_ptr<NodalSourceTerm> createNodalSourceTerm( + BaseLib::ConfigTree const& config, + const NumLib::LocalToGlobalIndexMap& dof_table, std::size_t mesh_id, + std::size_t const node_id, const int variable_id, const int component_id); + +} // namespace ProcessLib -- GitLab