Commit 4a555b91 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

warning when empty collection

moved sqtinfo to collection structure
parent 5da82cdd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ export PROJARCH=$(PROJECT)-$(VERSION_MAJOR).$(VERSION_MINOR)

export VERSION_MAJOR=1
export VERSION_MINOR=0
export VERSION_RELEASE=2
export VERSION_RELEASE=3

git_rev=$(shell git rev-parse --short HEAD 2> /dev/null)
ifeq "$(git_rev)" ""
+2 −2
Original line number Diff line number Diff line
# Makefile.depend Thu Oct 24 11:36:08 EDT 2019
# Makefile.depend Wed Feb 19 15:36:03 EST 2020
drspine_version.o : drspine_version.F90 drspine_parameters.o 
os_utils.o : os_utils.F90 strings_module.o drspine_parameters.o 
new_com.o : new_com.F90 os_utils.o 
+39 −37
Original line number Diff line number Diff line
@@ -438,6 +438,34 @@ module data_types
    real(kind=DBL)                                              :: thickness          !> thickness d
    integer                                                     :: numor_tra          !> representative run number for the sample/bgr where it applies
 end type transmission_struct

!!!>>mm1216 added private structure for display purposes
  !integer, parameter, private  :: max_entries = 500000   !mm hier ggf besser vorhersage aud den andere paremetern (oder allocatable..)
  !integer,            private  :: itaus   ( max_entries )
  !integer,            private  :: iqs     ( max_entries )
  !real,               private  :: taus    ( max_entries )
  !real,               private  :: qs      ( max_entries )
  !real,               private  :: weights ( max_entries )
  !integer,            private  :: n_entries

!! paz replaced the above with the following struct
  integer, parameter :: MAX_SQTINFO_ENTRIES = 512*1024
  type sqtinfo_item_struct
    integer         :: itau
    integer         :: iq
    real(kind=SGL)  :: tau
    real(kind=SGL)  :: q
    real(kind=SGL)  :: weight
  end type sqtinfo_item_struct

  type sqtinfo_struct
    integer                                :: max_entries  ! current array size
    integer                                :: n_entries    ! number of "filled" elements
    type(sqtinfo_item_struct), allocatable :: items(:)
  end type sqtinfo_struct

!  type(sqtinfo_struct) :: sqtinfo

!
 type collection
    type(collection_item), allocatable                          :: tq_bin(:,:)
@@ -458,6 +486,7 @@ module data_types
    type(transmission_struct)                                   :: sam_transmission !> transmission characteristics of sample
    type(transmission_struct)                                   :: bgr_transmission !> transmission characteristics of bgr

    type(sqtinfo_struct)                                        :: sqtinfo          !> sqt info collected stats
 end type collection


@@ -471,34 +500,6 @@ module data_types
  !!!



!!!>>mm1216 added private structure for display purposes
  !integer, parameter, private  :: max_entries = 500000   !mm hier ggf besser vorhersage aud den andere paremetern (oder allocatable..)
  !integer,            private  :: itaus   ( max_entries )
  !integer,            private  :: iqs     ( max_entries )
  !real,               private  :: taus    ( max_entries )
  !real,               private  :: qs      ( max_entries )
  !real,               private  :: weights ( max_entries )
  !integer,            private  :: n_entries

!! paz replaced the above with the following struct
  integer, parameter :: MAX_SQTINFO_ENTRIES = 512*1024
  type sqtinfo_item_struct
    integer         :: itau
    integer         :: iq
    real(kind=SGL)  :: tau
    real(kind=SGL)  :: q
    real(kind=SGL)  :: weight
  end type sqtinfo_item_struct

  type sqtinfo_struct
    integer                                :: max_entries  ! current array size
    integer                                :: n_entries    ! number of "filled" elements
    type(sqtinfo_item_struct), allocatable :: items(:)
  end type sqtinfo_struct

  type(sqtinfo_struct) :: sqtinfo

! =========================================================================================
 interface trap_div
    module procedure trap_div_dbl
@@ -957,7 +958,7 @@ CONTAINS

    !! tau..., q... ??
!!!>>mm1216 added private structure for display purposes 
    call init_sqtinfo(sqtinfo)
    call init_sqtinfo(this%sqtinfo)
!!!<<mm1216 added private structure for display purposes 

  end subroutine init_collection_from_bins
@@ -1179,7 +1180,7 @@ CONTAINS
     sqt%tq_bin(it, iq)%update_counter = sqt%tq_bin(it, iq)%update_counter + 1

!!!>> mm1216 >>
     call add_to_sqtinfo(sqtinfo, iq, it, qabs, tau, delta2)
     call add_to_sqtinfo(sqt%sqtinfo, iq, it, qabs, tau, delta2)
                                           !!?? proper weight must still be considered !! 
!!!<< mm1216 <<

@@ -1833,9 +1834,10 @@ dotau: do it=it1,it2

!!!>>mm1216 very experimental tau histogramming --> auto tau histo

  subroutine tau_histogramming(edges, mxedges, nedges, xcatch, linear)
  subroutine tau_histogramming(coll_data, edges, mxedges, nedges, xcatch, linear)
! --------------------------------------------------------------------
    !implicit none
    type(collection), intent(in)          :: coll_data
    integer         , intent(in)          :: mxedges         ! max dim of edges
    double precision, intent(out)         :: edges(mxedges)  ! yields the edges
    integer         , intent(out)         :: nedges          ! and the number of edges
@@ -1858,29 +1860,29 @@ dotau: do it=it1,it2
    edges(1:mxedges)        = 0
    nedges                  = 0

    if(sqtinfo%n_entries <= 0) then
    if(coll_data%sqtinfo%n_entries <= 0) then
       call msg_error('tau_histogramming', 'run collect prior to iterate histogramming!', ERROR_DATA_PROCESSING)
       return
    endif

   !! fill histogramm

d1: do i = 1,sqtinfo%n_entries
d1: do i = 1,coll_data%sqtinfo%n_entries

if1:   if(linear) then
         !ith = nint( hsize * abs(taus(i)/NS)/taumax )
         ith = nint( hsize * abs(sqtinfo%items(i)%tau/NS)/taumax )
         ith = nint( hsize * abs(coll_data%sqtinfo%items(i)%tau/NS)/taumax )
         ith = min (  ith , hsize+1 )
       else ! assume log scale
         !ith =  nint( hsize * ( log(abs(taus(i)/NS)/taumin) /  log(taumax/taumin) ) )
         ith =  nint( hsize * ( log(abs(sqtinfo%items(i)%tau/NS)/taumin) /  log(taumax/taumin) ) )
         ith =  nint( hsize * ( log(abs(coll_data%sqtinfo%items(i)%tau/NS)/taumin) /  log(taumax/taumin) ) )
         ith =  min ( max(0, ith), hsize+1)
       endif if1

       !histo (ith)   =  histo(ith) + weights(i)
       !xhisto(ith)   = xhisto(ith) + taus(i)/NS * weights(i)
       histo (ith)   =  histo(ith) + sqtinfo%items(i)%weight
       xhisto(ith)   = xhisto(ith) + sqtinfo%items(i)%tau/NS * sqtinfo%items(i)%weight
       histo (ith)   =  histo(ith) + coll_data%sqtinfo%items(i)%weight
       xhisto(ith)   = xhisto(ith) + coll_data%sqtinfo%items(i)%tau/NS * coll_data%sqtinfo%items(i)%weight

    enddo d1

+2 −1
Original line number Diff line number Diff line
@@ -1176,7 +1176,7 @@ CONTAINS
        call msg_debug('cmd_histo','histo: entering tau histogramming '//&
                                   trim(msg_fmt("('xcatch=',g12.6)", xcatch ))//' '//&
                                   trim(msg_fmt("('maxbins=',i0)"  , maxbins)))
        call tau_histogramming(xedges, maxbins, nbins, xcatch, .not. log_scale)
        call tau_histogramming(collected_data, xedges, maxbins, nbins, xcatch, .not. log_scale)
        if (nbins<=0 .or. maxbins<nbins)  return ! paz avoid empty histos
        call create_bin_struct(xbins, xedges(1:nbins))
        call msg_debug('cmd_histo', 'histo: tau(iterated): '//trim(cformat_bin_struct(xbins)))
@@ -1921,6 +1921,7 @@ CONTAINS
    call msg_info('drspine', '===> sqtmap done, figure is: sqtmap.pdf')
!!!<< mm1216

    call collect_stats(collected_data)
    call unused( 1, 1, 1, ier)

  end subroutine cmd_collect
+5 −5
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ contains
    call gr_axes(0.25D0, 10d0**nint(log10(ymax)) /5, xmin, ymin, 1, 1, 0.01D0)

    !wmax = maxval(weights(1:n_entries))
    wmax = maxval(sqtinfo%items(1:sqtinfo%n_entries)%weight)
    wmax = maxval(coll_data%sqtinfo%items(1:coll_data%sqtinfo%n_entries)%weight)

    if(Qcatch > 0d0 ) then
       dtrqs0: do iq =1, cdout%q_bin%nbins
@@ -148,8 +148,8 @@ contains



    entries: do i = 1, sqtinfo%n_entries
       sqtitem = sqtinfo%items(i)
    entries: do i = 1, coll_data%sqtinfo%n_entries
       sqtitem = coll_data%sqtinfo%items(i)
       it      = sqtitem%itau
       iq      = sqtitem%iq
       tau     = real(sqtitem%tau / NS, kind=SGL)
@@ -167,8 +167,8 @@ contains
       endif

       !wmax = maxval(weights(1:n_entries), MASK=(iqs(1:n_entries)==iq))
       wmax = maxval(sqtinfo%items(1:sqtinfo%n_entries)%weight,&
            MASK=(sqtinfo%items(1:sqtinfo%n_entries)%iq==iq))
       wmax = maxval(coll_data%sqtinfo%items(1:coll_data%sqtinfo%n_entries)%weight,&
            MASK=(coll_data%sqtinfo%items(1:coll_data%sqtinfo%n_entries)%iq==iq))

       call gr_setlinewidth(   sqrt(  sqtitem%weight / wmax )  )
       call gr_setmarkersize(  sqrt(  sqtitem%weight / wmax )  )
Loading