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)
129 call restart%write_mesh_function(space, filename, mesh, &
130 this%zfield(1:this%np, idim, itime), err_restart)
132 call restart%write_mesh_function(space, filename, mesh, &
133 this%dfield(1:this%np, idim, itime), err_restart)
135 if (err_restart /= 0) err = err + 1
140 call restart%write_binary(
"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(
"field_"//trim(this%label))
145 write(lines(1),
'(i2.2)') this%depth
146 call restart%write(iunit, lines, 1, err_restart)
147 if (err_restart /= 0) err = err + 1
148 call restart%close(iunit)
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(
"field_"//trim(this%label))
167 call restart%read(iunit, lines, 1, err_restart)
168 if (err_restart /= 0)
then
173 read(lines(1),
'(i2.2)') this%depth
175 call restart%close(iunit)
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)
184 call restart%read_mesh_function(space, filename, mesh, &
185 this%zfield(1:this%np, idim, itime), err_restart)
187 call restart%read_mesh_function(space, filename, mesh, &
188 this%dfield(1:this%np, idim, itime), err_restart)
190 if (err_restart /= 0) err = err + 1
195 call restart%read_binary(
"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 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.