A struct-of-arrays container holding 6 parallel field arrays.
Each field is a separate contiguous rank-1 array, which is the point of
the layout: this%id is contiguous, and so is the live slice
this%id(1:this%size()), so either can be handed straight to BLAS or
to a vectorised loop without a copy.
Growth, the serialized record layout, the schema check on deserialize and
the state-hash fold order are all documented in pic_soa. This type’s
schema string is
particle;id:i32,x:r64,y:r64,z:r64,mass:r64,active:bool
prefixed by SOA_SCHEMA_PREFIX. Fields are serialized and folded into
the hash in exactly the order they are declared below.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int32), | public, | parameter | :: | PARTICLE_SOA_FIELD_KINDS(PARTICLE_SOA_N_FIELDS) | = | [SOA_FIELD_INT32, SOA_FIELD_REAL_DP, SOA_FIELD_REAL_DP, SOA_FIELD_REAL_DP, SOA_FIELD_REAL_DP, SOA_FIELD_LOGICAL] |
Field kind codes in declaration order. Fixed-width |
| integer(kind=default_int), | public, | parameter | :: | PARTICLE_SOA_N_FIELDS | = | 6 |
Number of fields, which is also the number of field records a stream carries after the prologue. |
| character(len=*), | public, | parameter | :: | PARTICLE_SOA_SCHEMA | = | SOA_SCHEMA_PREFIX//"particle;id:i32,x:r64,y:r64,z:r64,mass:r64,active:bool" |
Layout identity written into every stream and folded into every digest. Any change to the field list changes it, which is what makes a stale checkpoint fail loudly instead of decoding as garbage. |
6 parallel field arrays plus size/capacity bookkeeping.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public, | allocatable | :: | active(:) |
Whether the particle takes part in the simulation. |
||
| type(soa_extent_t), | public | :: | extent |
Live element count and allocated capacity. |
|||
| integer(kind=int32), | public, | allocatable | :: | id(:) |
Particle identifier. |
||
| real(kind=dp), | public, | allocatable | :: | mass(:) |
Particle mass. |
||
| real(kind=dp), | public, | allocatable | :: | x(:) |
Cartesian x coordinate. |
||
| real(kind=dp), | public, | allocatable | :: | y(:) |
Cartesian y coordinate. |
||
| real(kind=dp), | public, | allocatable | :: | z(:) |
Cartesian z coordinate. |
| procedure, public :: allocate => particle_soa_allocate | |
| procedure, public :: capacity => particle_soa_capacity | |
| procedure, public :: clear => particle_soa_clear | |
| procedure, public :: deallocate => particle_soa_deallocate | |
| procedure, public :: deserialize => particle_soa_deserialize | |
| procedure, public :: resize => particle_soa_resize | |
| procedure, public :: serialize => particle_soa_serialize | |
| procedure, public :: serialized_bytes => particle_soa_serialized_bytes | |
| procedure, public :: size => particle_soa_size | |
| procedure, public :: state_hash => particle_soa_state_hash | |
| procedure, public :: state_hash64 => particle_soa_state_hash64 |
Allocated length of every field array. Always at least size().
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(in) | :: | this |
Container to query. |
Exact size in bytes of the stream serialize would write now.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(in) | :: | this |
Container to measure. |
Number of live elements.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(in) | :: | this |
Container to query. |
32-bit FNV-1a digest of the container’s live state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(in) | :: | this |
Container to fingerprint. |
64-bit FNV-1a digest of the container’s live state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(in) | :: | this |
Container to fingerprint. |
Give the container n live elements, discarding any it already had.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(inout) | :: | this |
Container to (re)allocate. |
||
| integer(kind=default_int), | intent(in) | :: | n |
Number of live elements. Must not be negative. |
||
| type(error_t), | intent(inout) | :: | err |
Error state, |
Drop every live element but keep the allocated capacity.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(inout) | :: | this |
Container to empty. |
Release every field array and reset both counters to zero.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(inout) | :: | this |
Container to empty. |
Read a container back from an open stream unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(inout) | :: | this |
Container to fill. Any previous contents are discarded. |
||
| integer(kind=default_int), | intent(in) | :: | unit |
Stream unit opened for unformatted stream reading. |
||
| type(error_t), | intent(inout) | :: | err |
Error state, |
Change the number of live elements, preserving the elements that survive.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(inout) | :: | this |
Container to resize. |
||
| integer(kind=default_int), | intent(in) | :: | n |
New number of live elements. Must not be negative. |
||
| type(error_t), | intent(inout) | :: | err |
Error state, |
Write the container to an open stream unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(particle_soa_t), | intent(in) | :: | this |
Container to write. |
||
| integer(kind=default_int), | intent(in) | :: | unit |
Stream unit opened for unformatted stream writing. |
||
| type(error_t), | intent(inout) | :: | err |
Error state, |