OGS
CreateEmbeddedAnchor.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
7#include "BaseLib/Logging.h"
8#include "EmbeddedAnchor.h"
10
11namespace ProcessLib
12{
13template <int GlobalDim>
14std::unique_ptr<SourceTermBase> createEmbeddedAnchor(
15 BaseLib::ConfigTree const& config, MeshLib::Mesh const& st_mesh,
16 MeshLib::Mesh const& bulk_mesh,
17 NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
18 std::size_t const source_term_mesh_id, const int variable_id)
19{
20 DBUG("Constructing EmbeddedAnchor from config.");
21 // ...special is necessary, because EmbeddedAnchor has no configuration via
22 // child tags, hence it wouldn't be handled properly by the documentation
23 // scripts otherwise.
26 config.checkConfigParameter("type", "EmbeddedAnchor");
27
28 for (MeshLib::Element const* const element : st_mesh.getElements())
29 {
30 if (element->getNumberOfNodes() != 2)
31 {
33 "Every anchor element needs to have precisely two nodes.");
34 }
35 }
36#ifdef USE_PETSC
38 "The EmbeddedAnchor source term has not been tested with PETSc yet.");
39#endif
40
41 return std::make_unique<EmbeddedAnchor<GlobalDim>>(
42 bulk_mesh, dof_table_bulk, source_term_mesh_id, st_mesh, variable_id);
43}
44
45template std::unique_ptr<SourceTermBase> createEmbeddedAnchor<2>(
46 BaseLib::ConfigTree const& config, MeshLib::Mesh const& st_mesh,
47 MeshLib::Mesh const& bulk_mesh,
48 NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
49 std::size_t const source_term_mesh_id, const int variable_id);
50
51template std::unique_ptr<SourceTermBase> createEmbeddedAnchor<3>(
52 BaseLib::ConfigTree const& config, MeshLib::Mesh const& st_mesh,
53 MeshLib::Mesh const& bulk_mesh,
54 NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
55 std::size_t const source_term_mesh_id, const int variable_id);
56} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:100
template std::unique_ptr< SourceTermBase > createEmbeddedAnchor< 2 >(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
template std::unique_ptr< SourceTermBase > createEmbeddedAnchor< 3 >(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)
std::unique_ptr< SourceTermBase > createEmbeddedAnchor(BaseLib::ConfigTree const &config, MeshLib::Mesh const &st_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, std::size_t const source_term_mesh_id, const int variable_id)