Rank-0 caller only. Cache errors are recoverable; live arrays change only on a valid hit. Native IEEE binary64 stream format; Linux build discovery and POSIX atomic publication.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int64), | private, | parameter | :: | format_version | = | 1 | |
| integer(kind=int64), | private, | parameter | :: | algorithm_revision | = | 1 | |
| integer, | private, | parameter | :: | header_size | = | 312 | |
| integer, | private, | parameter | :: | trailer_size | = | 80 | |
| character(len=16), | private, | parameter | :: | magic | = | 'ALPS_REL_CACHE' | |
| character(len=16), | private, | parameter | :: | complete | = | 'ALPS_REL_DONE' | |
| logical, | private, | save | :: | build_attempted | = | .false. | |
| logical, | private, | save | :: | build_ok | = | .false. | |
| character(len=64), | private, | save | :: | build_hash | = | '' | |
| character(len=256), | private, | save | :: | build_reason | = | '' |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=c_char), | intent(inout) | :: | template(*) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=c_int), | value | :: | fd |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=c_char), | intent(in) | :: | old(*) | |||
| character(len=c_char), | intent(in) | :: | new(*) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=c_char), | intent(in) | :: | path(*) |
Validated construction identity produced by cache_identity, never read from a filename.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=64), | public | :: | key | = | '' |
Lowercase SHA-256 input key and strict executable/library/environment compatibility digest. |
|
| character(len=64), | public | :: | build | = | '' |
Lowercase SHA-256 input key and strict executable/library/environment compatibility digest. |
|
| integer, | public | :: | dims(4) | = | 0 |
Source nperp/npar and target ngamma/npparbar interval counts, excluding species index. |
|
| real(kind=real64), | public | :: | settings(4) | = | 0 |
Exact construction parameters; smoothing is currently zero. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | directory | |||
| type(rel_cache_identity), | intent(in) | :: | id |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(rel_cache_identity), | intent(in) | :: | id |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(rel_cache_identity), | intent(in) | :: | id | |||
| real(kind=real64), | intent(in) | :: | normalization |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | values(0:,0:,:) | |||
| real(kind=real64), | intent(in) | :: | normalization |
Fail closed if executable/library/CPU identity cannot be established.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sha256_state), | intent(inout) | :: | state | |||
| character(len=*), | intent(in) | :: | text |
Hash all consumed source data and construction settings, never species index or filename.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | coordinates(0:,0:,:) | |||
| real(kind=real64), | intent(in) | :: | source(0:,0:) | |||
| real(kind=real64), | intent(in) | :: | mass | |||
| real(kind=real64), | intent(in) | :: | va | |||
| real(kind=real64), | intent(in) | :: | pi | |||
| integer, | intent(in) | :: | ngamma | |||
| integer, | intent(in) | :: | npparbar | |||
| type(rel_cache_identity), | intent(out) | :: | id | |||
| logical, | intent(out) | :: | ok | |||
| character(len=*), | intent(out) | :: | reason |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path | |||
| type(rel_cache_identity), | intent(in) | :: | id | |||
| real(kind=real64), | intent(out), | allocatable | :: | values(:,:,:) | ||
| real(kind=real64), | intent(out) | :: | normalization | |||
| logical, | intent(out) | :: | ok | |||
| character(len=*), | intent(out) | :: | reason |
Transactional load: rejected entries never modify caller arrays. Arrays retain zero-based target-grid bounds; derivative component bounds are 1:2. On hit, normalization is the saved pre-division integral, not a new integration. The caller must use an identity from cache_identity and matching destination shapes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | directory | |||
| type(rel_cache_identity), | intent(in) | :: | id | |||
| real(kind=real64), | intent(inout) | :: | gamma(0:,0:) | |||
| real(kind=real64), | intent(inout) | :: | parallel(0:,0:) | |||
| real(kind=real64), | intent(inout) | :: | distribution(0:,0:) | |||
| real(kind=real64), | intent(inout) | :: | derivatives(0:,0:,:) | |||
| real(kind=real64), | intent(out) | :: | normalization | |||
| logical, | intent(out) | :: | hit | |||
| character(len=*), | intent(out) | :: | reason |
Write/close/verify a unique same-directory temporary entry before atomic POSIX rename. Inputs are read-only. Failure returns ok=false and leaves an existing entry untouched. Uses libc via ISO_C_BINDING; no C source or additional library is required on Linux.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | directory | |||
| type(rel_cache_identity), | intent(in) | :: | id | |||
| real(kind=real64), | intent(in) | :: | gamma(0:,0:) | |||
| real(kind=real64), | intent(in) | :: | parallel(0:,0:) | |||
| real(kind=real64), | intent(in) | :: | distribution(0:,0:) | |||
| real(kind=real64), | intent(in) | :: | derivatives(0:,0:,:) | |||
| real(kind=real64), | intent(in) | :: | normalization | |||
| logical, | intent(out) | :: | ok | |||
| character(len=*), | intent(out) | :: | reason |