52 real(kind=
rp) :: t_begin
53 real(kind=
rp) :: t_diff
54 integer :: samp_interval
65 subroutine stats_init(this, T_begin, samp_interval, size)
66 class(
stats_t),
intent(inout) :: this
67 real(kind=
rp),
intent(in) :: t_begin
68 integer,
intent(in) :: samp_interval
69 integer,
intent(inout),
optional ::size
74 if (
present(size))
then
80 allocate(this%quant_list(n))
83 this%quant_list(i)%quantp => null()
88 this%T_begin = t_begin
89 this%samp_interval = samp_interval
96 class(
stats_t),
intent(inout) :: this
98 if (
allocated(this%quant_list))
then
99 deallocate(this%quant_list)
108 class(
stats_t),
intent(inout) :: this
110 type(
quantp_t),
allocatable :: tmp(:)
112 if (this%n .ge. this%size)
then
113 allocate(tmp(this%size * 2))
114 tmp(1:this%size) = this%quant_list
115 call move_alloc(tmp, this%quant_list)
116 this%size = this%size * 2
120 this%quant_list(this%n)%quantp => quant
125 class(
stats_t),
intent(inout) :: this
126 real(kind=
rp),
intent(in) :: t
127 real(kind=
rp),
intent(in) :: dt
128 integer,
intent(in) :: tstep
130 character(len=LOG_SIZE) :: log_buf
131 real(kind=
rp) :: sample_start_time, sample_end_time
132 real(kind=
dp) :: sample_time
134 if (t .ge. this%T_begin .and. this%n .gt. 0)
then
135 this%t_diff = this%t_diff + dt
139 if (mod(tstep,this%samp_interval) .eq. 0)
then
142 sample_start_time = mpi_wtime()
144 call this%quant_list(i)%quantp%update(this%t_diff)
148 sample_end_time = mpi_wtime()
149 sample_time = sample_end_time - sample_start_time
150 write(log_buf,
'(A17,1x,F10.6,A,F9.6)')
'Sampling at time:', t, &
151 ' Sampling time (s): ', sample_time
type(mpi_comm) neko_comm
MPI communicator.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
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_eval(this, t, dt, tstep)
Evaluated all statistical quantities.
subroutine stats_free(this)
Deallocate.
subroutine stats_init(this, t_begin, samp_interval, size)
Initialize statistics, computed after T_begin.
subroutine stats_add(this, quant)
Add a statistic quantitiy quant to the backend.
Pointer to an arbitrary quantitiy.
Abstract type defining a statistical quantity.