* @}
*/
- /**
- * @name Deprecated functions
- * @{
- */
-
- /**
- * Constructor.
- *
- * @param[in] dof_handler The DoFHandler which will be used to
- * determine each cell's finite element.
- */
- DEAL_II_DEPRECATED
- CellWeights(const dealii::DoFHandler<dim, spacedim> &dof_handler);
-
- /**
- * Choose a constant weight @p factor on each cell.
- *
- * @deprecated Use CellWeights::constant_weighting() instead.
- */
- DEAL_II_DEPRECATED void
- register_constant_weighting(const unsigned int factor = 1000);
-
- /**
- * Choose a weight for each cell that is proportional to its number of
- * degrees of freedom with a factor @p factor.
- *
- * @deprecated Use CellWeights::ndofs_weighting() instead.
- */
- DEAL_II_DEPRECATED void
- register_ndofs_weighting(const unsigned int factor = 1000);
-
- /**
- * Choose a weight for each cell that is proportional to its number of
- * degrees of freedom <i>squared</i> with a factor @p factor.
- *
- * @deprecated Use CellWeights::ndofs_weighting() instead.
- */
- DEAL_II_DEPRECATED void
- register_ndofs_squared_weighting(const unsigned int factor = 1000);
-
- /**
- * Register a custom weight for each cell by providing a function as a
- * parameter.
- *
- * @param[in] custom_function The custom weighting function returning
- * the weight of each cell as an unsigned integer. It is required
- * to have two arguments, namely the FiniteElement that will be
- * active on the particular cell, and the cell itself of type
- * DoFHandler::cell_iterator. We require both to make sure to
- * get the right active FiniteElement on each cell in case that we
- * coarsen the Triangulation.
- */
- DEAL_II_DEPRECATED void
- register_custom_weighting(
- const std::function<
- unsigned int(const FiniteElement<dim, spacedim> &,
- const typename DoFHandler<dim, spacedim>::cell_iterator &)>
- custom_function);
-
- /**
- * @}
- */
-
private:
- /**
- * @name Deprecated members
- * @{
- */
-
- /**
- * Pointer to the degree of freedom handler.
- */
- DEAL_II_DEPRECATED
- SmartPointer<const dealii::DoFHandler<dim, spacedim>, CellWeights>
- dof_handler;
-
- /**
- * Pointer to the Triangulation associated with the degree of freedom
- * handler.
- *
- * We store both to make sure to always work on the correct combination of
- * both.
- */
- DEAL_II_DEPRECATED
- SmartPointer<const parallel::TriangulationBase<dim, spacedim>, CellWeights>
- triangulation;
-
- /**
- * @}
- */
-
/**
* A connection to the corresponding cell_weight signal of the Triangulation
* which is attached to the DoFHandler.
// Return the cell weight determined by the function of choice.
return weighting_function(cell, dof_handler.get_fe(fe_index));
}
-
-
-
- // ---------- deprecated functions ----------
-
- template <int dim, int spacedim>
- CellWeights<dim, spacedim>::CellWeights(
- const dealii::DoFHandler<dim, spacedim> &dof_handler)
- : dof_handler(&dof_handler)
- , triangulation(
- dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
- &(dof_handler.get_triangulation())))
- {
- Assert(
- triangulation != nullptr,
- ExcMessage(
- "parallel::CellWeights requires a parallel::TriangulationBase object."));
-
- register_constant_weighting();
- }
-
-
-
- template <int dim, int spacedim>
- void
- CellWeights<dim, spacedim>::register_constant_weighting(
- const unsigned int factor)
- {
- connection.disconnect();
-
- connection = triangulation->signals.cell_weight.connect(
- [this,
- factor](const typename Triangulation<dim, spacedim>::cell_iterator &cell,
- const typename Triangulation<dim, spacedim>::CellStatus status)
- -> unsigned int {
- return this->weighting_callback(cell,
- status,
- std::cref(*(this->dof_handler)),
- std::cref(*(this->triangulation)),
- this->constant_weighting(factor));
- });
- }
-
-
-
- template <int dim, int spacedim>
- void
- CellWeights<dim, spacedim>::register_ndofs_weighting(
- const unsigned int factor)
- {
- connection.disconnect();
-
- connection = triangulation->signals.cell_weight.connect(
- [this,
- factor](const typename Triangulation<dim, spacedim>::cell_iterator &cell,
- const typename Triangulation<dim, spacedim>::CellStatus status)
- -> unsigned int {
- return this->weighting_callback(cell,
- status,
- std::cref(*(this->dof_handler)),
- std::cref(*(this->triangulation)),
- this->ndofs_weighting({factor, 1}));
- });
- }
-
-
-
- template <int dim, int spacedim>
- void
- CellWeights<dim, spacedim>::register_ndofs_squared_weighting(
- const unsigned int factor)
- {
- connection.disconnect();
-
- connection = triangulation->signals.cell_weight.connect(
- [this,
- factor](const typename Triangulation<dim, spacedim>::cell_iterator &cell,
- const typename Triangulation<dim, spacedim>::CellStatus status)
- -> unsigned int {
- return this->weighting_callback(cell,
- status,
- std::cref(*(this->dof_handler)),
- std::cref(*(this->triangulation)),
- this->ndofs_weighting({factor, 2}));
- });
- }
-
-
-
- template <int dim, int spacedim>
- void
- CellWeights<dim, spacedim>::register_custom_weighting(
- const std::function<
- unsigned int(const FiniteElement<dim, spacedim> &,
- const typename DoFHandler<dim, spacedim>::cell_iterator &)>
- custom_function)
- {
- connection.disconnect();
-
- const std::function<
- unsigned int(const typename DoFHandler<dim, spacedim>::cell_iterator &,
- const FiniteElement<dim, spacedim> &)>
- converted_function =
- [&custom_function](
- const typename DoFHandler<dim, spacedim>::cell_iterator &cell,
- const FiniteElement<dim, spacedim> &future_fe) -> unsigned int {
- return custom_function(future_fe, cell);
- };
-
- connection = triangulation->signals.cell_weight.connect(
- [this, converted_function](
- const typename Triangulation<dim, spacedim>::cell_iterator &cell,
- const typename Triangulation<dim, spacedim>::CellStatus status)
- -> unsigned int {
- return this->weighting_callback(cell,
- status,
- std::cref(*(this->dof_handler)),
- std::cref(*(this->triangulation)),
- converted_function);
- });
- }
} // namespace parallel