Growth, resize, serialization and state-hash primitives shared by every struct-of-arrays container.
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 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.
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.
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 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.
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.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int32), | public, | parameter | :: | SOA_FIELD_INT32 | = | 1_int32 |
Field kind code for an |
| integer(kind=int32), | public, | parameter | :: | SOA_FIELD_INT64 | = | 2_int32 |
Field kind code for an |
| integer(kind=int32), | public, | parameter | :: | SOA_FIELD_LOGICAL | = | 5_int32 |
Field kind code for a default |
| integer(kind=int32), | public, | parameter | :: | SOA_FIELD_REAL_DP | = | 4_int32 |
Field kind code for a |
| integer(kind=int32), | public, | parameter | :: | SOA_FIELD_REAL_SP | = | 3_int32 |
Field kind code for a |
| 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. |
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.
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().
| Type | Intent | Optional | 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. |
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.
| Type | Intent | Optional | 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. |
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.
Fold the first n elements of an integer(int32) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| integer(kind=int32), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of an integer(int64) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| integer(kind=int64), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(sp) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| real(kind=sp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(dp) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| real(kind=dp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a default logical field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| logical, | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of an integer(int32) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| integer(kind=int32), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of an integer(int64) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| integer(kind=int64), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(sp) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| real(kind=sp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(dp) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| real(kind=dp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a logical field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| logical, | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
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.
Read an integer(int32) field record.
| Type | Intent | Optional | 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 |
Read an integer(int64) field record.
| Type | Intent | Optional | 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 |
Read a real(sp) field record.
| Type | Intent | Optional | 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 |
Read a real(dp) field record.
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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 |
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.
Resize an integer(int32) field.
| Type | Intent | Optional | 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 |
Resize an integer(int64) field.
| Type | Intent | Optional | 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 |
Resize a real(sp) field.
| Type | Intent | Optional | 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 |
Resize a real(dp) field.
| Type | Intent | Optional | 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 |
Resize a default logical field.
| Type | Intent | Optional | 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 |
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.
Write the first n elements of an integer(int32) field.
| Type | Intent | Optional | 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 |
Write the first n elements of an integer(int64) field.
| Type | Intent | Optional | 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 |
Write the first n elements of a real(sp) field.
| Type | Intent | Optional | 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 |
Write the first n elements of a real(dp) field.
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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 |
Size and capacity bookkeeping for one SoA container.
| 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 |
Short schema spelling of a field kind code, or "?" if unknown.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | field_kind |
One of the |
Capacity that covers required elements under the geometric policy.
| Type | Intent | Optional | 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. |
Exact size in bytes of the stream a container of n elements writes.
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | field_kind |
Turn a non-zero stat= from an allocate into ERROR_ALLOC.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=default_int), | intent(in) | :: | stat |
Value returned by |
||
| character(len=*), | intent(in) | :: | context |
What was being allocated, for the message. |
||
| type(error_t), | intent(inout) | :: | err |
Error state, written only when |
Verify that a field record read back holds the expected element count.
| Type | Intent | Optional | 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, |
Verify that n live elements really exist in a field array.
| Type | Intent | Optional | 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, |
Validate the arguments of a field resize.
| Type | Intent | Optional | 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 |
||
| type(error_t), | intent(inout) | :: | err |
Error state, |
Work out what a resize to new_size elements has to do.
| Type | Intent | Optional | 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, |
Read and validate the prologue, returning the element count.
| Type | Intent | Optional | 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 |
||
| type(error_t), | intent(inout) | :: | err |
Error state. |
Write the stream header, the schema record and the element count.
| Type | Intent | Optional | 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. |
Fold the first n elements of an integer(int32) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| integer(kind=int32), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of an integer(int64) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| integer(kind=int64), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a logical field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| logical, | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(dp) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| real(kind=dp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(sp) field into a 64-bit hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash64_t), | intent(inout) | :: | hasher | |||
| real(kind=sp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Reset a 32-bit hash accumulator and fold in a container’s identity.
| Type | Intent | Optional | 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. |
Reset a 64-bit hash accumulator and fold in a container’s identity.
| Type | Intent | Optional | 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. |
Fold the first n elements of an integer(int32) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| integer(kind=int32), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of an integer(int64) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| integer(kind=int64), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a default logical field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| logical, | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(dp) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| real(kind=dp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Fold the first n elements of a real(sp) field into a hash.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_hash_t), | intent(inout) | :: | hasher | |||
| real(kind=sp), | intent(in), | allocatable | :: | values(:) | ||
| integer(kind=default_int), | intent(in) | :: | n |
Read an integer(int32) field record.
| Type | Intent | Optional | 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 |
Read an integer(int64) field record.
| Type | Intent | Optional | 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 |
Read a default logical field from an int32 record of 0/1 codes.
| Type | Intent | Optional | 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 |
Read a real(dp) field record.
| Type | Intent | Optional | 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 |
Read a real(sp) field record.
| Type | Intent | Optional | 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 |
Resize an integer(int32) field.
| Type | Intent | Optional | 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 |
Resize an integer(int64) field.
| Type | Intent | Optional | 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 |
Resize a default logical field.
| Type | Intent | Optional | 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 |
Resize a real(dp) field.
| Type | Intent | Optional | 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 |
Resize a real(sp) field.
| Type | Intent | Optional | 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 |
Write the first n elements of an integer(int32) field.
| Type | Intent | Optional | 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 |
Write the first n elements of an integer(int64) field.
| Type | Intent | Optional | 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 |
Write the first n elements of a default logical field as an
int32 record of 0/1 codes.
| Type | Intent | Optional | 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 |
Write the first n elements of a real(dp) field.
| Type | Intent | Optional | 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 |
Write the first n elements of a real(sp) field.
| Type | Intent | Optional | 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 |