|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Records the count of cells in tracked_state per step.
More...
#include <ca-observer.H>
Public Member Functions | |
| Density_Observer ()=default | |
Construct an observer that tracks State{}. | |
| Density_Observer (State s) | |
| Construct an observer tracking a specific state. | |
| const Array< ca_size_t > & | counts () const noexcept |
| Return the count time series. | |
| const Array< ca_size_t > & | totals () const noexcept |
| Return the total-cell time series. | |
| double | density_at (const std::size_t i) const |
| Return density at a recorded sample. | |
| std::size_t | size () const noexcept |
| Return the number of recorded samples. | |
| void | reset () noexcept |
| Clear all recorded samples. | |
| template<typename Lattice > | |
| void | on_step_begin (const std::size_t step, const Lattice &frame) |
| Record the initial frame before step zero. | |
| template<typename Lattice > | |
| void | on_step_end (const std::size_t step, const Lattice &frame) |
| Record the frame after a completed step. | |
Private Attributes | |
| State | tracked_state_ {} |
| Array< ca_size_t > | counts_ |
| Array< ca_size_t > | totals_ |
| bool | seeded_ = false |
Records the count of cells in tracked_state per step.
At the end of every step the observer pushes one entry into its history. The very first sample is recorded inside on_step_begin for step == 0, so the time series includes the initial frame.
| State | cell state type to track. |
Definition at line 328 of file ca-observer.H.
|
default |
Construct an observer that tracks State{}.
| Any | exception thrown by State default construction. |
|
inlineexplicit |
Construct an observer tracking a specific state.
| [in] | s | state value counted at every sample. |
| Any | exception thrown while moving/copying s. |
Definition at line 345 of file ca-observer.H.
|
inlinenoexcept |
Return the count time series.
| This | function does not throw. |
Definition at line 351 of file ca-observer.H.
References Aleph::CA::Density_Observer< State >::counts_.
|
inline |
Return density at a recorded sample.
| [in] | i | sample index. |
| std::out_of_range | if i >= size(). |
Definition at line 370 of file ca-observer.H.
References ah_out_of_range_error_if, Aleph::CA::Density_Observer< State >::counts_, Aleph::Array< T >::size(), and Aleph::CA::Density_Observer< State >::totals_.
|
inline |
Record the initial frame before step zero.
| Lattice | lattice type. |
| [in] | step | step index about to run. |
| [in] | frame | frame before the step. |
| std::bad_alloc | if appending the sample allocates. |
Definition at line 406 of file ca-observer.H.
References Aleph::and, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::count_state(), Aleph::CA::Density_Observer< State >::counts_, Aleph::CA::Density_Observer< State >::seeded_, Aleph::CA::total_cells(), Aleph::CA::Density_Observer< State >::totals_, and Aleph::CA::Density_Observer< State >::tracked_state_.
|
inline |
Record the frame after a completed step.
| Lattice | lattice type. |
| [in] | step | completed step index, ignored. |
| [in] | frame | frame after the step. |
| std::bad_alloc | if appending the sample allocates. |
Definition at line 423 of file ca-observer.H.
References Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::count_state(), Aleph::CA::Density_Observer< State >::counts_, Aleph::CA::total_cells(), Aleph::CA::Density_Observer< State >::totals_, and Aleph::CA::Density_Observer< State >::tracked_state_.
|
inlinenoexcept |
Clear all recorded samples.
| This | function does not throw. |
Definition at line 392 of file ca-observer.H.
References Aleph::Array< T >::clear(), Aleph::CA::Density_Observer< State >::counts_, Aleph::CA::Density_Observer< State >::seeded_, and Aleph::CA::Density_Observer< State >::totals_.
|
inlinenoexcept |
Return the number of recorded samples.
| This | function does not throw. |
Definition at line 381 of file ca-observer.H.
References Aleph::CA::Density_Observer< State >::counts_, and Aleph::Array< T >::size().
|
inlinenoexcept |
Return the total-cell time series.
counts(). | This | function does not throw. |
Definition at line 360 of file ca-observer.H.
References Aleph::CA::Density_Observer< State >::totals_.
|
private |
Definition at line 331 of file ca-observer.H.
Referenced by Aleph::CA::Density_Observer< State >::counts(), Aleph::CA::Density_Observer< State >::density_at(), Aleph::CA::Density_Observer< State >::on_step_begin(), Aleph::CA::Density_Observer< State >::on_step_end(), Aleph::CA::Density_Observer< State >::reset(), and Aleph::CA::Density_Observer< State >::size().
|
private |
Definition at line 333 of file ca-observer.H.
Referenced by Aleph::CA::Density_Observer< State >::on_step_begin(), and Aleph::CA::Density_Observer< State >::reset().
|
private |
Definition at line 332 of file ca-observer.H.
Referenced by Aleph::CA::Density_Observer< State >::density_at(), Aleph::CA::Density_Observer< State >::on_step_begin(), Aleph::CA::Density_Observer< State >::on_step_end(), Aleph::CA::Density_Observer< State >::reset(), and Aleph::CA::Density_Observer< State >::totals().
|
private |
Definition at line 330 of file ca-observer.H.
Referenced by Aleph::CA::Density_Observer< State >::on_step_begin(), and Aleph::CA::Density_Observer< State >::on_step_end().