|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Snapshots the lattice every period steps.
More...
#include <ca-observer.H>
Public Member Functions | |
| Sampling_Observer ()=default | |
| Construct an observer that snapshots every step. | |
| Sampling_Observer (const std::size_t period) | |
| Construct an observer with an explicit sampling period. | |
| const Array< Lattice > & | snapshots () const noexcept |
| Return collected snapshots. | |
| const Array< std::size_t > & | step_indices () const noexcept |
| Return step indices for collected snapshots. | |
| std::size_t | size () const noexcept |
| Return the number of stored snapshots. | |
| void | reset () noexcept |
| Clear all snapshots and step indices. | |
| void | on_step_begin (const std::size_t step, const Lattice &frame) |
| Capture the initial frame when sampling is enabled. | |
| void | on_step_end (const std::size_t step, const Lattice &frame) |
| Capture the completed frame at period boundaries. | |
Private Attributes | |
| std::size_t | period_ = 1 |
| Array< Lattice > | snapshots_ |
| Array< std::size_t > | step_indices_ |
Snapshots the lattice every period steps.
Stores in-memory copies into a Array<Lattice> accessible via snapshots(). The initial frame is captured (under on_step_begin for step 0) and every step whose index is a multiple of period thereafter. Pass period == 0 to disable sampling entirely.
| Lattice | lattice type to copy. |
Definition at line 798 of file ca-observer.H.
|
default |
Construct an observer that snapshots every step.
| This | function does not throw. |
|
inlineexplicit |
Construct an observer with an explicit sampling period.
| [in] | period | snapshot period; zero disables sampling. |
| This | function does not throw. |
Definition at line 814 of file ca-observer.H.
|
inline |
Capture the initial frame when sampling is enabled.
| [in] | step | step index about to run. |
| [in] | frame | frame before the step. |
| Any | exception thrown while copying frame or appending. |
Definition at line 860 of file ca-observer.H.
References Aleph::and, Aleph::Array< T >::append(), Aleph::CA::Sampling_Observer< Lattice >::period_, Aleph::CA::Sampling_Observer< Lattice >::snapshots_, and Aleph::CA::Sampling_Observer< Lattice >::step_indices_.
|
inline |
Capture the completed frame at period boundaries.
| [in] | step | completed step index. |
| [in] | frame | frame after the step. |
| Any | exception thrown while copying frame or appending. |
Definition at line 874 of file ca-observer.H.
References Aleph::Array< T >::append(), Aleph::CA::Sampling_Observer< Lattice >::period_, Aleph::CA::Sampling_Observer< Lattice >::snapshots_, and Aleph::CA::Sampling_Observer< Lattice >::step_indices_.
|
inlinenoexcept |
Clear all snapshots and step indices.
| This | function does not throw. |
Definition at line 849 of file ca-observer.H.
References Aleph::Array< T >::clear(), Aleph::CA::Sampling_Observer< Lattice >::snapshots_, and Aleph::CA::Sampling_Observer< Lattice >::step_indices_.
|
inlinenoexcept |
Return the number of stored snapshots.
| This | function does not throw. |
Definition at line 838 of file ca-observer.H.
References Aleph::CA::Sampling_Observer< Lattice >::snapshots_.
|
inlinenoexcept |
Return collected snapshots.
| This | function does not throw. |
Definition at line 820 of file ca-observer.H.
References Aleph::CA::Sampling_Observer< Lattice >::snapshots_.
|
inlinenoexcept |
Return step indices for collected snapshots.
snapshots(). | This | function does not throw. |
Definition at line 829 of file ca-observer.H.
References Aleph::CA::Sampling_Observer< Lattice >::step_indices_.
|
private |
Definition at line 800 of file ca-observer.H.
Referenced by Aleph::CA::Sampling_Observer< Lattice >::on_step_begin(), and Aleph::CA::Sampling_Observer< Lattice >::on_step_end().
|
private |
Definition at line 801 of file ca-observer.H.
Referenced by Aleph::CA::Sampling_Observer< Lattice >::on_step_begin(), Aleph::CA::Sampling_Observer< Lattice >::on_step_end(), Aleph::CA::Sampling_Observer< Lattice >::reset(), Aleph::CA::Sampling_Observer< Lattice >::size(), and Aleph::CA::Sampling_Observer< Lattice >::snapshots().
|
private |