STORMM Source Documentation
Loading...
Searching...
No Matches
stormm::review::TickCounter< T > Class Template Reference

Make an array of integral settings and tick it forward (or backward). The analogy is a series of wheels A - N, each with n_A, n_B, ... , n_N settings. With each tick, the lowest wheel (position 0 of the array) advances one tick. When each wheel completes one revolution, it triggers an advance of the next wheel. This collapses to a simple base-K counting system for a series of wheels with equal numbers of K settings apiece. More...

#include <tickcounter.h>

Public Member Functions

int getVariableCount () const
 Get the number of independent settings, the number of variables.
 
double getLogPermutations () const
 Get the logarithm of the number of overall permutations.
 
const std::vector< int > & getSettings () const
 Get a const reference to the vector of current settings.
 
llint getExactPermutationCount () const
 Get the exact number of permutations for this object.
 
double getApproximatePermutationCount () const
 Get the number of permutations count for this object as a floating-point number.
 
double getLogPermutationCount () const
 Get the natural logarithm of the number of permutations of this object.
 
void advance (int steps=1)
 Advance the counter by a specified number of steps.
 
void reverse (int steps=1)
 Reverse the counter by a specified number of steps.
 
void reset ()
 Reset all states of the counter to zero.
 
 TickCounter (const std::vector< int > &state_limits_in, const std::vector< int > &settings_in=std::vector< int >())
 The constructor takes a series of state counts for each "wheel" in the counter. The initial state can also be provided.
 
 TickCounter (const std::vector< std::vector< T > > &state_values_in, const std::vector< int > &settings_in=std::vector< int >())
 
 TickCounter (const TickCounter &original)=default
 The copy and move constructors as well as assignment operators are all valid.
 
 TickCounter (TickCounter &&original)=default
 
TickCounteroperator= (const TickCounter &original)=default
 
TickCounteroperator= (TickCounter &&original)=default
 
int getStateLimits (int var_index) const
 Get the number of available states.
 
const std::vector< int > & getStateLimits () const
 
getState (int var_index) const
 Get the state represented by a particular combination of settings, drawing on the internal representations of each state.
 
std::vector< T > getState () const
 
std::vector< T > getPossibleStates (int var_index) const
 Get a vector of all possible states for one of the variables.
 
template<typename Trng>
void randomize (Trng *xrs)
 Randomize some or all variables of the object.
 
template<typename Trng>
void randomize (Trng *xrs, const std::vector< bool > &apply_rng)
 
template<typename Trng>
void randomize (Trng *xrs, const std::vector< int > &apply_rng)
 
void set (const std::vector< int > &new_state)
 Set the object's state to an arbitrary series of values.
 
void set (int new_state, int var_index)
 
void loadStateValues (const std::vector< T > &state_values_in, int var_index)
 Load the available states for one or more independent variables.
 
void loadStateValues (const std::vector< std::vector< T > > &state_values_in)
 

Detailed Description

template<typename T>
class stormm::review::TickCounter< T >

Make an array of integral settings and tick it forward (or backward). The analogy is a series of wheels A - N, each with n_A, n_B, ... , n_N settings. With each tick, the lowest wheel (position 0 of the array) advances one tick. When each wheel completes one revolution, it triggers an advance of the next wheel. This collapses to a simple base-K counting system for a series of wheels with equal numbers of K settings apiece.

Member Function Documentation

◆ getPossibleStates()

template<typename T>
std::vector< T > stormm::stmath::TickCounter< T >::getPossibleStates ( int var_index) const

Get a vector of all possible states for one of the variables.

Parameters
var_indexIndex of the variable of interest

◆ getState()

template<typename T>
T stormm::stmath::TickCounter< T >::getState ( int var_index) const

Get the state represented by a particular combination of settings, drawing on the internal representations of each state.

Overloaded:

  • Get the current state of one of the independent variables.
  • Get the current state of all variables.
Parameters
var_indexIndex of the variable of interest

◆ getStateLimits()

template<typename T>
int stormm::stmath::TickCounter< T >::getStateLimits ( int var_index) const

Get the number of available states.

Overloaded:

  • Get the degeneracy of states for a particular variable
  • Get a const reference to the vector of numbers of options for each state.
Parameters
var_indexThe variable of interest

◆ loadStateValues()

template<typename T>
void stormm::stmath::TickCounter< T >::loadStateValues ( const std::vector< T > & state_values_in,
int var_index )

Load the available states for one or more independent variables.

Overloaded:

  • Load the available states for a particular variable.
  • Load the available states for all variables.
Parameters
state_values_inThe enumerated states that one or all independent variables can take
var_indexThe specific variable of interest

◆ randomize()

template<typename T>
template<typename Trng>
void stormm::stmath::TickCounter< T >::randomize ( Trng * xrs)

Randomize some or all variables of the object.

Overloaded:

  • Randomize all counter variables
  • Randomize selected counter variables
Parameters
xrsThe random number generator (the type of this argument is the basis of the templating)
apply_rngA vector containing entries for all counter variables and marked TRUE to cause the variable to be randomly reassigned, or a vector containing a limited number of counter indices

◆ set()

template<typename T>
void stormm::stmath::TickCounter< T >::set ( const std::vector< int > & new_state)

Set the object's state to an arbitrary series of values.

Overloaded:

  • Set all variables
  • Set a specific variable
Parameters
new_stateThe value or values to set
var_indexIndex of a particular counter variable to set

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