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, typename, int> class LocalAssemblerImplementation,
26 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
28 NumLib::LocalToGlobalIndexMap const& dof_table,
29 const unsigned shapefunction_order,
30 std::vector<MeshLib::Element*> const& mesh_elements,
31 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
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
40 LocalAssemblerImplementation, GlobalDim,
41 ExtraCtorArgs...>;
42
43 DBUG("Create local assemblers.");
44
45 LocalAssemblerFactory factory(dof_table, shapefunction_order);
46 local_assemblers.resize(mesh_elements.size());
47
48 DBUG("Calling local assembler builder for all mesh elements.");
50 factory, mesh_elements, local_assemblers,
51 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
52}
53} // namespace detail
65template <template <typename, typename, int> class LocalAssemblerImplementation,
66 typename LocalAssemblerInterface, typename... ExtraCtorArgs>
68 const unsigned dimension,
69 std::vector<MeshLib::Element*> const& mesh_elements,
70 NumLib::LocalToGlobalIndexMap const& dof_table,
71 const unsigned shapefunction_order,
72 std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
73 ExtraCtorArgs&&... extra_ctor_args)
74{
75 DBUG("Create local assemblers.");
76
77 switch (dimension)
78 {
79 case 1:
80 detail::createLocalAssemblers<1, LocalAssemblerImplementation>(
81 dof_table, shapefunction_order, mesh_elements, local_assemblers,
82 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
83 break;
84 case 2:
85 detail::createLocalAssemblers<2, LocalAssemblerImplementation>(
86 dof_table, shapefunction_order, mesh_elements, local_assemblers,
87 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
88 break;
89 case 3:
90 detail::createLocalAssemblers<3, LocalAssemblerImplementation>(
91 dof_table, shapefunction_order, mesh_elements, local_assemblers,
92 std::forward<ExtraCtorArgs>(extra_ctor_args)...);
93 break;
94 default:
96 "Meshes with dimension greater than three are not supported.");
97 }
98}
99} // namespace BoundaryConditionAndSourceTerm
100} // 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, const unsigned shapefunction_order, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, 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, ExtraCtorArgs &&... extra_ctor_args)
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)