9#include <unordered_map>
25 std::same_as<T, NumLib::IntegrationOrder>;
31 typename... ConstructorArgs>
37 std::size_t
const local_matrix_size,
38 IntegrationMethodProvider
const& integration_method_provider,
39 ConstructorArgs&&...)>;
44 IntegrationMethodProvider
const& integration_method_provider)
58 ConstructorArgs&&... args)
const
60 auto const type_idx = std::type_index(
typeid(mesh_item));
65 auto const num_local_dof =
_dof_table.getNumberOfElementDOF(
id);
66 return it->second(mesh_item, num_local_dof,
68 std::forward<ConstructorArgs>(args)...);
71 "You are trying to build a local assembler for an unknown mesh "
72 "element type ({:s})."
73 " Maybe you have disabled this mesh element type in your build "
74 "configuration, or a mesh element order does not match shape "
75 "function order given in the project file.",
85 std::unordered_map<std::type_index, LocAsmBuilder>
_builders;
89 template <
typename ,
int >
90 class LocalAssemblerImplementation,
91 NumLib::IntegrationMethodProvider IntegrationMethodProvider,
92 int GlobalDim, typename... ConstructorArgs>
100 using LocAsmImpl = LocalAssemblerImplementation<ShapeFunction, GlobalDim>;
107 template <
typename MeshElement>
111 std::size_t
const local_matrix_size,
112 IntegrationMethodProvider
const& integration_method_provider,
113 ConstructorArgs&&... args)
115 auto const& integration_method =
116 integration_method_provider
117 .template getIntegrationMethod<MeshElement>(e);
119 static_assert(!std::is_abstract_v<LocAsmImpl>,
120 "The given local assembler implementation is an "
121 "abstract class, which cannot be instantiated. Make "
122 "sure to implement all virtual methods!");
125 std::is_constructible_v<
127 decltype(integration_method), ConstructorArgs&&...>,
128 "The given local assembler implementation is not "
129 "constructible from the provided arguments.");
131 return std::make_unique<LocAsmImpl>(
132 e, local_matrix_size, integration_method,
133 std::forward<ConstructorArgs>(args)...);
typename GLAF::LocAsmBuilder LocAsmBuilder
typename GLAF::LocAsmIntfPtr LocAsmIntfPtr
LocalAssemblerImplementation< ShapeFunction, GlobalDim > LocAsmImpl
static LocAsmBuilder create()
GenericLocalAssemblerFactory< LocalAssemblerInterface, IntegrationMethodProvider, ConstructorArgs... > GLAF
LocalAssemblerBuilderFactory()=delete
std::unordered_map< std::type_index, LocAsmBuilder > _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