OGS
CreateLocalAssemblers.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <vector>
13
14#include "BaseLib/Logging.h"
17
18namespace ProcessLib
19{
20namespace BoundaryConditionAndSourceTerm
21{
22namespace detail
23{
24template <int GlobalDim,
25 template <typename /* shp */, typename /* lower order shp */,
26 int /* global dim */>
27 class LocalAssemblerImplementation,
28 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
30 NumLib::LocalToGlobalIndexMap const& dof_table,
31 std::vector<MeshLib::Element*> const& mesh_elements,
32 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
33 NumLib::IntegrationOrder const integration_order,
34 ExtraCtorArgs&&... extra_ctor_args)
35{
36 using LocAsmFactory =
38 LocalAssemblerImplementation, GlobalDim,
39 ExtraCtorArgs...>;
40
41 DBUG("Create local assemblers.");
42
43 NumLib::DefaultIntegrationMethodProvider integration_method_provider{
44 integration_order};
45 LocAsmFactory factory(dof_table, integration_method_provider);
46 local_assemblers.resize(mesh_elements.size());
47
48 DBUG("Calling local assembler builder for all mesh elements.");
50 factory, mesh_elements, local_assemblers,
51 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
52}
53} // namespace detail
65template <template <typename /* shp */, typename /* lower order shp */,
66 int /* global dim */>
67 class LocalAssemblerImplementation,
68 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
70 const unsigned dimension,
71 std::vector<MeshLib::Element*> const& mesh_elements,
72 NumLib::LocalToGlobalIndexMap const& dof_table,
73 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
74 NumLib::IntegrationOrder const integration_order,
75 ExtraCtorArgs&&... extra_ctor_args)
76{
77 DBUG("Create local assemblers.");
78
79 switch (dimension)
80 {
81 case 0:
82 detail::createLocalAssemblersPython<0,
83 LocalAssemblerImplementation>(
84 dof_table, mesh_elements, local_assemblers, integration_order,
85 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
86 break;
87 case 1:
88 detail::createLocalAssemblersPython<1,
89 LocalAssemblerImplementation>(
90 dof_table, mesh_elements, local_assemblers, integration_order,
91 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
92 break;
93 case 2:
94 detail::createLocalAssemblersPython<2,
95 LocalAssemblerImplementation>(
96 dof_table, mesh_elements, local_assemblers, integration_order,
97 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
98 break;
99 case 3:
100 detail::createLocalAssemblersPython<3,
101 LocalAssemblerImplementation>(
102 dof_table, mesh_elements, local_assemblers, integration_order,
103 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
104 break;
105 default:
106 OGS_FATAL(
107 "Meshes with dimension greater than three are not supported.");
108 }
109}
110} // namespace BoundaryConditionAndSourceTerm
111} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void createLocalAssemblersPython(NumLib::LocalToGlobalIndexMap const &dof_table, 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 createLocalAssemblersPython(const unsigned dimension, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, 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)