Skip to content

sequence

Clifford Bohm edited this page Jan 16, 2018 · 16 revisions

The sequence function (seq) generates lists of numbers. Sequence is primarily used to allow users to define parameters which define things like output intervals. For example, a user could set a seq of :10 for the ARCHIVIST_DEFAULT-realtimeSequence which would mean that they wish to write realtime files (pop.csv and max.csv) every 10 update. If a user feels that they need higher resolution data later in the run they could set seq to: 0-8000:1000,8000-10000:10 (i.e. 0 to 8,000 on 1,000s and 8,000 to 10,000 on 10s)

usage

x
sequence will contain a single value. e.g. seq("5") = 1)
x-y
sequence will contain x to y. e.g. seq("4-7") = 4,5,6,7
x-y:z
sequence will contain x to y on z. e.g. seq("4-60:5") = 4,9,14,19,24,29,34,39,44,49,54,59
:z
sequence will contain 0 to updates on z. e.g. seq(":10") = 0,10,20,30,40,50,60,...
x:z
sequence will contain x to updates on z. e.g. seq("1500:10") = 1500,1510,1520,1530,1540,1550,1560,...
, (comma)
append to sequences. e.g. seq("0-15:2,5-25:4") = 0,2,4,6,8,10,12,14 + 5,9,13,17 = 0,2,4,5,6,8,9,10,12,13,14,17

For Programmers

The sequence function signature looks like:

inline vector<int> seq(const string seqStr, int defaultMax = -1, bool addZero = false)
  • seqStr is the sequence definition
  • defaultMax is the max value allowed in the sequence (i.e. if :5 is used with defualtMax = 30 then the result will be 0,5,10,15,20,25,30)
  • addZero false does nothing, true will add 0 to the sequence being produced.
Clone this wiki locally