Skip to content

History Output Internals

goldy edited this page Oct 4, 2020 · 2 revisions

hist_output is based on several types of data structures:

  • hist_hashable_t:
    • The abstract type, hist_hashable_t, contains a single (deferred) method, key which takes no arguments and returns the key for that object. All hashable types (e.g., extended from hist_hashable_t) must implement this method which is how hist_hash_table_t creates hash keys for adding and searching.
    • hist_hashable_t is located module hist_hashable in src/hash/hist_hashable.F90
    • hist_hashable.F90 also contains extended types, hist_hashable_char_t and hist_hashable_int_t which hold a character string and an integer respectively
    • hist_hashable_t is located in its own module to avoid circular dependencies (e.g., between hist_field_info_t and hist_buffer_t)
  • hist_hash_table_t: A general-purpose hash table for storing hashable objects
    • hist_hash_table_t handles hash collisions via a linked-list mechanism (every table entry contains a linked list of values)
    • Each element of a hist_hash_table_t contains an object (table_entry_t) which contains a pointer to a hashable object (extended from abstract type, hist_hashable_t) and a pointer to another table_entry_t object (for storing overflow entries).
    • hist_hash_table_t is located module hist_hash_table in src/hash/hist_hash_table.F90
    • The unit tests for hist_hash_table_t and other DDTs in hist_hash_table are in test/test_hash.F90
  • hist_buffer_t: An abstract class with type extensions for different field shapes and processing options. The base class provides a pointer back to the buffer's field metadata (field method) and the host-model volume for that buffer (volume method).
    • All types extended from hist_buffer_t must support the following methods.
      • accumulate: Sample the current field state and process according to the buffer type and sampling rule.
      • value: Return the normalized value for this buffer (e.g., average, last sampled value)
      • clear: Clear any accumulation buffers and counters
    • All accumulation methods for a particular type / kind / rank combination are derived from a base class for that also serves as the class for 'instantaneous' sampling methods (last, min, max). The derived classes are currently average and variance (standard deviation).
    • hist_buffer_t and derived classes are located in module hist_buffer in src/hist_buffer.F90
    • The unit tests for hist_buffer_t and derived classes are in test/test_hist_buffer.F90
  • hist_field_info_t: Contains field metadata and a linked list of output buffers (from class hist_buffer_t)
    • hist_field_info_t is derived from hist_hashable_t so that fields can easily be stored in a hash table.
    • hist_field_info_t is located in module hist_field in src/hist_field.F90
    • The unit tests for hist_field_info_t are also in test/test_hist_buffer.F90
Clone this wiki locally