42 complex(real64),
allocatable :: zfield(:, :, :)
43 real(real64),
allocatable :: dfield(:, :, :)
44 real(real64),
allocatable :: times(:)
50 character(len=MAX_PATH_LEN) :: label
52 procedure :: dtime_interpolation_add_time, ztime_interpolation_add_time
53 generic :: add_time => dtime_interpolation_add_time, ztime_interpolation_add_time
54 procedure :: dtime_interpolation_interpolate, ztime_interpolation_interpolate
55 generic ::
interpolate => dtime_interpolation_interpolate, ztime_interpolation_interpolate
62 procedure time_interpolation_constructor
67 integer,
intent(in) :: np
68 integer,
intent(in) :: dim
69 integer,
intent(in) :: depth
70 logical,
intent(in) :: cmplx
71 character(len=*),
intent(in) :: label
72 class(time_interpolation_t),
pointer :: this
80 this%max_depth = depth
83 this%label = trim(label)
86 safe_allocate(this%zfield(1:np, 1:dim, 1:depth))
88 safe_allocate(this%dfield(1:np, 1:dim, 1:depth))
90 safe_allocate(this%times(1:depth))
96 type(time_interpolation_t),
intent(inout) :: this
101 safe_deallocate_a(this%zfield)
103 safe_deallocate_a(this%dfield)
105 safe_deallocate_a(this%times)
111 class(time_interpolation_t),
intent(in) :: this
112 class(mesh_t),
intent(in) :: mesh
113 class(space_t),
intent(in) :: space
114 type(restart_t),
intent(in) :: restart
115 integer,
intent(out) :: err
117 integer :: itime, idim, err_restart, iunit
118 character(len=MAX_PATH_LEN) :: filename, lines(1)
124 do itime = 1, this%depth
125 do idim = 1, this%dim
126 write(filename,
'(a1,i2.2,a1,i3.3)')
'_', itime,
'_', idim
127 filename =
"field_" // trim(this%label) // trim(filename)
130 this%zfield(1:this%np, idim, itime), err_restart)
133 this%dfield(1:this%np, idim, itime), err_restart)
135 if (err_restart /= 0) err = err + 1
140 call drestart_write_binary(restart,
"field_times_"//trim(this%label), this%depth, this%times(1:this%depth), err_restart)
141 if (err_restart /= 0) err = err + 1
144 iunit =
restart_open(restart,
"field_"//trim(this%label))
145 write(lines(1),
'(i2.2)') this%depth
147 if (err_restart /= 0) err = err + 1
155 class(
mesh_t),
intent(in) :: mesh
156 class(
space_t),
intent(in) :: space
158 integer,
intent(out) :: err
160 integer :: itime, idim, err_restart, iunit
161 character(len=MAX_PATH_LEN) :: filename, lines(1)
166 iunit =
restart_open(restart,
"field_"//trim(this%label))
167 call restart_read(restart, iunit, lines, 1, err_restart)
168 if (err_restart /= 0)
then
173 read(lines(1),
'(i2.2)') this%depth
179 do itime = 1, this%depth
180 do idim = 1, this%dim
181 write(filename,
'(a1,i2.2,a1,i3.3)')
'_', itime,
'_', idim
182 filename =
"field_" // trim(this%label) // trim(filename)
185 this%zfield(1:this%np, idim, itime), err_restart)
188 this%dfield(1:this%np, idim, itime), err_restart)
190 if (err_restart /= 0) err = err + 1
195 call drestart_read_binary(restart,
"field_times_"//trim(this%label), this%depth, this%times(1:this%depth), err_restart)
196 if (err_restart /= 0) err = err + 1
202#include "time_interpolation_inc.F90"
205#include "complex.F90"
206#include "time_interpolation_inc.F90"
This is the common interface to a simple-minded polynomical interpolation procedure (simple use of th...
This module is intended to contain "only mathematical" functions and procedures.
This module defines the meshes, which are used in Octopus.
subroutine, public restart_read(restart, iunit, lines, nlines, ierr)
subroutine, public restart_close(restart, iunit)
Close a file previously opened with restart_open.
subroutine, public restart_write(restart, iunit, lines, nlines, ierr)
integer function, public restart_open(restart, filename, status, position, silent)
Open file "filename" found inside the current restart directory. Depending on the type of restart,...
subroutine time_interpolation_read_restart(this, mesh, space, restart, err)
subroutine time_interpolation_write_restart(this, mesh, space, restart, err)
subroutine time_interpolation_finalize(this)
class(time_interpolation_t) function, pointer time_interpolation_constructor(np, dim, depth, cmplx, label)
Describes mesh distribution to nodes.