75 : _dof_table(dof_table)
77 using EnabledElementTraits =
78 decltype(BaseLib::TMP::filter<EnabledElementTraitsLagrange>(
79 std::declval<IsElementEnabled>()));
81 BaseLib::TMP::foreach<EnabledElementTraits>(
82 [
this, integration_order]<
typename ET>(ET*)
84 using MeshElement =
typename ET::Element;
85 using ShapeFunction =
typename ET::ShapeFunction;
86 using LowerOrderShapeFunction =
87 typename ET::LowerOrderShapeFunction;
89 _builder[std::type_index(
typeid(MeshElement))] =
90 makeLocalAssemblerBuilder<ShapeFunction,
91 LowerOrderShapeFunction>(
103 ConstructorArgs&&... args)
const
105 auto const type_idx = std::type_index(
typeid(mesh_item));
106 auto const it = _builder.find(type_idx);
108 if (it == _builder.end())
111 "You are trying to build a local assembler for an unknown mesh "
112 "element type ({:s})."
113 " Maybe you have disabled this mesh element type in your build "
114 "configuration, or a mesh element order does not match shape "
115 "function order given in the project file.",
119 auto const n_local_dof = _dof_table.getNumberOfElementDOF(
id);
120 auto const varIDs = _dof_table.getElementVariableIDs(
id);
121 bool const isPressureDeactivated = (varIDs.front() != 0);
122 std::vector<int> involved_varIDs;
123 involved_varIDs.reserve(varIDs.size() + 1);
124 if (isPressureDeactivated)
126 involved_varIDs.push_back(0);
128 involved_varIDs.insert(involved_varIDs.end(), varIDs.begin(),
131 std::vector<unsigned> dofIndex_to_localIndex;
134 dofIndex_to_localIndex.resize(n_local_dof);
135 std::vector<unsigned> vec_n_element_nodes;
137 vec_n_element_nodes.push_back(
139 auto const max_varID = *std::max_element(varIDs.begin(), varIDs.end());
140 for (
int i = 1; i < max_varID + 1; i++)
142 vec_n_element_nodes.push_back(
146 unsigned local_id = 0;
148 for (
unsigned i = 0; i < involved_varIDs.size(); i++)
150 auto const var_id = involved_varIDs[i];
151 auto const n_var_comp =
152 _dof_table.getNumberOfVariableComponents(var_id);
153 auto const n_var_element_nodes = vec_n_element_nodes[i];
154 for (
int var_comp_id = 0; var_comp_id < n_var_comp; var_comp_id++)
156 auto const& ms = _dof_table.getMeshSubset(var_id, var_comp_id);
157 auto const mesh_id = ms.getMeshID();
158 for (
unsigned k = 0; k < n_var_element_nodes; k++)
162 getNodeIndex(mesh_item, k));
164 _dof_table.getGlobalIndex(l, var_id, var_comp_id);
167 dofIndex_to_localIndex[dof_id++] = local_id;
174 return it->second(mesh_item, involved_varIDs.size(), n_local_dof,
175 dofIndex_to_localIndex,
176 std::forward<ConstructorArgs>(args)...);
198 return [integration_order](
200 std::size_t
const n_variables,
201 std::size_t
const local_matrix_size,
202 std::vector<unsigned>
const& dofIndex_to_localIndex,
203 ConstructorArgs&&... args)
205 auto const& integration_method = NumLib::IntegrationMethodRegistry::
206 template getIntegrationMethod<
207 typename ShapeFunctionDisplacement::MeshElement>(
212 if (n_variables == 2)
215 ShapeFunctionDisplacement, ShapeFunctionPressure,
216 GlobalDim>{e, n_variables, local_matrix_size,
217 dofIndex_to_localIndex, integration_method,
218 std::forward<ConstructorArgs>(args)...}};
220 return LADataIntfPtr{
new LocalAssemblerDataMatrixNearFracture<
221 ShapeFunctionDisplacement, ShapeFunctionPressure,
222 GlobalDim>{e, n_variables, local_matrix_size,
223 dofIndex_to_localIndex, integration_method,
224 std::forward<ConstructorArgs>(args)...}};
227 ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim>{
228 e, local_matrix_size, dofIndex_to_localIndex,
229 integration_method, std::forward<ConstructorArgs>(args)...}};