51 real(kind=
rp) :: t_begin
52 real(kind=
rp) :: t_diff
53 integer :: samp_interval
64 subroutine stats_init(this, T_begin, samp_interval, size)
65 class(
stats_t),
intent(inout) :: this
66 real(kind=
rp),
intent(in) :: t_begin
67 integer,
intent(in) :: samp_interval
68 integer,
intent(inout),
optional ::size
73 if (
present(size))
then
79 allocate(this%quant_list(n))
82 this%quant_list(i)%quantp => null()
87 this%T_begin = t_begin
88 this%samp_interval = samp_interval
95 class(
stats_t),
intent(inout) :: this
97 if (
allocated(this%quant_list))
then
98 deallocate(this%quant_list)
107 class(
stats_t),
intent(inout) :: this
109 type(
quantp_t),
allocatable :: tmp(:)
111 if (this%n .ge. this%size)
then
112 allocate(tmp(this%size * 2))
113 tmp(1:this%size) = this%quant_list
114 call move_alloc(tmp, this%quant_list)
115 this%size = this%size * 2
119 this%quant_list(this%n)%quantp => quant
124 class(
stats_t),
intent(inout) :: this
125 real(kind=
rp),
intent(in) :: t
126 real(kind=
rp),
intent(in) :: dt
127 integer,
intent(in) :: tstep
129 character(len=LOG_SIZE) :: log_buf
130 real(kind=
rp) :: sample_start_time, sample_end_time
131 real(kind=
dp) :: sample_time
133 if (t .ge. this%T_begin .and. this%n .gt. 0)
then
134 this%t_diff = this%t_diff + dt
138 if (mod(tstep,this%samp_interval) .eq. 0)
then
141 sample_start_time = mpi_wtime()
143 call this%quant_list(i)%quantp%update(this%t_diff)
147 sample_end_time = mpi_wtime()
148 sample_time = sample_end_time - sample_start_time
149 write(log_buf,
'(A17,1x,F10.6,A,F9.6)')
'Sampling at time:', t, &
150 ' Sampling time (s): ', sample_time
type(mpi_comm) neko_comm
MPI communicator.
type(log_t), public neko_log
Global log stream.
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
Defines a statistical quantity.
Defines a container for all statistics.
subroutine stats_init(this, T_begin, samp_interval, size)
Initialize statistics, computed after T_begin.
subroutine stats_eval(this, t, dt, tstep)
Evaluated all statistical quantities.
subroutine stats_free(this)
Deallocate.
subroutine stats_add(this, quant)
Add a statistic quantitiy quant to the backend.
Pointer to an arbitrary quantitiy.
Abstract type defining a statistical quantity.