OGS
BoundaryConditionAndSourceTerm/Utils/CreateLocalAssemblers.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
8#include "BaseLib/Logging.h"
11
12namespace ProcessLib
13{
15{
16namespace detail
17{
18template <int GlobalDim,
19 template <typename /* shp fct */, int /* global dim */>
20 class LocalAssemblerImplementation,
21 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
23 NumLib::LocalToGlobalIndexMap const& dof_table,
24 const unsigned shapefunction_order,
25 std::vector<MeshLib::Element*> const& mesh_elements,
26 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
27 NumLib::IntegrationOrder const integration_order,
28 ExtraCtorArgs&&... extra_ctor_args)
29{
32 LocalAssemblerImplementation, GlobalDim,
33 ExtraCtorArgs...>;
34
35 DBUG("Create local assemblers.");
36
37 NumLib::DefaultIntegrationMethodProvider integration_method_provider{
38 integration_order};
39 LocalAssemblerFactory factory(dof_table, integration_method_provider,
40 shapefunction_order);
41 local_assemblers.resize(mesh_elements.size());
42
43 DBUG("Calling local assembler builder for all mesh elements.");
45 factory, mesh_elements, local_assemblers,
46 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
47}
48} // namespace detail
60template <template <typename /* shp fct */, int /* global dim */>
61 class LocalAssemblerImplementation,
62 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
64 const unsigned dimension,
65 std::vector<MeshLib::Element*> const& mesh_elements,
66 NumLib::LocalToGlobalIndexMap const& dof_table,
67 const unsigned shapefunction_order,
68 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
69 NumLib::IntegrationOrder const integration_order,
70 ExtraCtorArgs&&... extra_ctor_args)
71{
72 DBUG("Create local assemblers.");
73
74 switch (dimension)
75 {
76 case 0:
78 dof_table, shapefunction_order, mesh_elements, local_assemblers,
79 integration_order,
80 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
81 break;
82 case 1:
84 dof_table, shapefunction_order, mesh_elements, local_assemblers,
85 integration_order,
86 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
87 break;
88 case 2:
90 dof_table, shapefunction_order, mesh_elements, local_assemblers,
91 integration_order,
92 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
93 break;
94 case 3:
96 dof_table, shapefunction_order, mesh_elements, local_assemblers,
97 integration_order,
98 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
99 break;
100 default:
101 OGS_FATAL(
102 "Meshes with dimension greater than three are not supported.");
103 }
104}
105} // namespace BoundaryConditionAndSourceTerm
106} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
void createLocalAssemblers(NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, NumLib::IntegrationOrder const integration_order, ExtraCtorArgs &&... extra_ctor_args)
void createLocalAssemblers(const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, NumLib::IntegrationOrder const integration_order, ExtraCtorArgs &&... extra_ctor_args)
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)