18#include <unordered_map>
30namespace SmallDeformation
37template <
typename LocalAssemblerInterface,
38 template <
typename,
int>
class LocalAssemblerDataMatrix,
39 template <
typename,
int>
class LocalAssemblerDataMatrixNearFracture,
40 template <
typename,
int>
class LocalAssemblerDataFracture,
41 int GlobalDim,
typename... ConstructorArgs>
46 template <
typename ElementTraits>
49 if constexpr (GlobalDim < ElementTraits::ShapeFunction::DIM)
55 return ElementTraits::Element::dimension >= 1;
70 using EnabledElementTraits =
72 std::declval<IsElementEnabled>()));
75 [
this, integration_order]<
typename ET>(ET*)
77 using MeshElement =
typename ET::Element;
78 using ShapeFunction =
typename ET::ShapeFunction;
80 _builder[std::type_index(
typeid(MeshElement))] =
92 ConstructorArgs&&... args)
const
94 auto const type_idx = std::type_index(
typeid(mesh_item));
95 auto const it =
_builder.find(type_idx);
100 "You are trying to build a local assembler for an unknown mesh "
101 "element type ({:s})."
102 " Maybe you have disabled this mesh element type in your build "
103 "configuration, or a mesh element order does not match shape "
104 "function order given in the project file.",
109 auto const n_global_components =
113 std::vector<unsigned> dofIndex_to_localIndex;
115 n_global_components > GlobalDim)
117 dofIndex_to_localIndex.resize(n_local_dof);
119 unsigned local_id = 0;
120 for (
auto i : varIDs)
131 getNodeIndex(mesh_item, k));
135 dofIndex_to_localIndex[dof_id++] = local_id;
143 return it->second(mesh_item, varIDs.size(), n_local_dof,
144 dofIndex_to_localIndex,
145 std::forward<ConstructorArgs>(args)...);
151 std::size_t
const n_variables,
152 std::size_t
const local_matrix_size,
153 std::vector<unsigned>
const& dofIndex_to_localIndex,
154 ConstructorArgs&&...)>;
161 template <
typename ShapeFunction>
165 return [integration_order](
167 std::size_t
const n_variables,
168 std::size_t
const local_matrix_size,
169 std::vector<unsigned>
const& dofIndex_to_localIndex,
170 ConstructorArgs&&... args)
172 auto const& integration_method = NumLib::IntegrationMethodRegistry::
173 template getIntegrationMethod<
174 typename ShapeFunction::MeshElement>(integration_order);
178 if (dofIndex_to_localIndex.empty())
181 new LocalAssemblerDataMatrix<ShapeFunction, GlobalDim>{
182 e, local_matrix_size, integration_method,
183 std::forward<ConstructorArgs>(args)...}};
187 new LocalAssemblerDataMatrixNearFracture<ShapeFunction,
189 e, n_variables, local_matrix_size,
190 dofIndex_to_localIndex, integration_method,
191 std::forward<ConstructorArgs>(args)...}};
194 new LocalAssemblerDataFracture<ShapeFunction, GlobalDim>{
195 e, n_variables, local_matrix_size, dofIndex_to_localIndex,
197 std::forward<ConstructorArgs>(args)...}};
202 std::unordered_map<std::type_index, LADataBuilder>
_builder;
virtual unsigned getNumberOfNodes() const =0
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.
std::size_t getMeshID() const
return this mesh ID
std::size_t getNumberOfElementDOF(std::size_t const mesh_item_id) const
GlobalIndexType getGlobalIndex(MeshLib::Location const &l, int const variable_id, int const component_id) const
int getNumberOfVariableComponents(int variable_id) const
MeshLib::MeshSubset const & getMeshSubset(int const variable_id, int const component_id) const
std::size_t getNumberOfElementComponents(std::size_t const mesh_item_id) const
std::vector< int > getElementVariableIDs(std::size_t const mesh_item_id) const
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
void foreach(Function &&f)
decltype(auto) filter(Pred pred)