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{
36 static_assert(
37 GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
38 "Meshes with dimension greater than three are not supported.");
39
42 LocalAssemblerImplementation, GlobalDim,
43 ExtraCtorArgs...>;
44
45 DBUG("Create local assemblers.");
46
47 NumLib::DefaultIntegrationMethodProvider integration_method_provider{
48 integration_order};
49 LocalAssemblerFactory factory(dof_table, integration_method_provider,
50 shapefunction_order);
51 local_assemblers.resize(mesh_elements.size());
52
53 DBUG("Calling local assembler builder for all mesh elements.");
55 factory, mesh_elements, local_assemblers,
56 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
57}
58} // namespace detail
70template <template <typename /* shp fct */, int /* global dim */>
71 class LocalAssemblerImplementation,
72 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
74 const unsigned dimension,
75 std::vector<MeshLib::Element*> const& mesh_elements,
76 NumLib::LocalToGlobalIndexMap const& dof_table,
77 const unsigned shapefunction_order,
78 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
79 NumLib::IntegrationOrder const integration_order,
80 ExtraCtorArgs&&... extra_ctor_args)
81{
82 DBUG("Create local assemblers.");
83
84 switch (dimension)
85 {
86 case 1:
87 detail::createLocalAssemblers<1, LocalAssemblerImplementation>(
88 dof_table, shapefunction_order, mesh_elements, local_assemblers,
89 integration_order,
90 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
91 break;
92 case 2:
93 detail::createLocalAssemblers<2, LocalAssemblerImplementation>(
94 dof_table, shapefunction_order, mesh_elements, local_assemblers,
95 integration_order,
96 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
97 break;
98 case 3:
99 detail::createLocalAssemblers<3, LocalAssemblerImplementation>(
100 dof_table, shapefunction_order, mesh_elements, local_assemblers,
101 integration_order,
102 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
103 break;
104 default:
105 OGS_FATAL(
106 "Meshes with dimension greater than three are not supported.");
107 }
108}
109} // namespace BoundaryConditionAndSourceTerm
110} // 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)