最初の読込み結果をpathごとに固定し、同一runのsamplingとfingerprintで共有する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path | |||
| real(kind=dp), | intent(out), | allocatable | :: | grid_v(:,:) | ||
| real(kind=dp), | intent(out), | allocatable | :: | f(:) |
subroutine get_velocity_grid_snapshot(path, grid_v, f) character(len=*), intent(in) :: path real(dp), allocatable, intent(out) :: grid_v(:, :) real(dp), allocatable, intent(out) :: f(:) type(velocity_grid_snapshot_entry), allocatable :: grown(:) real(dp), allocatable :: loaded_grid_v(:, :), loaded_f(:) character(len=:), allocatable :: normalized_path integer :: entry, old_size normalized_path = trim(path) if (len(normalized_path) == 0) error stop 'velocity_grid_path must not be empty.' if (allocated(velocity_grid_snapshots)) then do entry = 1, size(velocity_grid_snapshots) if (velocity_grid_snapshots(entry)%path == normalized_path) then allocate (grid_v, source=velocity_grid_snapshots(entry)%grid_v) allocate (f, source=velocity_grid_snapshots(entry)%f) return end if end do old_size = size(velocity_grid_snapshots) else old_size = 0 end if call read_velocity_grid_csv(normalized_path, loaded_grid_v, loaded_f) allocate (grown(old_size + 1)) if (old_size > 0) grown(:old_size) = velocity_grid_snapshots grown(old_size + 1)%path = normalized_path grown(old_size + 1)%grid_v = loaded_grid_v grown(old_size + 1)%f = loaded_f call move_alloc(grown, velocity_grid_snapshots) allocate (grid_v, source=loaded_grid_v) allocate (f, source=loaded_f) end subroutine get_velocity_grid_snapshot