wiki:Add_Chombo_Attribute_

Version 7 (modified by trac, 12 years ago) ( diff )

Add_Chombo_Attribute_() Subroutines


This set of beario.f90 subroutines was created for the purpose of adding single scalar attributes to Chombo files. Each Add_Chombo_Attribute_ subroutine is designed to take a different data type, but the input parameter structure is similar for all of them:

Add_Chombo_Attribute_X(s_name, [hid_type_id], hid_group_id, x_value, [i_size])

  • s_name: The name of the new attribute.
  • hid_type_id: An HDF identifier for a type. This should be a data type that can take x_value as an input. This is only present for strings and derived types, which use modified or compound versions of native HDF5 types.
  • hid_group_id: An HDF identifier for a group.
  • x_value: The data held by the attribute, this input must be of a type and format compatible with the type indicated by hid_type_id.
  • i_size: This optional field, present only for strings and derived types, contains a size value to which the type will be set prior to the attribute's construction. If i_size is not included, then hid_type_id's current size value will be used. Note that hid_type_id's size will remain set to i_size even after the attribute is constructed, so use this option with caution. In general, it is intended for string-based types whose sizes cannot be known before x_value is initialized. This parameter has been removed from the Add_Chombo_Attribute_Int and Add_Chombo_Attribute_Float functions.

There are two major advantages to handling attributes this way:

  1. HDF identifier management is contained entirely within the function; the attribute and dataspace identifiers are opened, used, and closed within the local scope of the subroutine so that the calling procedure doesn't have to keep track of them, eliminating the risk of unclosed identifiers.
  1. Ease of use; these subroutines will allow developers to extend the chombo format easily, even if their understanding of the Chombo format is minimal.


Note that while the attributes added using these subroutines have to be scalar, the types do not. The Add_Chombo_Attribute_IntVector subroutine, for instance, adds a three-element integer array to the file as a scalar attribute.

Currently, the Add_Chombo_Attribute_ family is comprised of the following subroutines:

Note: See TracWiki for help on using the wiki.