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 17 of file StateProcessor.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file StateProcessor.C.

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

Member Function Documentation

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

Definition at line 30 of file StateProcessor.C.

Referenced by StateProcessor().

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

Definition at line 40 of file StateProcessor.C.

Referenced by StateSimRunner::StateSimRunner().

41 {
42  if (_ev_times.size() > 0)
43  return _ev_times.back();
44  else
45  return 0;
46 }
std::vector< unsigned int > _ev_times
unsigned int StateProcessor::process ( unsigned int  time_step)

Definition at line 49 of file StateProcessor.C.

Referenced by StateSimRunner::execute().

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

Definition at line 63 of file StateProcessor.C.

64 {
65  _max_time_step = time_step;
66 }
unsigned int _max_time_step

Member Data Documentation

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

Definition at line 29 of file StateProcessor.h.

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

unsigned int StateProcessor::_max_time_step
private

Definition at line 28 of file StateProcessor.h.

Referenced by setMaxTime().


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