37 real(kind=double),
allocatable :: datas(:, :)
40 real(kind=double),
allocatable :: times(:)
69 class(
dataseq),
intent(inout) :: this
70 integer,
intent(in) :: lun_err
71 integer,
intent(in) :: ndata
72 integer,
intent(in) :: nsequence
78 this%nsequence = nsequence
80 this%datas(ndata, nsequence), &
81 this%times(nsequence), &
84 ' type dataseq member datas times')
101 class(
dataseq),
intent(inout) :: this
102 integer,
intent(in) :: lun_err
111 ' type dataseq member datas')
116 ' type dataseq membertimes')
128 class(
dataseq),
intent(inout) :: this
129 real(kind=double),
intent(in) ::
data(this%ndata)
130 real(kind=double),
intent(in) :: time
133 this%nstored = this%nstored + 1
134 this%nstored = min(this%nstored, this%nsequence)
137 this%istored = this%istored + 1
138 if (this%istored .eq. (this%nsequence + 1)) this%istored = 1
141 this%datas(:, this%istored) =
data(:)
142 this%times(this%istored) = time
157 class(
dataseq),
intent(in) :: this
158 real(kind=double),
intent(in) :: time
159 real(kind=double),
intent(inout) :: interpolation(this%ndata)
160 integer,
intent(inout) :: info
162 integer :: i, idata, nsequence
163 real(kind=double) :: coeff_langrange
166 if (this%nstored .ne. this%nsequence)
then
171 nsequence = this%nsequence
173 interpolation(:) = zero
176 idata = this%istored + i - 1
177 if (idata > nsequence)
then
178 idata = idata - nsequence
180 write (*, *) i, idata
183 coeff_langrange =
eval_coeff(idata, nsequence, this%times, time)
185 interpolation(:) = interpolation(:) + &
186 coeff_langrange*this%datas(:, idata)
193 integer,
intent(in) :: idata
194 integer,
intent(in) :: ntimes
196 real(kind=double),
intent(in) :: times(ntimes)
197 real(kind=double),
intent(in) :: time
198 real(kind=double) :: out
204 if (i .ne. idata)
then
205 out = out*(time - times(i))/(times(idata) - times(i))
real(kind=double) function eval_coeff(idata, ntimes, times, time)
subroutine kill_dataseq(this, lun_err)
Static destructor for datasequence::dataseq.
subroutine init_dataseq(this, lun_err, ndata, nsequence)
Static constructor for datasequence::dataseq.
subroutine lagrange_interpolation(this, time, interpolation, info)
Lagrange interpolation in time of stored data.
subroutine fill_dataseq(this, data, time)
Add new data to the database.
integer, parameter err_alloc
Error allocation failed.
integer, parameter err_dealloc
Error deallocation failed.
logical function ioerr(lun, errno, call_proc, add_msg, add_int)
Handle and write alert I/O warnings and errors.
Data structure to store time-sequence of real data.