pic_soa Module

Growth, resize, serialization and state-hash primitives shared by every struct-of-arrays container.

What an SoA container looks like

A container holds one contiguous rank-1 array per field, all of the same logical length, plus a soa_extent_t recording how many elements are live (used) and how many are allocated (capacity).

type :: particle_soa_t
   type(soa_extent_t) :: extent
   integer(int32), allocatable :: id(:)
   real(dp), allocatable :: x(:)
end type particle_soa_t

Every field array is a plain allocatable rank-1 array, so p%x is contiguous and p%x(1:p%size()) is a contiguous slice of it. Both can be handed straight to BLAS or to a vectorised loop with no copy: that is the entire point of the layout and nothing in this module disturbs it.

Capacity and growth

capacity is the allocated length of every field array, used is the number of live elements, and used <= capacity always holds. Growth is geometric with factor SOA_GROWTH_FACTOR (2), starting at SOA_MIN_CAPACITY (8), so appending n elements one at a time costs O(n) copies in total rather than O(n**2).

Capacity never shrinks on a resize. Resizing down only lowers used; the memory stays with the container so that a shrink followed by a grow does not reallocate. Release it with the container’s deallocate binding, which frees every field array and zeroes both counters.

Elements that a resize newly exposes – indices keep+1 .. new_size, where keep = min(old_size, new_size) – are set to the zero value of their type (0, 0.0, .false.). This is deliberate: it makes the state of a container a function of the operations applied to it, so two runs that perform the same resizes produce the same state_hash. Elements past used and below capacity are not specified and must not be read.

Supported field types

integer(int32), integer(int64), real(sp), real(dp) and default logical.

A field of kind default_int is deliberately not supported. Its width changes with PIC_DEFAULT_INT8, which would make a checkpoint written by one build unreadable by the other. Fixed-width field types are the whole reason the serialized layout is build independent; pick int32 or int64 explicitly.

Serialized layout

A container is written as a pic_serialize stream:

order record contents
0 stream header, 16 bytes magic, byte-order mark, version
1 PIC_TAG_CHAR the schema string, see below
2 PIC_TAG_INT64, 1 element element count n
3.. one record per field n elements, declaration order

Records 1 and 2 are the prologue, written by soa_write_prologue and validated by soa_read_prologue. Field records follow in declaration order, one per field, each holding exactly n elements. A logical field travels as a PIC_TAG_INT32 record of 0/1 codes, because the envelope has no logical tag and because the storage size of a Fortran logical is not fixed by the standard.

Nothing in the stream depends on default_int: the element count is an explicit int64 and every field record carries an explicit fixed-width tag. A file written by a PIC_DEFAULT_INT8=ON build is byte identical to one written by a default build.

The schema string, and why it matters

The prologue carries a schema string that names the container and every field, in order, with its type:

pic_soa/1;particle;id:i32,x:r64,y:r64,z:r64,mass:r64,active:bool

soa_read_prologue compares it against the schema of the type being read into and fails with ERROR_VALIDATION when they differ, naming both. Any change to the field list – a renamed field, a retyped field, a reordered field, an added or removed field – changes the string, so an old checkpoint read by new code is rejected loudly instead of being decoded as garbage. The pic_soa/1 prefix (SOA_SCHEMA_PREFIX) versions the SoA layout itself, independently of the pic_serialize envelope version.

The same string is folded into state_hash first (see soa_hash_begin), so two containers with different field lists cannot collide even when their numeric payloads happen to agree.

Error contract

Every procedure here takes type(error_t), intent(inout) :: err and writes it only on failure, never clearing it on entry. This matches pic_serialize, which this module is layered on. Pass a fresh or cleared error_t and check it after each call.


Uses

  • module~~pic_soa~~UsesGraph module~pic_soa pic_soa module~pic_array_hash pic_array_hash module~pic_soa->module~pic_array_hash module~pic_error pic_error module~pic_soa->module~pic_error module~pic_io pic_io module~pic_soa->module~pic_io module~pic_serialize pic_serialize module~pic_soa->module~pic_serialize module~pic_types pic_types module~pic_soa->module~pic_types module~pic_array_hash->module~pic_types module~pic_uint64 pic_uint64 module~pic_array_hash->module~pic_uint64 module~pic_error->module~pic_types module~pic_global_definitions pic_global_definitions module~pic_error->module~pic_global_definitions module~pic_io->module~pic_types module~pic_ascii pic_ascii module~pic_io->module~pic_ascii module~pic_serialize->module~pic_error module~pic_serialize->module~pic_io module~pic_serialize->module~pic_types iso_c_binding iso_c_binding module~pic_types->iso_c_binding iso_fortran_env iso_fortran_env module~pic_types->iso_fortran_env module~pic_ascii->module~pic_types module~pic_global_definitions->module~pic_types module~pic_uint64->module~pic_types

Used by

  • module~~pic_soa~~UsedByGraph module~pic_soa pic_soa module~pic_soa_particle pic_soa_particle module~pic_soa_particle->module~pic_soa

Variables

Type Visibility Attributes Name Initial
integer(kind=int32), public, parameter :: SOA_FIELD_INT32 = 1_int32

Field kind code for an integer(int32) field. Fixed-width int32 because these codes describe the on-disk record tags.

integer(kind=int32), public, parameter :: SOA_FIELD_INT64 = 2_int32

Field kind code for an integer(int64) field.

integer(kind=int32), public, parameter :: SOA_FIELD_LOGICAL = 5_int32

Field kind code for a default logical field, stored on disk as an int32 record of 0/1 codes.

integer(kind=int32), public, parameter :: SOA_FIELD_REAL_DP = 4_int32

Field kind code for a real(dp) field.

integer(kind=int32), public, parameter :: SOA_FIELD_REAL_SP = 3_int32

Field kind code for a real(sp) field.

integer(kind=default_int), public, parameter :: SOA_GROWTH_FACTOR = 2

Geometric growth factor. Capacity doubles until it covers the request, which amortises a sequence of single-element appends to O(1) copies each.

integer(kind=default_int), public, parameter :: SOA_MIN_CAPACITY = 8

Capacity a container jumps to on its first growth, so that small containers do not reallocate on every one of the first few appends.

character(len=*), public, parameter :: SOA_SCHEMA_PREFIX = "pic_soa/1;"

Prefix every schema string starts with. Bump the number here when the SoA record layout itself changes, which retires every older checkpoint through the ordinary schema mismatch path.


Interfaces

public interface soa_hash_begin

Reset a hash accumulator and fold in a container’s identity.

Resolves on the accumulator’s type, so the same call site serves a 32-bit array_hash_t and a 64-bit array_hash64_t. Both feed the identical byte stream; only the digest width differs.

  • private subroutine soa_hash_begin_32(hasher, schema, n)

    Reset a 32-bit hash accumulator and fold in a container’s identity.

    Feeds the schema string and then the element count as an explicit int64, so the digest is the same in a default build and in a PIC_DEFAULT_INT8 build. Folding the schema first means two containers with different field lists cannot produce the same digest even when their numeric payloads agree, and folding the count means an empty container is distinguishable from an absent one.

    The caller then folds in every field’s live slice, in declaration order, and takes hasher%digest().

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash_t), intent(inout) :: hasher

    Accumulator to restart.

    character(len=*), intent(in) :: schema

    The container’s schema string.

    integer(kind=default_int), intent(in) :: n

    Number of live elements.

  • private subroutine soa_hash_begin_64(hasher, schema, n)

    Reset a 64-bit hash accumulator and fold in a container’s identity.

    Byte for byte the same stream as soa_hash_begin_32: the schema string, then the element count as an explicit int64. Only the FNV parameters folded over it differ.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash64_t), intent(inout) :: hasher

    Accumulator to restart.

    character(len=*), intent(in) :: schema

    The container’s schema string.

    integer(kind=default_int), intent(in) :: n

    Number of live elements.

public interface soa_hash_field

Fold the first n elements of one field into a hash accumulator.

Usage: call soa_hash_field(hasher, this%x, n)

Takes the field whole as an allocatable, for the same reason soa_write_field does: a container that has never been allocated has unallocated fields and no slice of one may be formed. An unallocated field, and a zero live count, both contribute nothing, which is the same thing a zero-sized update would do.

  • private subroutine soa_hash_int32_field(hasher, values, n)

    Fold the first n elements of an integer(int32) field into a hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash_t), intent(inout) :: hasher
    integer(kind=int32), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash_int64_field(hasher, values, n)

    Fold the first n elements of an integer(int64) field into a hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash_t), intent(inout) :: hasher
    integer(kind=int64), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash_real_sp_field(hasher, values, n)

    Fold the first n elements of a real(sp) field into a hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash_t), intent(inout) :: hasher
    real(kind=sp), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash_real_dp_field(hasher, values, n)

    Fold the first n elements of a real(dp) field into a hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash_t), intent(inout) :: hasher
    real(kind=dp), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash_logical_field(hasher, values, n)

    Fold the first n elements of a default logical field into a hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash_t), intent(inout) :: hasher
    logical, intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash64_int32_field(hasher, values, n)

    Fold the first n elements of an integer(int32) field into a 64-bit hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash64_t), intent(inout) :: hasher
    integer(kind=int32), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash64_int64_field(hasher, values, n)

    Fold the first n elements of an integer(int64) field into a 64-bit hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash64_t), intent(inout) :: hasher
    integer(kind=int64), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash64_real_sp_field(hasher, values, n)

    Fold the first n elements of a real(sp) field into a 64-bit hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash64_t), intent(inout) :: hasher
    real(kind=sp), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash64_real_dp_field(hasher, values, n)

    Fold the first n elements of a real(dp) field into a 64-bit hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash64_t), intent(inout) :: hasher
    real(kind=dp), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
  • private subroutine soa_hash64_logical_field(hasher, values, n)

    Fold the first n elements of a logical field into a 64-bit hash.

    Arguments

    Type IntentOptional Attributes Name
    type(array_hash64_t), intent(inout) :: hasher
    logical, intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n

public interface soa_read_field

Read one field record back and check its length.

Usage: call soa_read_field(unit, name, values, n, swapped, err)

values is reallocated to exactly n elements. name appears in the error message so a mismatch names the offending field. swapped is the flag returned by soa_read_prologue.

Fails with ERROR_VALIDATION when the record holds a number of elements other than n, or when a logical record holds a code other than 0 or 1, and with ERROR_IO when the stream is truncated.

  • private subroutine soa_read_int32_field(unit, name, values, n, swapped, err)

    Read an integer(int32) field record.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    character(len=*), intent(in) :: name
    integer(kind=int32), intent(out), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    logical, intent(in) :: swapped
    type(error_t), intent(inout) :: err
  • private subroutine soa_read_int64_field(unit, name, values, n, swapped, err)

    Read an integer(int64) field record.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    character(len=*), intent(in) :: name
    integer(kind=int64), intent(out), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    logical, intent(in) :: swapped
    type(error_t), intent(inout) :: err
  • private subroutine soa_read_real_sp_field(unit, name, values, n, swapped, err)

    Read a real(sp) field record.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    character(len=*), intent(in) :: name
    real(kind=sp), intent(out), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    logical, intent(in) :: swapped
    type(error_t), intent(inout) :: err
  • private subroutine soa_read_real_dp_field(unit, name, values, n, swapped, err)

    Read a real(dp) field record.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    character(len=*), intent(in) :: name
    real(kind=dp), intent(out), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    logical, intent(in) :: swapped
    type(error_t), intent(inout) :: err
  • private subroutine soa_read_logical_field(unit, name, values, n, swapped, err)

    Read a default logical field from an int32 record of 0/1 codes.

    Any code other than 0 or 1 is rejected rather than being coerced to true: a record that did not come from soa_write_field is more likely to be a mislabelled integer field than a sloppy boolean.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    character(len=*), intent(in) :: name
    logical, intent(out), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    logical, intent(in) :: swapped
    type(error_t), intent(inout) :: err

public interface soa_resize_field

Give one field array a new allocated length, preserving a prefix.

Usage: call soa_resize_field(values, new_capacity, keep, fill_to, err)

values(1:keep) survives the call. Indices keep+1 .. fill_to are set to the zero value of the type; indices above fill_to are left unspecified. When values already has exactly new_capacity elements no reallocation happens and only the fill is performed, which is what makes a shrink followed by a grow free.

Fails with ERROR_VALIDATION on inconsistent arguments and with ERROR_ALLOC if the new array cannot be allocated.

  • private subroutine soa_resize_int32_field(values, new_capacity, keep, fill_to, err)

    Resize an integer(int32) field.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: new_capacity
    integer(kind=default_int), intent(in) :: keep
    integer(kind=default_int), intent(in) :: fill_to
    type(error_t), intent(inout) :: err
  • private subroutine soa_resize_int64_field(values, new_capacity, keep, fill_to, err)

    Resize an integer(int64) field.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(inout), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: new_capacity
    integer(kind=default_int), intent(in) :: keep
    integer(kind=default_int), intent(in) :: fill_to
    type(error_t), intent(inout) :: err
  • private subroutine soa_resize_real_sp_field(values, new_capacity, keep, fill_to, err)

    Resize a real(sp) field.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(inout), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: new_capacity
    integer(kind=default_int), intent(in) :: keep
    integer(kind=default_int), intent(in) :: fill_to
    type(error_t), intent(inout) :: err
  • private subroutine soa_resize_real_dp_field(values, new_capacity, keep, fill_to, err)

    Resize a real(dp) field.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: new_capacity
    integer(kind=default_int), intent(in) :: keep
    integer(kind=default_int), intent(in) :: fill_to
    type(error_t), intent(inout) :: err
  • private subroutine soa_resize_logical_field(values, new_capacity, keep, fill_to, err)

    Resize a default logical field.

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(inout), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: new_capacity
    integer(kind=default_int), intent(in) :: keep
    integer(kind=default_int), intent(in) :: fill_to
    type(error_t), intent(inout) :: err

public interface soa_write_field

Write the first n elements of one field as a stream record.

Usage: call soa_write_field(unit, this%x, n, err)

The field array is taken whole, as an allocatable, together with the live count: a container that has never been allocated has unallocated field arrays, and forming the slice this%x(1:0) on one of those would be a reference to an unallocated variable. Handling that here keeps every generated container safe by construction. An unallocated field is legal and writes an empty record, provided n is zero.

The prologue must already have been written. A logical field is encoded as an int32 record of 0/1 codes; every other type maps straight onto the matching pic_serialize record.

Fails with ERROR_VALIDATION when n is negative or larger than the field actually holds.

  • private subroutine soa_write_int32_field(unit, values, n, err)

    Write the first n elements of an integer(int32) field.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    integer(kind=int32), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    type(error_t), intent(inout) :: err
  • private subroutine soa_write_int64_field(unit, values, n, err)

    Write the first n elements of an integer(int64) field.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    integer(kind=int64), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    type(error_t), intent(inout) :: err
  • private subroutine soa_write_real_sp_field(unit, values, n, err)

    Write the first n elements of a real(sp) field.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    real(kind=sp), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    type(error_t), intent(inout) :: err
  • private subroutine soa_write_real_dp_field(unit, values, n, err)

    Write the first n elements of a real(dp) field.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    real(kind=dp), intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    type(error_t), intent(inout) :: err
  • private subroutine soa_write_logical_field(unit, values, n, err)

    Write the first n elements of a default logical field as an int32 record of 0/1 codes.

    The envelope has no logical tag, and the storage size of a Fortran logical is not fixed by the standard, so an explicit 0/1 encoding is the only portable thing to put in a file.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=default_int), intent(in) :: unit
    logical, intent(in), allocatable :: values(:)
    integer(kind=default_int), intent(in) :: n
    type(error_t), intent(inout) :: err

Derived Types

type, public ::  soa_extent_t

Size and capacity bookkeeping for one SoA container.

Read more…

Components

Type Visibility Attributes Name Initial
integer(kind=default_int), public :: capacity = 0

Allocated length of every field array.

integer(kind=default_int), public :: used = 0

Number of live elements. This is what size() returns.


Functions

public pure function soa_field_code(field_kind) result(code)

Short schema spelling of a field kind code, or "?" if unknown.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: field_kind

One of the SOA_FIELD_* constants.

Return Value character(len=:), allocatable

public pure function soa_grow_capacity(current_capacity, required) result(new_capacity)

Capacity that covers required elements under the geometric policy.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: current_capacity

Capacity the container has now.

integer(kind=default_int), intent(in) :: required

Number of elements that must fit.

Return Value integer(kind=default_int)

public pure function soa_stream_bytes(schema, n, field_kinds) result(nbytes)

Exact size in bytes of the stream a container of n elements writes.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: schema

The container’s schema string.

integer(kind=default_int), intent(in) :: n

Number of live elements.

integer(kind=int32), intent(in) :: field_kinds(:)

One SOA_FIELD_* code per field, in declaration order.

Return Value integer(kind=int64)

private pure function soa_field_tag(field_kind) result(tag)

pic_serialize record tag a field kind is stored as, or -1 if the kind is unknown. A logical field maps onto the int32 tag.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: field_kind

Return Value integer(kind=int32)


Subroutines

public subroutine soa_check_alloc(stat, context, err)

Turn a non-zero stat= from an allocate into ERROR_ALLOC.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: stat

Value returned by allocate(..., stat=stat).

character(len=*), intent(in) :: context

What was being allocated, for the message.

type(error_t), intent(inout) :: err

Error state, written only when stat is non-zero.

public subroutine soa_check_field_count(name, actual, expected, err)

Verify that a field record read back holds the expected element count.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Field name, for the message.

integer(kind=default_int), intent(in) :: actual

Elements found in the record.

integer(kind=default_int), intent(in) :: expected

Elements the prologue said the container has.

type(error_t), intent(inout) :: err

Error state, ERROR_VALIDATION on a mismatch.

public subroutine soa_check_live_count(n, allocated_size, err)

Verify that n live elements really exist in a field array.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: n

Number of live elements the container claims to have.

integer(kind=default_int), intent(in) :: allocated_size

Allocated length of the field array, or -1 if it is unallocated.

type(error_t), intent(inout) :: err

Error state, ERROR_VALIDATION when the claim cannot hold.

public subroutine soa_check_resize_args(new_capacity, keep, fill_to, err)

Validate the arguments of a field resize.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: new_capacity

Requested allocated length.

integer(kind=default_int), intent(in) :: keep

Number of leading elements to preserve.

integer(kind=default_int), intent(in) :: fill_to

Highest index to zero-fill above keep.

type(error_t), intent(inout) :: err

Error state, ERROR_VALIDATION on an inconsistent request.

public subroutine soa_plan_resize(extent, new_size, new_capacity, keep, err)

Work out what a resize to new_size elements has to do.

Read more…

Arguments

Type IntentOptional Attributes Name
type(soa_extent_t), intent(in) :: extent

Current size and capacity of the container.

integer(kind=default_int), intent(in) :: new_size

Requested number of live elements.

integer(kind=default_int), intent(out) :: new_capacity

Capacity the field arrays must have afterwards.

integer(kind=default_int), intent(out) :: keep

Number of leading elements whose values must survive.

type(error_t), intent(inout) :: err

Error state, ERROR_VALIDATION when new_size is negative.

public subroutine soa_read_prologue(unit, schema, n, swapped, err)

Read and validate the prologue, returning the element count.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit

Stream unit opened for unformatted stream reading.

character(len=*), intent(in) :: schema

Schema the calling container expects.

integer(kind=default_int), intent(out) :: n

Number of elements the stream holds, 0 when the prologue is rejected.

logical, intent(out) :: swapped

True when the stream came from the opposite byte order; pass it on to every soa_read_field call.

type(error_t), intent(inout) :: err

Error state.

public subroutine soa_write_prologue(unit, schema, n, err)

Write the stream header, the schema record and the element count.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit

Stream unit opened for unformatted stream writing.

character(len=*), intent(in) :: schema

The container’s schema string.

integer(kind=default_int), intent(in) :: n

Number of live elements about to be written.

type(error_t), intent(inout) :: err

Error state.

private subroutine soa_hash64_int32_field(hasher, values, n)

Fold the first n elements of an integer(int32) field into a 64-bit hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash64_t), intent(inout) :: hasher
integer(kind=int32), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash64_int64_field(hasher, values, n)

Fold the first n elements of an integer(int64) field into a 64-bit hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash64_t), intent(inout) :: hasher
integer(kind=int64), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash64_logical_field(hasher, values, n)

Fold the first n elements of a logical field into a 64-bit hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash64_t), intent(inout) :: hasher
logical, intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash64_real_dp_field(hasher, values, n)

Fold the first n elements of a real(dp) field into a 64-bit hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash64_t), intent(inout) :: hasher
real(kind=dp), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash64_real_sp_field(hasher, values, n)

Fold the first n elements of a real(sp) field into a 64-bit hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash64_t), intent(inout) :: hasher
real(kind=sp), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash_begin_32(hasher, schema, n)

Reset a 32-bit hash accumulator and fold in a container’s identity.

Read more…

Arguments

Type IntentOptional Attributes Name
type(array_hash_t), intent(inout) :: hasher

Accumulator to restart.

character(len=*), intent(in) :: schema

The container’s schema string.

integer(kind=default_int), intent(in) :: n

Number of live elements.

private subroutine soa_hash_begin_64(hasher, schema, n)

Reset a 64-bit hash accumulator and fold in a container’s identity.

Read more…

Arguments

Type IntentOptional Attributes Name
type(array_hash64_t), intent(inout) :: hasher

Accumulator to restart.

character(len=*), intent(in) :: schema

The container’s schema string.

integer(kind=default_int), intent(in) :: n

Number of live elements.

private subroutine soa_hash_int32_field(hasher, values, n)

Fold the first n elements of an integer(int32) field into a hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash_t), intent(inout) :: hasher
integer(kind=int32), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash_int64_field(hasher, values, n)

Fold the first n elements of an integer(int64) field into a hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash_t), intent(inout) :: hasher
integer(kind=int64), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash_logical_field(hasher, values, n)

Fold the first n elements of a default logical field into a hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash_t), intent(inout) :: hasher
logical, intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash_real_dp_field(hasher, values, n)

Fold the first n elements of a real(dp) field into a hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash_t), intent(inout) :: hasher
real(kind=dp), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_hash_real_sp_field(hasher, values, n)

Fold the first n elements of a real(sp) field into a hash.

Arguments

Type IntentOptional Attributes Name
type(array_hash_t), intent(inout) :: hasher
real(kind=sp), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n

private subroutine soa_read_int32_field(unit, name, values, n, swapped, err)

Read an integer(int32) field record.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
character(len=*), intent(in) :: name
integer(kind=int32), intent(out), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
logical, intent(in) :: swapped
type(error_t), intent(inout) :: err

private subroutine soa_read_int64_field(unit, name, values, n, swapped, err)

Read an integer(int64) field record.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
character(len=*), intent(in) :: name
integer(kind=int64), intent(out), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
logical, intent(in) :: swapped
type(error_t), intent(inout) :: err

private subroutine soa_read_logical_field(unit, name, values, n, swapped, err)

Read a default logical field from an int32 record of 0/1 codes.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
character(len=*), intent(in) :: name
logical, intent(out), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
logical, intent(in) :: swapped
type(error_t), intent(inout) :: err

private subroutine soa_read_real_dp_field(unit, name, values, n, swapped, err)

Read a real(dp) field record.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
character(len=*), intent(in) :: name
real(kind=dp), intent(out), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
logical, intent(in) :: swapped
type(error_t), intent(inout) :: err

private subroutine soa_read_real_sp_field(unit, name, values, n, swapped, err)

Read a real(sp) field record.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
character(len=*), intent(in) :: name
real(kind=sp), intent(out), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
logical, intent(in) :: swapped
type(error_t), intent(inout) :: err

private subroutine soa_resize_int32_field(values, new_capacity, keep, fill_to, err)

Resize an integer(int32) field.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), allocatable :: values(:)
integer(kind=default_int), intent(in) :: new_capacity
integer(kind=default_int), intent(in) :: keep
integer(kind=default_int), intent(in) :: fill_to
type(error_t), intent(inout) :: err

private subroutine soa_resize_int64_field(values, new_capacity, keep, fill_to, err)

Resize an integer(int64) field.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout), allocatable :: values(:)
integer(kind=default_int), intent(in) :: new_capacity
integer(kind=default_int), intent(in) :: keep
integer(kind=default_int), intent(in) :: fill_to
type(error_t), intent(inout) :: err

private subroutine soa_resize_logical_field(values, new_capacity, keep, fill_to, err)

Resize a default logical field.

Arguments

Type IntentOptional Attributes Name
logical, intent(inout), allocatable :: values(:)
integer(kind=default_int), intent(in) :: new_capacity
integer(kind=default_int), intent(in) :: keep
integer(kind=default_int), intent(in) :: fill_to
type(error_t), intent(inout) :: err

private subroutine soa_resize_real_dp_field(values, new_capacity, keep, fill_to, err)

Resize a real(dp) field.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), allocatable :: values(:)
integer(kind=default_int), intent(in) :: new_capacity
integer(kind=default_int), intent(in) :: keep
integer(kind=default_int), intent(in) :: fill_to
type(error_t), intent(inout) :: err

private subroutine soa_resize_real_sp_field(values, new_capacity, keep, fill_to, err)

Resize a real(sp) field.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout), allocatable :: values(:)
integer(kind=default_int), intent(in) :: new_capacity
integer(kind=default_int), intent(in) :: keep
integer(kind=default_int), intent(in) :: fill_to
type(error_t), intent(inout) :: err

private subroutine soa_write_int32_field(unit, values, n, err)

Write the first n elements of an integer(int32) field.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
integer(kind=int32), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
type(error_t), intent(inout) :: err

private subroutine soa_write_int64_field(unit, values, n, err)

Write the first n elements of an integer(int64) field.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
integer(kind=int64), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
type(error_t), intent(inout) :: err

private subroutine soa_write_logical_field(unit, values, n, err)

Write the first n elements of a default logical field as an int32 record of 0/1 codes.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
logical, intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
type(error_t), intent(inout) :: err

private subroutine soa_write_real_dp_field(unit, values, n, err)

Write the first n elements of a real(dp) field.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
real(kind=dp), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
type(error_t), intent(inout) :: err

private subroutine soa_write_real_sp_field(unit, values, n, err)

Write the first n elements of a real(sp) field.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
real(kind=sp), intent(in), allocatable :: values(:)
integer(kind=default_int), intent(in) :: n
type(error_t), intent(inout) :: err