CellWeightSum<unsigned int>>
weight;
- /**
- * Constructor.
- *
- * Connects a deprecated signal to its successor.
- */
- Signals()
- : cell_weight(weight)
- {}
-
- /**
- * Legacy signal emulation to deprecate the old signal.
- */
- class LegacySignal
- {
- public:
- using signature_type = unsigned int(const cell_iterator &,
- const CellStatus);
- using combiner_type = CellWeightSum<unsigned int>;
-
- using slot_function_type = boost::function<signature_type>;
- using slot_type =
- boost::signals2::slot<signature_type, slot_function_type>;
-
- /**
- * Constructor.
- */
- LegacySignal(
- boost::signals2::signal<signature_type, combiner_type> &new_signal)
- : new_signal(new_signal)
- {}
-
- /**
- * Destructor.
- */
- ~LegacySignal()
- {
- base_weight.disconnect();
- }
-
- /**
- * Connects a function to the signal.
- *
- * Connects an additional base weight function if signal was previously
- * empty.
- */
- DEAL_II_DEPRECATED
- boost::signals2::connection
- connect(
- const slot_type & slot,
- boost::signals2::connect_position position = boost::signals2::at_back)
- {
- if (base_weight.connected() == false)
- {
- base_weight = new_signal.connect(
- [](const cell_iterator &, const CellStatus) -> unsigned int {
- return 1000;
- });
- Assert(base_weight.connected() && new_signal.num_slots() == 1,
- ExcInternalError());
- }
-
- return new_signal.connect(slot, position);
- }
-
- /**
- * Returns the number of connected functions <em>without</em> the base
- * weight.
- */
- DEAL_II_DEPRECATED
- std::size_t
- num_slots() const
- {
- return new_signal.num_slots() -
- static_cast<std::size_t>(base_weight.connected());
- }
-
- /**
- * Checks if there are any connected functions to the signal.
- */
- DEAL_II_DEPRECATED
- bool
- empty() const
- {
- if (num_slots() == 0)
- {
- Assert(new_signal.num_slots() == 0, ExcInternalError());
- return true;
- }
- return false;
- }
-
- /**
- * Disconnects a function from the signal.
- *
- * Also disconnects the base weight function if it is the last connected
- * function.
- */
- template <typename S>
- DEAL_II_DEPRECATED void
- disconnect(const S &connection)
- {
- new_signal.disconnect(connection);
-
- if (num_slots() == 0)
- {
- Assert(base_weight.connected() && new_signal.num_slots() == 1,
- ExcInternalError());
- new_signal.disconnect(base_weight);
- }
- }
-
- /**
- * Triggers the signal.
- */
- DEAL_II_DEPRECATED
- unsigned int
- operator()(const cell_iterator &iterator, const CellStatus status)
- {
- return new_signal(iterator, status);
- }
-
- private:
- /**
- * Monitors the connection of the base weight function.
- */
- boost::signals2::connection base_weight;
-
- /**
- * Reference to the successor signal.
- */
- boost::signals2::signal<signature_type, combiner_type> &new_signal;
- };
-
- /**
- * @copydoc weight
- *
- * As a reference, a value of 1000 is added for every cell to the total
- * weight. This means a signal return value of 1000 (resulting in a weight
- * of 2000) means that it is twice as expensive for a process to handle this
- * particular cell.
- *
- * @deprecated Use the `weight` signal instead which omits the base weight.
- * You can invoke the old behavior by connecting a function to the signal
- * that returns the base weight as follows. This function should be added
- * <em>in addition</em> to the one that actually computes the weight.
- * @code{.cc}
- * triangulation.signals.weight.connect(
- * [](const typename Triangulation<dim>::cell_iterator &,
- * const typename Triangulation<dim>::CellStatus)
- * -> unsigned int { return 1000; });
- * @endcode
- */
- LegacySignal cell_weight;
-
/**
* This signal is triggered at the beginning of execution of the
* parallel::distributed::Triangulation::execute_coarsening_and_refinement()