Keywords: class-user

Next: About this document ... Up: IRAM Memo 2011-3 CLASS Previous: Conclusion Contents

# Implementation details for CLASS developers

The User Section is added to the CLASS data format. It is defined in the Fortran source as follows:

      type user  ! Type for all user subsections
         sequence
         integer(kind=4)          :: n       ! Number of user subsections
         type (user_sub), pointer :: sub(:)  ! Array of subsections
      end type

An object of type `user` is added to the type `observation` structure in the data format. This `user` object can contain an arbitrary number of subsections. This allows several user subsections to exist for the same observation.

Then each of these user subsection is described by the following type:

      type user_sub  ! Type for each user subsection
         sequence
         character(len=12)        :: owner    ! Owner of the subsection
         character(len=12)        :: title    ! Title of the subsection
         integer(kind=4)          :: version  ! Version of the subsection
         integer(kind=4)          :: ndata    ! Length of the data(:) array
         integer(kind=4), pointer :: data(:)  ! Place holder for information
      end type

- A user subsection is identified by a `owner` and a `title`. One owner can have several subsections with each a different title. In other words the couple `owner`+`title` is considered as a unique identifier for a user subsection.
- The `version` value is a mean for the owner to handle several versions of the same subsection (e.g. elements have been added in this subsection between two versions).
- The `data` field is the data itself. It is considered as a block of bytes with no direct meaning for CLASS. Only the owner is able to decode it.
- Since the `data` is a dynamic object (i.e. size is not known at compilation time), the `ndata` value describes how many 4-bytes blocks are present in the `data`.

Those two types are private to CLASS. They do not have to be known by the external program.

Finally, this new User Section is different from the other ones in the CLASS data format since its size is not constant. This implies some modifications in the subroutines. In particular, a whole copy of observation to observation (`obsout = obsin`) is forbidden: it must be done in a specific way, taking care of allocating the pointers in the user section before the copy. For the same reason, the User Section is not buffered and must be re-read everytime needed on the disk (in other words `SET VIRTUAL ON` has no effect).

Next: About this document ... Up: IRAM Memo 2011-3 CLASS Previous: Conclusion Contents