OGS
ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs > Struct Template Reference

Detailed Description

template<typename LocalAssemblerInterface, typename... ConstructorArgs>
struct ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >

A functor creating a local assembler with shape functions corresponding to the mesh element type.

Definition at line 27 of file GenericLocalAssemblerFactory.h.

#include <GenericLocalAssemblerFactory.h>

Collaboration diagram for ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >:
[legend]

Public Types

using LocAsmIntfPtr = std::unique_ptr< LocalAssemblerInterface >
 
using LocAsmBuilder = std::function< LocAsmIntfPtr(MeshLib::Element const &e, std::size_t const local_matrix_size, ConstructorArgs &&...)>
 

Public Member Functions

LocAsmIntfPtr operator() (std::size_t const id, MeshLib::Element const &mesh_item, ConstructorArgs &&... args) const
 

Protected Member Functions

 GenericLocalAssemblerFactory (NumLib::LocalToGlobalIndexMap const &dof_table)
 

Protected Attributes

std::unordered_map< std::type_index, LocAsmBuilder_builders
 Mapping of element types to local assembler builders. More...
 

Private Attributes

NumLib::LocalToGlobalIndexMap const & _dof_table
 

Member Typedef Documentation

◆ LocAsmBuilder

template<typename LocalAssemblerInterface , typename... ConstructorArgs>
using ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::LocAsmBuilder = std::function<LocAsmIntfPtr(MeshLib::Element const& e, std::size_t const local_matrix_size, ConstructorArgs&&...)>

Definition at line 30 of file GenericLocalAssemblerFactory.h.

◆ LocAsmIntfPtr

template<typename LocalAssemblerInterface , typename... ConstructorArgs>
using ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::LocAsmIntfPtr = std::unique_ptr<LocalAssemblerInterface>

Definition at line 29 of file GenericLocalAssemblerFactory.h.

Constructor & Destructor Documentation

◆ GenericLocalAssemblerFactory()

template<typename LocalAssemblerInterface , typename... ConstructorArgs>
ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::GenericLocalAssemblerFactory ( NumLib::LocalToGlobalIndexMap const &  dof_table)
inlineexplicitprotected

Definition at line 36 of file GenericLocalAssemblerFactory.h.

38  : _dof_table(dof_table)
39  {
40  }
NumLib::LocalToGlobalIndexMap const & _dof_table

Member Function Documentation

◆ operator()()

template<typename LocalAssemblerInterface , typename... ConstructorArgs>
LocAsmIntfPtr ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::operator() ( std::size_t const  id,
MeshLib::Element const &  mesh_item,
ConstructorArgs &&...  args 
) const
inline

Returns the newly created local assembler.

Attention
The index id is not necessarily the mesh item's id. Especially when having multiple meshes it will differ from the latter.

Definition at line 48 of file GenericLocalAssemblerFactory.h.

51  {
52  auto const type_idx = std::type_index(typeid(mesh_item));
53  auto const it = _builders.find(type_idx);
54 
55  if (it != _builders.end())
56  {
57  auto const num_local_dof = _dof_table.getNumberOfElementDOF(id);
58  return it->second(mesh_item, num_local_dof,
59  std::forward<ConstructorArgs>(args)...);
60  }
61  OGS_FATAL(
62  "You are trying to build a local assembler for an unknown mesh "
63  "element type ({:s})."
64  " Maybe you have disabled this mesh element type in your build "
65  "configuration, or a mesh element order does not match shape "
66  "function order given in the project file.",
67  type_idx.name());
68  }
#define OGS_FATAL(...)
Definition: Error.h:26
std::size_t getNumberOfElementDOF(std::size_t const mesh_item_id) const
std::unordered_map< std::type_index, LocAsmBuilder > _builders
Mapping of element types to local assembler builders.

References ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::_builders, ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::_dof_table, NumLib::LocalToGlobalIndexMap::getNumberOfElementDOF(), and OGS_FATAL.

Member Data Documentation

◆ _builders

template<typename LocalAssemblerInterface , typename... ConstructorArgs>
std::unordered_map<std::type_index, LocAsmBuilder> ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::_builders
protected

Mapping of element types to local assembler builders.

Definition at line 75 of file GenericLocalAssemblerFactory.h.

Referenced by ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::operator()().

◆ _dof_table

template<typename LocalAssemblerInterface , typename... ConstructorArgs>
NumLib::LocalToGlobalIndexMap const& ProcessLib::GenericLocalAssemblerFactory< LocalAssemblerInterface, ConstructorArgs >::_dof_table
private

The documentation for this struct was generated from the following file: