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 typename /* int meth */, 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 ExtraCtorArgs&&... extra_ctor_args)
34{
35 static_assert(
36 GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
37 "Meshes with dimension greater than three are not supported.");
38
39 using LocAsmFactory =
41 LocalAssemblerImplementation, GlobalDim,
42 ExtraCtorArgs...>;
43
44 DBUG("Create local assemblers.");
45
46 LocAsmFactory factory(dof_table);
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 */, typename /* lower order shp */,
67 typename /* int meth */, int /* global dim */>
68 class LocalAssemblerImplementation,
69 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
71 const unsigned dimension,
72 std::vector<MeshLib::Element*> const& mesh_elements,
73 NumLib::LocalToGlobalIndexMap const& dof_table,
74 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
75 ExtraCtorArgs&&... extra_ctor_args)
76{
77 DBUG("Create local assemblers.");
78
79 switch (dimension)
80 {
81 case 1:
83 LocalAssemblerImplementation>(
84 dof_table, mesh_elements, local_assemblers,
85 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
86 break;
87 case 2:
89 LocalAssemblerImplementation>(
90 dof_table, mesh_elements, local_assemblers,
91 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
92 break;
93 case 3:
95 LocalAssemblerImplementation>(
96 dof_table, mesh_elements, local_assemblers,
97 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
98 break;
99 default:
100 OGS_FATAL(
101 "Meshes with dimension greater than three are not supported.");
102 }
103}
104} // namespace BoundaryConditionAndSourceTerm
105} // namespace ProcessLib
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:29
void createLocalAssemblersPython(NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, 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, ExtraCtorArgs &&... extra_ctor_args)
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)