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{
20template <int GlobalDim,
21 template <typename, typename, int> class LocalAssemblerImplementation,
22 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
24 NumLib::LocalToGlobalIndexMap const& dof_table,
25 std::vector<MeshLib::Element*> const& mesh_elements,
26 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
27 ExtraCtorArgs&&... extra_ctor_args)
28{
29 static_assert(
30 GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
31 "Meshes with dimension greater than three are not supported.");
32
34 LocalAssemblerImplementation,
35 GlobalDim, ExtraCtorArgs...>;
36
37 DBUG("Create local assemblers.");
38
39 LocAsmFactory factory(dof_table);
40 local_assemblers.resize(mesh_elements.size());
41
42 DBUG("Calling local assembler builder for all mesh elements.");
44 factory, mesh_elements, local_assemblers,
45 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
46}
47
59template <template <typename, typename, int> class LocalAssemblerImplementation,
60 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
62 const unsigned dimension,
63 std::vector<MeshLib::Element*> const& mesh_elements,
64 NumLib::LocalToGlobalIndexMap const& dof_table,
65 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
66 ExtraCtorArgs&&... extra_ctor_args)
67{
68 DBUG("Create local assemblers.");
69
70 switch (dimension)
71 {
72 case 1:
73 createLocalAssemblers<1, LocalAssemblerImplementation>(
74 dof_table, mesh_elements, local_assemblers,
75 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
76 break;
77 case 2:
78 createLocalAssemblers<2, LocalAssemblerImplementation>(
79 dof_table, mesh_elements, local_assemblers,
80 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
81 break;
82 case 3:
83 createLocalAssemblers<3, LocalAssemblerImplementation>(
84 dof_table, mesh_elements, local_assemblers,
85 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
86 break;
87 default:
89 "Meshes with dimension greater than three are not supported.");
90 }
91}
92
93} // namespace ProcessLib
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:29
void createLocalAssemblers(NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< MeshLib::Element * > const &mesh_elements, 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)