16#include <unordered_map>
32 std::same_as<T, NumLib::IntegrationOrder>;
36template <
typename LocalAssemblerInterface,
38 typename... ConstructorArgs>
44 std::size_t
const local_matrix_size,
45 IntegrationMethodProvider
const& integration_method_provider,
46 ConstructorArgs&&...)>;
51 IntegrationMethodProvider
const& integration_method_provider)
65 ConstructorArgs&&... args)
const
67 auto const type_idx = std::type_index(
typeid(mesh_item));
73 return it->second(mesh_item, num_local_dof,
75 std::forward<ConstructorArgs>(args)...);
78 "You are trying to build a local assembler for an unknown mesh "
79 "element type ({:s})."
80 " Maybe you have disabled this mesh element type in your build "
81 "configuration, or a mesh element order does not match shape "
82 "function order given in the project file.",
92 std::unordered_map<std::type_index, LocAsmBuilder>
_builders;
96 template <
typename ,
int >
97 class LocalAssemblerImplementation,
98 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
99 int GlobalDim, typename... ConstructorArgs>
107 using LocAsmImpl = LocalAssemblerImplementation<ShapeFunction, GlobalDim>;
114 template <
typename MeshElement>
118 std::size_t
const local_matrix_size,
119 IntegrationMethodProvider
const& integration_method_provider,
120 ConstructorArgs&&... args)
122 auto const& integration_method =
123 integration_method_provider
124 .template getIntegrationMethod<MeshElement>(e);
126 static_assert(!std::is_abstract_v<LocAsmImpl>,
127 "The given local assembler implementation is an "
128 "abstract class, which cannot be instantiated. Make "
129 "sure to implement all virtual methods!");
132 std::is_constructible_v<
134 decltype(integration_method), ConstructorArgs&&...>,
135 "The given local assembler implementation is not "
136 "constructible from the provided arguments.");
138 return std::make_unique<LocAsmImpl>(
139 e, local_matrix_size, integration_method,
140 std::forward<ConstructorArgs>(args)...);
std::size_t getNumberOfElementDOF(std::size_t const mesh_item_id) const
typename GLAF::LocAsmBuilder LocAsmBuilder
typename GLAF::LocAsmIntfPtr LocAsmIntfPtr
LocalAssemblerImplementation< ShapeFunction, GlobalDim > LocAsmImpl
static LocAsmBuilder create()
LocalAssemblerBuilderFactory()=delete
std::unordered_map< std::type_index, LocAsmBuilder > _builders
Mapping of element types to local assembler builders.
IntegrationMethodProvider const & _integration_method_provider
GenericLocalAssemblerFactory(NumLib::LocalToGlobalIndexMap const &dof_table, IntegrationMethodProvider const &integration_method_provider)
std::function< LocAsmIntfPtr( MeshLib::Element const &e, std::size_t const local_matrix_size, IntegrationMethodProvider const &integration_method_provider, ConstructorArgs &&...)> LocAsmBuilder
NumLib::LocalToGlobalIndexMap const & _dof_table
std::unique_ptr< LocalAssemblerInterface > LocAsmIntfPtr
LocAsmIntfPtr operator()(std::size_t const id, MeshLib::Element const &mesh_item, ConstructorArgs &&... args) const