P2.5: stage an interior-sized (nx_p, ny_p) bathymetry array on
the PENDING handle c_handle (rdb_ocean_create_pending).
Consumed by engine_setup inside rdb_ocean_create_finalize —
see rdb_ocean_bathymetry_inject for the sign-normalisation +
wet-fraction validation the array goes through THERE (not here:
shape can’t be checked against nx_phys/ny_phys until the grid
exists, which engine_setup builds).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | intent(in), | value | :: | c_handle | ||
| real(kind=c_double), | intent(in) | :: | b_data(nx_p,ny_p) | |||
| integer(kind=c_int), | intent(in), | value | :: | nx_p | ||
| integer(kind=c_int), | intent(in), | value | :: | ny_p | ||
| integer(kind=c_int), | intent(in), | value | :: | convention |
|
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(ocean_handle_t), | private, | pointer | :: | h |
function rdb_ocean_stage_bathymetry(c_handle, b_data, nx_p, ny_p, convention) & result(status) bind(c, name="rdb_ocean_stage_bathymetry") !! P2.5: stage an interior-sized `(nx_p, ny_p)` bathymetry array on !! the PENDING handle `c_handle` (`rdb_ocean_create_pending`). !! Consumed by `engine_setup` inside `rdb_ocean_create_finalize` — !! see `rdb_ocean_bathymetry_inject` for the sign-normalisation + !! wet-fraction validation the array goes through THERE (not here: !! shape can't be checked against `nx_phys`/`ny_phys` until the grid !! exists, which `engine_setup` builds). type(c_ptr), intent(in), value :: c_handle integer(c_int), intent(in), value :: nx_p, ny_p real(c_double), intent(in) :: b_data(nx_p, ny_p) integer(c_int), intent(in), value :: convention !! `BATHY_CONVENTION_DEPTH_POSITIVE_DOWN` (1) or !! `_HEIGHT_POSITIVE_UP` (2) — REQUIRED, no default (D6.2: sign is !! the single most dangerous argument in this API). Any other !! value is rejected at `create_finalize` time (not here). integer(c_int) :: status type(ocean_handle_t), pointer :: h status = resolve_ocean_pending(c_handle, h) if (status /= OCEAN_STATUS_OK) return if (allocated(h%engine%staged_bathymetry)) deallocate (h%engine%staged_bathymetry) allocate (h%engine%staged_bathymetry(nx_p, ny_p), source=real(b_data, wp)) h%engine%staged_bathymetry_convention = int(convention) status = int(OCEAN_STATUS_OK, c_int) end function rdb_ocean_stage_bathymetry