Skip to content

Commit

Permalink
cell_weight: added documentation for LegacySignal.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcfehling committed Mar 22, 2022
1 parent 766df43 commit 74f9ff5
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions include/deal.II/grid/tria.h
Original file line number Diff line number Diff line change
Expand Up @@ -2211,9 +2211,10 @@ class Triangulation : public Subscriptor
CellWeightSum<unsigned int>>
weight;

#ifndef DOXYGEN
/**
* Legacy constructor that connects deprecated signals to their new ones.
* Constructor.
*
* Connects a deprecated signal to its successor.
*/
Signals()
: cell_weight(weight)
Expand All @@ -2233,16 +2234,28 @@ class Triangulation : public Subscriptor
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_EARLY
boost::signals2::connection
connect(
Expand All @@ -2262,6 +2275,10 @@ class Triangulation : public Subscriptor
return new_signal.connect(slot, position);
}

/**
* Returns the number of connected functions <em>without</em> the base
* weight.
*/
DEAL_II_DEPRECATED_EARLY
std::size_t
num_slots() const
Expand All @@ -2270,6 +2287,9 @@ class Triangulation : public Subscriptor
static_cast<std::size_t>(base_weight.connected());
}

/**
* Checks if there are any connected functions to the signal.
*/
DEAL_II_DEPRECATED_EARLY
bool
empty() const
Expand All @@ -2282,6 +2302,12 @@ class Triangulation : public Subscriptor
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_EARLY void
disconnect(const S &connection)
Expand All @@ -2296,6 +2322,9 @@ class Triangulation : public Subscriptor
}
}

/**
* Triggers the signal.
*/
DEAL_II_DEPRECATED_EARLY
unsigned int
operator()(const cell_iterator &iterator, const CellStatus status)
Expand All @@ -2304,11 +2333,16 @@ class Triangulation : public Subscriptor
}

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;
};
#endif

/**
* @copydoc weight
Expand Down

0 comments on commit 74f9ff5

Please sign in to comment.