Updates to RNGManager interface and RNG names
As discussed in #262 (closed), this is a minor update to the RNGManager class and an attempt to make random stream names more consistent.
Currently, attempting to create a process that expects a specific random stream, i.e., Sibyll, without first creating that stream, gives a particularly unhelpful error.
terminate called after throwing an instance of 'std::out_of_range'
what(): map::at
In this case, Sibyll, a random stream named s_rndm
must be defined before instantiating the process (I think this naming can be improved) with no reference to the origin of this error (or the stream that was missing).
This MR makes the following changes:
- Implementation of an
IsRegistered
method to check whether a stream name has already been registered. -
GetRegisteredStream
now checks whether a stream has been registered before accessing the internal map. An attempt to access a non-existent stream will throw a runtime exception with a more informative message i.e.'sibyll' is not a registered stream'
. - The Sibyll stream has been renamed from
s_rndm
tosibyll
to be more consistent with the other current streams (all-lower case using the process or class name) - The UrQMD stream has been renamed from
UrQMD
tourqmd
to be more consistent with the other all-lowercase stream names. - The QGS-JET stream has renameed from
qgsran
toqgsjet
.
Each of the above is implemented in its own commit so we can cherry-pick commits to remove from this MR if needed.
One of the open questions raised by this is whether processes should be responsible for registering their own streams (if the user has not already registered a stream with the same name). This could be done with a RegisterIfNotExist
method (or equiv.). I think this would be a step in the right direction towards a more RAII-like design. I think this is a good change to make but I'm curious to hear what others think - if we think this is a good direction, I'll update this MR with the change otherwise this is ready for review.