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 fct */, int /* global dim */>
26 class LocalAssemblerImplementation,
27 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
29 NumLib::LocalToGlobalIndexMap const& dof_table,
30 const unsigned shapefunction_order,
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{
38 LocalAssemblerImplementation, GlobalDim,
39 ExtraCtorArgs...>;
40
41 DBUG("Create local assemblers.");
42
43 NumLib::DefaultIntegrationMethodProvider integration_method_provider{
44 integration_order};
45 LocalAssemblerFactory factory(dof_table, integration_method_provider,
46 shapefunction_order);
47 local_assemblers.resize(mesh_elements.size());
48
49 DBUG("Calling local assembler builder for all mesh elements.");
51 factory, mesh_elements, local_assemblers,
52 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
53}
54} // namespace detail
66template <template <typename /* shp fct */, 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 const unsigned shapefunction_order,
74 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
75 NumLib::IntegrationOrder const integration_order,
76 ExtraCtorArgs&&... extra_ctor_args)
77{
78 DBUG("Create local assemblers.");
79
80 switch (dimension)
81 {
82 case 0:
83 detail::createLocalAssemblers<0, LocalAssemblerImplementation>(
84 dof_table, shapefunction_order, mesh_elements, local_assemblers,
85 integration_order,
86 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
87 break;
88 case 1:
89 detail::createLocalAssemblers<1, LocalAssemblerImplementation>(
90 dof_table, shapefunction_order, mesh_elements, local_assemblers,
91 integration_order,
92 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
93 break;
94 case 2:
95 detail::createLocalAssemblers<2, LocalAssemblerImplementation>(
96 dof_table, shapefunction_order, mesh_elements, local_assemblers,
97 integration_order,
98 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
99 break;
100 case 3:
101 detail::createLocalAssemblers<3, LocalAssemblerImplementation>(
102 dof_table, shapefunction_order, mesh_elements, local_assemblers,
103 integration_order,
104 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
105 break;
106 default:
107 OGS_FATAL(
108 "Meshes with dimension greater than three are not supported.");
109 }
110}
111} // namespace BoundaryConditionAndSourceTerm
112} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
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)