27 template <
int dim,
int spacedim>
32 reinit(dof_handler, weighting_function);
37 template <
int dim,
int spacedim>
40 connection.disconnect();
45 template <
int dim,
int spacedim>
52 connection.disconnect();
54 make_weighting_callback(dof_handler, weighting_function));
63 template <
int dim,
int spacedim>
76 template <
int dim,
int spacedim>
79 const std::pair<float, float> &coefficients)
81 return [coefficients](
85 std::trunc(coefficients.first *
86 std::pow(future_fe.dofs_per_cell, coefficients.second));
92 "Cannot cast determined weight for this cell to unsigned int!"));
94 return static_cast<unsigned int>(result);
100 template <
int dim,
int spacedim>
103 const std::vector<std::pair<float, float>> &coefficients)
105 return [coefficients](
109 for (
const auto &pair : coefficients)
110 result += pair.first * std::pow(future_fe.dofs_per_cell, pair.second);
111 result = std::trunc(result);
117 "Cannot cast determined weight for this cell to unsigned int!"));
119 return static_cast<unsigned int>(result);
127 template <
int dim,
int spacedim>
128 std::function<
unsigned int(
143 "parallel::CellWeights requires a parallel::TriangulationBase object."));
145 return [&dof_handler, tria, weighting_function](
160 template <
int dim,
int spacedim>
174 "Triangulation associated with the DoFHandler has changed!"));
179 *cell_, &dof_handler);
189 fe_index = cell->future_fe_index();
194 std::set<unsigned int> fe_indices_children;
195 for (
unsigned int child_index = 0; child_index < cell->n_children();
198 const auto &child = cell->child(child_index);
199 Assert(child->is_active() && child->coarsen_flag_set(),
201 dim>::ExcInconsistentCoarseningFlags());
203 fe_indices_children.insert(child->future_fe_index());
209 fe_indices_children, 0);
212 typename ::hp::FECollection<
213 dim>::ExcNoDominatedFiniteElementAmongstChildren());
223 return weighting_function(cell, dof_handler.
get_fe(fe_index));
230 template <
int dim,
int spacedim>
233 : dof_handler(&dof_handler)
236 &(dof_handler.get_triangulation())))
241 "parallel::CellWeights requires a parallel::TriangulationBase object."));
248 template <
int dim,
int spacedim>
251 const unsigned int factor)
253 connection.disconnect();
260 return this->weighting_callback(cell,
262 std::cref(*(this->dof_handler)),
264 this->constant_weighting(factor));
270 template <
int dim,
int spacedim>
273 const unsigned int factor)
275 connection.disconnect();
282 return this->weighting_callback(cell,
284 std::cref(*(this->dof_handler)),
286 this->ndofs_weighting({factor, 1}));
292 template <
int dim,
int spacedim>
295 const unsigned int factor)
297 connection.disconnect();
304 return this->weighting_callback(cell,
306 std::cref(*(this->dof_handler)),
308 this->ndofs_weighting({factor, 2}));
314 template <
int dim,
int spacedim>
317 const std::function<
unsigned int(
322 connection.disconnect();
324 const std::function<
unsigned int(
331 return custom_function(future_fe, cell);
335 [
this, converted_function](
339 return this->weighting_callback(cell,
341 std::cref(*(this->dof_handler)),
350 #include "cell_weights.inst"