Class counter_class
In: LatticeClass/counter_class.F90
constants_module counter_class dot/f_244.png

Definition of counter class

Version

 $Id: counter_class.F90,v 1.10 2011/01/31 11:10:24 ishikawa Exp $

Methods

Included Modules

constants_module

Public Instance methods

counter
Derived Type :

counter class

Subroutine :
this :type(counter), intent(out)

[Source]

subroutine delete_counter(this)
  implicit none
  type(counter), intent(out) :: this
  this%ave  = 0.0_DP
  this%iter = 0
  this%itry = 0
  this%is_initialized = .FALSE.
  return
end subroutine
Function :
ave :real(DP)
this :type(counter), intent(inout)

return average inclements

ave <= this%iter/this%itry

  • this%itry : call inc count
  • this%iter : total increment count

[Source]

function get_average_counter(this) result(ave)
!
! return average inclements
!
! ave <= this%iter/this%itry
!
! * this%itry : call inc count
! * this%iter : total increment count
!
  implicit none
  type(counter), intent(inout) :: this
  real(DP) :: ave

  if (this%itry /= 0) then
    this%ave=dble(this%iter)/this%itry
  else
    this%ave=0.0_DP
  endif
  ave = this%ave
  return
end function
Function :
count :integer(8)
this :type(counter), intent(in)

return current call counter

[Source]

function get_called_counter_i8(this) result(count)
!
! return current call counter
!
  implicit none
  type(counter), intent(in) :: this
  integer(8) :: count
  count = this%itry
  return
end function
Function :
count :integer(8)
this :type(counter), intent(in)

return current increment counter

[Source]

function get_count_counter_i8(this) result(count)
!
! return current increment counter
!
  implicit none
  type(counter), intent(in) :: this
  integer(8) :: count
  count = this%iter
  return
end function
Subroutine :
this :type(counter), intent(inout)
: counter
incl :integer, optional, intent(in)
: inclement by incl

increments counter by incl

this also counts call count

[Source]

subroutine inc_counter(this,incl)
!
! increments counter by incl
!
! this also counts call count
!
  implicit none
  type(counter),     intent(inout) :: this  ! counter
  integer, optional, intent(in)    :: incl  ! inclement by incl

  if (present(incl)) then
    this%iter=this%iter+incl
  else
    this%iter=this%iter+1
  endif

  !
  ! count call inc 
  !
  this%itry=this%itry+1 

  return
end subroutine
Function :
status :logical
this :type(counter), intent(in)

[Source]

function is_initialized_counter(this) result(status)
  implicit none
  type(counter), intent(in) :: this
  logical :: status
  status = this%is_initialized
  return
end function
Subroutine :
this :type(counter), intent(out)

[Source]

subroutine new_counter(this)
  implicit none
  type(counter), intent(out) :: this
  this%ave  = 0.0_DP
  this%iter = 0
  this%itry = 0
  this%is_initialized = .TRUE.
  return
end subroutine