www.mooseframework.org
Public Member Functions | Private Member Functions | Private Attributes | List of all members
StateProcessor Class Reference


Object to load and run and manage a state simulation model More...

#include <StateProcessor.h>

Public Member Functions

 StateProcessor (unsigned int max_time_step, int seed=0)
 
void setMaxTime (unsigned int time_step)
 
unsigned int nextTime ()
 
unsigned int process (unsigned int time_step)
 

Private Member Functions

void addEv (unsigned int time_step)
 

Private Attributes

unsigned int _max_time_step
 
std::vector< unsigned int > _ev_times
 

Detailed Description


Object to load and run and manage a state simulation model

Definition at line 19 of file StateProcessor.h.

Constructor & Destructor Documentation

◆ StateProcessor()

StateProcessor::StateProcessor ( unsigned int  max_time_step,
int  seed = 0 
)

Definition at line 16 of file StateProcessor.C.

17  : _max_time_step(max_time_step), _ev_times()
18 {
19  MooseRandom::seed(seed);
20 
21  // add a bunch of random time items
22  unsigned int r = MooseRandom::randl() % 10;
23  for (unsigned int i = 0; i < r; i++)
24  {
25  unsigned int addI = MooseRandom::randl() % max_time_step;
26  addEv(addI);
27  }
28 }
unsigned int _max_time_step
std::vector< unsigned int > _ev_times
void addEv(unsigned int time_step)

Member Function Documentation

◆ addEv()

void StateProcessor::addEv ( unsigned int  time_step = 0)
private

Definition at line 32 of file StateProcessor.C.

Referenced by StateProcessor().

33 {
34  unsigned long idx = 0;
35  while ((idx < _ev_times.size()) && (_ev_times[idx] > time_step))
36  ++idx;
37 
38  _ev_times.insert(_ev_times.begin() + idx, time_step);
39 }
std::vector< unsigned int > _ev_times

◆ nextTime()

unsigned int StateProcessor::nextTime ( )

Definition at line 42 of file StateProcessor.C.

43 {
44  if (_ev_times.size() > 0)
45  return _ev_times.back();
46  else
47  return 0;
48 }
std::vector< unsigned int > _ev_times

◆ process()

unsigned int StateProcessor::process ( unsigned int  time_step)

Definition at line 51 of file StateProcessor.C.

52 {
53  if (time_step == _ev_times.back())
54  _ev_times.pop_back();
55 
56  // todo run state processing
57 
58  if (_ev_times.size() > 0)
59  return _ev_times.back();
60  else
61  return 0;
62 }
std::vector< unsigned int > _ev_times

◆ setMaxTime()

void StateProcessor::setMaxTime ( unsigned int  time_step)

Definition at line 65 of file StateProcessor.C.

66 {
67  _max_time_step = time_step;
68 }
unsigned int _max_time_step

Member Data Documentation

◆ _ev_times

std::vector<unsigned int> StateProcessor::_ev_times
private

Definition at line 31 of file StateProcessor.h.

Referenced by addEv(), nextTime(), and process().

◆ _max_time_step

unsigned int StateProcessor::_max_time_step
private

Definition at line 30 of file StateProcessor.h.

Referenced by setMaxTime().


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