OGS 6.2.0-97-g4a610c866
CreateLocalAssemblers.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <vector>
12 
13 #include <logog/include/logog.hpp>
14 
16 
17 #include "LocalDataInitializer.h"
18 
19 
20 namespace ProcessLib
21 {
22 
23 namespace detail
24 {
25 template <unsigned GlobalDim, template <typename, typename, unsigned>
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  ExtraCtorArgs&&... extra_ctor_args)
34 {
35  // Shape matrices initializer
36  using LocalDataInitializer =
37  LocalDataInitializer<LocalAssemblerInterface,
38  LocalAssemblerImplementation, GlobalDim,
39  ExtraCtorArgs...>;
40 
41  DBUG("Create local assemblers.");
42  // Populate the vector of local assemblers.
43  local_assemblers.resize(mesh_elements.size());
44 
45  LocalDataInitializer initializer(dof_table, shapefunction_order);
46 
47  DBUG("Calling local assembler builder for all mesh elements.");
49  initializer, mesh_elements, local_assemblers,
50  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
51 }
52 
53 } // namespace detail
54 
66 template <template <typename, typename, unsigned>
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  ExtraCtorArgs&&... extra_ctor_args)
76 {
77  DBUG("Create local assemblers.");
78 
79  switch (dimension)
80  {
81  case 1:
82  detail::createLocalAssemblers<1, LocalAssemblerImplementation>(
83  dof_table, shapefunction_order, mesh_elements, local_assemblers,
84  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
85  break;
86  case 2:
87  detail::createLocalAssemblers<2, LocalAssemblerImplementation>(
88  dof_table, shapefunction_order, mesh_elements, local_assemblers,
89  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
90  break;
91  case 3:
92  detail::createLocalAssemblers<3, LocalAssemblerImplementation>(
93  dof_table, shapefunction_order, mesh_elements, local_assemblers,
94  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
95  break;
96  default:
97  OGS_FATAL(
98  "Meshes with dimension greater than three are not supported.");
99  }
100 }
101 
102 } // namespace ProcessLib
static void transformDereferenced(F const &f, C const &c, Data &data, Args_ &&... args)
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)
#define OGS_FATAL(fmt,...)
Definition: Error.h:63