Commit ace48ac3 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

preparations for "forced matching"

- moved matching function from data_types to matching
- cformat_role accepts 'short' parameter (default)
- new_com shwudf formatted write
parent 72b552f5
Loading
Loading
Loading
Loading

examples/match_test

0 → 100644
+15 −0
Original line number Diff line number Diff line
macro
! ==== set paths
datapath ./examples
!set m.j0_abs 1.0
!set m.j0_rel 1.0
! ==== set binning
bins pix nbins 8
bins tof custom 2 13 26 39
! ==== read data
read s5848.echo s5849.echo s5853.echo as resolution
read s5854.echo s5855.echo s5860.echo s5861.echo as sample
! ==== match
match all
match show

examples/match_test2

0 → 100644
+15 −0
Original line number Diff line number Diff line
macro
clear all
datapath /SNS/NSE/IPTS-26145
! resolution data
read s10879.echo as res ! 11A Q=0.035
read s10882.echo as res !  8A Q=0.050
! buffer data
read s10903.echo as buf ! 11A Q=0.035
read s10906.echo as buf !  8A Q=0.050
!
read s10871.echo as sam ! 11A Q=0.035
read s10875.echo as sam !  8A Q=0.050
!
match all
match show
+2 −2
Original line number Diff line number Diff line
# Makefile.depend Thu May 28 18:47:29 EDT 2020
# Makefile.depend Thu Aug 12 17:59:43 EDT 2021
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 
@@ -30,7 +30,7 @@ write_utils.o : write_utils.f90 strings_module.o constants_module.o data_types.o
fit_utils.o : fit_utils.f90 echo_shapes.o polynom.o logger.o data_types.o drspine_parameters.o 
read_data.o : read_data.f90 binning.o logger.o file_utils.o read_utils.o instrument_config.o geometry_types.o data_types.o base_types.o constants_module.o 
fit_data.o : fit_data.f90 logger.o mathutil.o fit_utils.o dump_data.o echo_shapes.o data_types.o constants_module.o 
reduce_data.o : reduce_data.f90 instrument_config.o data_types.o constants_module.o
reduce_data.o : reduce_data.f90 instrument_config.o dump_data.o data_types.o constants_module.o 
instrument_config.o : instrument_config.f90 echo_shapes.o binning.o geometry_types.o strings_module.o drspine_parameters.o 
module_gen_makro.o : module_gen_makro.f90 strings_module.o 
gr_interface.o : gr_interface.f90 drspine_parameters.o 
+0 −73
Original line number Diff line number Diff line
@@ -2232,77 +2232,4 @@ endif
 
  end subroutine consolidate_colldata

!  type scan_data_struct_pointer
!    type(scan_data_struct), pointer                     :: ptr => null()
!  end type scan_data_struct_pointer


! >>new>> mm
  subroutine add_matching_ptr( matches, ptr_to_add )  
    implicit none
    type(scan_data_struct_pointer) , intent(inout) :: matches(:)
    type(scan_data_struct), pointer, intent(inout) :: ptr_to_add

    integer :: i

    if(.not.associated(ptr_to_add)) then
      write(*,*)"TEST ERR PTR NOT ASSOCIATED"
      return
    endif

d1:    do i=1, size(matches)
         if(associated(matches(i)%ptr,ptr_to_add)) cycle
         if(.not.associated(matches(i)%ptr)      ) then
!!TEST!! write(*,*)"TESTMATCH ADD : ",i, ptr_to_add%id 
           matches(i)%ptr =>  ptr_to_add 
!!TEST!! write(*,*)"TESTMATCH ADDc: ",i,  matches(i)%ptr%id
           return
         endif    
       enddo d1

       call msg_error('matching', 'to many matches to one point ', ERROR_DATA_PROCESSING)

  end subroutine add_matching_ptr


  subroutine clear_matches( matches )  
    implicit none
    type(scan_data_struct_pointer) , intent(inout) :: matches(:)

    integer :: i


    do i=1, size(matches)
      matches(i)%ptr => null()
    enddo

  end subroutine clear_matches



  function list_matching_ids( matches) result(clist) 
    implicit none
    integer, parameter :: idfmt_width = 10
    type(scan_data_struct_pointer) , intent(in)    :: matches(:)
    character(len=(idfmt_width+1)*size(matches))                :: clist
    character(len=idfmt_width) :: idbuf

    integer :: i
    
    clist = " "
d1:    do i=1, size(matches)
         if(.not. associated(matches(i)%ptr)  ) then
!!TEST!! write(*,*)"TMATCHLIST0:", i," is not associated!"             
            cycle d1      
         endif
         write(idbuf,'(i0)')  matches(i)%ptr%id 
         clist = trim(clist)//" "//idbuf
!!TEST!! write(*,*)"TMATCHLIST1:", i,    matches(i)%ptr%id  
       enddo d1

  end function list_matching_ids


! <<new<< mm

end module data_types
+6 −0
Original line number Diff line number Diff line
@@ -1863,6 +1863,12 @@ CONTAINS
    call msg_info('match', '===> matching datasets')
    match_role = ROLE_UNDEFINED

    if (found('show')) then
        call match_show(data_scan, data_manager_size())
        call unused( 1, 1, 1, ier)
        return
    end if

!! >>TEST>>
    do i= 1, size(data_scan)
      if ( .not. is_valid_scan(data_scan(i))) cycle
Loading