Superdrop IDs

Header file: <libs/superdrops/superdrop_ids.hpp> [source]

struct IntID

Struct containing value of SD identity (8 bytes integer).

Public Functions

inline size_t get_value() const

Public Members

size_t value

Value of the SD identity.

class Gen

Class for generating unique SD identity.

Public Functions

inline Gen()

Default constructor for ID generation starting at value = 0.

inline explicit Gen(const size_t id)

Constructor for ID generation with next id at value = id + 1.

inline IntID next()

Generate the next SD identity.

Note: This generator is not thread-safe (_id++ is undefined in a multi-threaded environment).

Returns:

SD identity.

inline IntID set(const unsigned int kk)

Generate the next SD identity using given value ‘id’.

Note: This generator assumes the ID was thread-safe generated (i.e., is unique).

Parameters:

kk – The value to use for generating the next SD identity.

Returns:

SD identity.

Private Members

size_t _id = 0

Internal counter for generating SD identities.

struct EmptyID

Struct for non-existent (no memory) SD identity.

Public Functions

inline size_t get_value() const
class Gen

Class for generating empty SD identity.

Public Functions

Gen() = default
inline explicit Gen(const size_t id)
inline EmptyID next()

Generate an empty SD identity.

Returns:

Empty SD identity.

inline EmptyID set(const unsigned int kk)

Generate an empty SD identity.

Parameters:

kk – A parameter possibly used for generating SD identity.

Returns:

Empty SD identity.

inline std::ostream &operator<<(std::ostream &os, const EmptyID &id)

Output stream operator for printing null statement when super-droplet identity is instance of EmptyID (non-existent) type.

Null statement reads “(Undefined) No ID”.

Parameters:
  • os – Output stream.

  • id – SD identity to print.

Returns:

Reference to the output stream.

inline std::ostream &operator<<(std::ostream &os, const IntID &id)

Output stream operator for printing super-droplet identity when it is IntID type.

Statement is of value of super-droplet identity, IntID::value.

Parameters:
  • os – Output stream.

  • id – SD identity to print.

Returns:

Reference to the output stream.