OGS
CreateLocalAssemblers.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <vector>
13
14#include "BaseLib/Logging.h"
18
19namespace ProcessLib
20{
21template <int GlobalDim,
22 template <typename /* shp fct */, int /* global dim*/>
23 class LocalAssemblerImplementation,
24 typename LocalAssemblerInterface,
25 IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder,
26 typename... ExtraCtorArgs>
28 std::vector<MeshLib::Element*> const& mesh_elements,
29 NumLib::LocalToGlobalIndexMap const& dof_table,
30 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
31 ProviderOrOrder const& provider_or_order,
32 ExtraCtorArgs&&... extra_ctor_args)
33{
34 static_assert(
35 GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
36 "Meshes with dimension greater than three are not supported.");
37
38 DBUG("Create local assemblers.");
39
40 auto const& integration_method_provider =
41 getIntegrationMethodProvider(provider_or_order);
42
43 using IntegrationMethodProvider =
44 std::remove_cvref_t<decltype(integration_method_provider)>;
45 using LocAsmFac = LocalAssemblerFactory<
46 LocalAssemblerInterface, LocalAssemblerImplementation,
47 IntegrationMethodProvider, GlobalDim, ExtraCtorArgs...>;
48
49 LocAsmFac factory(dof_table, integration_method_provider);
50 local_assemblers.resize(mesh_elements.size());
51
52 DBUG("Calling local assembler builder for all mesh elements.");
54 factory, mesh_elements, local_assemblers,
55 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
56}
57
69template <template <typename /* shp fct */, int /* global dim */>
70 class LocalAssemblerImplementation,
71 typename LocalAssemblerInterface,
72 IntegrationMethodProviderOrIntegrationOrder ProviderOrOrder,
73 typename... ExtraCtorArgs>
75 const unsigned dimension,
76 std::vector<MeshLib::Element*> const& mesh_elements,
77 NumLib::LocalToGlobalIndexMap const& dof_table,
78 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
79 ProviderOrOrder const& provider_or_order,
80 ExtraCtorArgs&&... extra_ctor_args)
81{
82 DBUG("Create local assemblers.");
83
84 switch (dimension)
85 {
86 case 1:
87 createLocalAssemblers<1, LocalAssemblerImplementation>(
88 mesh_elements, dof_table, local_assemblers, provider_or_order,
89 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
90 break;
91 case 2:
92 createLocalAssemblers<2, LocalAssemblerImplementation>(
93 mesh_elements, dof_table, local_assemblers, provider_or_order,
94 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
95 break;
96 case 3:
97 createLocalAssemblers<3, LocalAssemblerImplementation>(
98 mesh_elements, dof_table, local_assemblers, provider_or_order,
99 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
100 break;
101 default:
102 OGS_FATAL(
103 "Meshes with dimension greater than three are not supported.");
104 }
105}
106
107} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void createLocalAssemblers(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)