CDT++ 1.0.0-rc3
Causal Dynamical Triangulations in C++
Loading...
Searching...
No Matches
cdt::MoveCommand< ManifoldType > Class Template Reference

Queue and execute requested moves against a three-dimensional manifold while tracking attempted and successful transitions. More...

#include <Move_command.hpp>

Collaboration diagram for cdt::MoveCommand< ManifoldType >:

Public Member Functions

 MoveCommand ()=delete
 Remove default ctor.
 MoveCommand (ManifoldType t_manifold)
 MoveCommand ctor.
auto attempted () const noexcept -> Counter const &
 Attempted moves by MoveCommand.
void enqueue (move_tracker::MoveType const t_move)
 Push a Pachner move onto the move queue.
template<std::uniform_random_bit_generator Generator>
void execute (Generator &generator)
 Execute all moves in the queue on the manifold.
auto failed () const noexcept -> Counter const &
 Failed moves by MoveCommand.
void print_attempts () const
 Print attempted moves.
void print_errors () const
 Print move errors.
void print_successful () const
 Print successful moves.
void reset_counters ()
 Reset counters.
auto result () &&noexcept -> ManifoldType
 Consume the result manifold.
auto result () &noexcept -> ManifoldType &
 Access the result manifold without transferring ownership.
auto result () const &&-> ManifoldType=delete
auto result () const &noexcept -> ManifoldType const &
 Access the result manifold without transferring ownership.
auto size () const noexcept
 The number of moves on the queue.
auto succeeded () const noexcept -> Counter const &
 Successful moves by MoveCommand.

Static Public Member Functions

template<std::uniform_random_bit_generator Generator>
static auto apply_random_move (ManifoldType const &manifold, move_tracker::MoveType const move, Generator &generator) -> MoveResult
 Apply one queued move using the caller-owned random stream.

Detailed Description

template<typename ManifoldType>
requires (ManifoldType::dimension == 3)
class cdt::MoveCommand< ManifoldType >

Queue and execute requested moves against a three-dimensional manifold while tracking attempted and successful transitions.

Definition at line 25 of file Move_command.hpp.

Constructor & Destructor Documentation

◆ MoveCommand()

template<typename ManifoldType>
cdt::MoveCommand< ManifoldType >::MoveCommand ( ManifoldType t_manifold)
inlineexplicit

MoveCommand ctor.

Parameters
t_manifoldThe manifold to perform moves on

The manifold is copied or moved by value so the caller's source is not modified. Each completed move is committed independently; a queue execution is not one transaction.

Definition at line 69 of file Move_command.hpp.

Member Function Documentation

◆ apply_random_move()

template<typename ManifoldType>
template<std::uniform_random_bit_generator Generator>
auto cdt::MoveCommand< ManifoldType >::apply_random_move ( ManifoldType const & manifold,
move_tracker::MoveType const move,
Generator & generator ) -> MoveResult
inlinestaticnodiscard

Apply one queued move using the caller-owned random stream.

Template Parameters
GeneratorUniform random bit generator type.
Parameters
manifoldSource manifold, which remains unchanged.
movePachner move to attempt.
generatorGenerator advanced by stochastic move selection.
Returns
Moved manifold, or a structured failure reason.

Definition at line 190 of file Move_command.hpp.

Referenced by execute().

◆ attempted()

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::attempted ( ) const -> Counter const &
inlinenodiscardnoexcept

Attempted moves by MoveCommand.

Returns
Read-only attempted-move counters

Definition at line 100 of file Move_command.hpp.

References attempted().

Referenced by attempted().

◆ enqueue()

template<typename ManifoldType>
void cdt::MoveCommand< ManifoldType >::enqueue ( move_tracker::MoveType const t_move)
inline

Push a Pachner move onto the move queue.

Parameters
t_moveThe move to add

Definition at line 131 of file Move_command.hpp.

◆ execute()

template<typename ManifoldType>
template<std::uniform_random_bit_generator Generator>
void cdt::MoveCommand< ManifoldType >::execute ( Generator & generator)
inline

Execute all moves in the queue on the manifold.

Completed moves remain committed. If an exception escapes while attempting the current move, its attempted counter has been incremented, the move remains queued, earlier moves and their counters remain committed, and generator may already have advanced.

Template Parameters
GeneratorUniform random bit generator type
Parameters
generatorGenerator advanced by stochastic move selection

Definition at line 150 of file Move_command.hpp.

References apply_random_move(), and result().

◆ failed()

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::failed ( ) const -> Counter const &
inlinenodiscardnoexcept

Failed moves by MoveCommand.

Returns
Read-only failed-move counters

Definition at line 114 of file Move_command.hpp.

◆ print_attempts()

template<typename ManifoldType>
void cdt::MoveCommand< ManifoldType >::print_attempts ( ) const
inline

Print attempted moves.

Definition at line 213 of file Move_command.hpp.

◆ print_errors()

template<typename ManifoldType>
void cdt::MoveCommand< ManifoldType >::print_errors ( ) const
inline

Print move errors.

Definition at line 246 of file Move_command.hpp.

◆ print_successful()

template<typename ManifoldType>
void cdt::MoveCommand< ManifoldType >::print_successful ( ) const
inline

Print successful moves.

Definition at line 229 of file Move_command.hpp.

◆ reset_counters()

template<typename ManifoldType>
void cdt::MoveCommand< ManifoldType >::reset_counters ( )
inline

Reset counters.

Definition at line 120 of file Move_command.hpp.

◆ result() [1/3]

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::result ( ) && -> ManifoldType
inlinenodiscardnoexcept

Consume the result manifold.

Returns
Manifold moved out of this command

Definition at line 91 of file Move_command.hpp.

◆ result() [2/3]

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::result ( ) & -> ManifoldType &
inlinenodiscardnoexcept

Access the result manifold without transferring ownership.

Returns
Mutable reference valid for the lifetime of this command

Definition at line 77 of file Move_command.hpp.

Referenced by execute().

◆ result() [3/3]

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::result ( ) const & -> ManifoldType const &
inlinenodiscardnoexcept

Access the result manifold without transferring ownership.

Returns
Const reference valid for the lifetime of this command

Definition at line 84 of file Move_command.hpp.

◆ size()

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::size ( ) const
inlinenodiscardnoexcept

The number of moves on the queue.

Returns
Number of queued moves

Definition at line 138 of file Move_command.hpp.

◆ succeeded()

template<typename ManifoldType>
auto cdt::MoveCommand< ManifoldType >::succeeded ( ) const -> Counter const &
inlinenodiscardnoexcept

Successful moves by MoveCommand.

Returns
Read-only successful-move counters

Definition at line 107 of file Move_command.hpp.


The documentation for this class was generated from the following file: