Commit 9e147450 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

match clear and match show implemented

parent 1aa771f0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -11,5 +11,10 @@ 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 show
!
match all
match show
!
match clear
match show
+13 −15
Original line number Diff line number Diff line
@@ -607,11 +607,14 @@ program drspine
     !> COMMAND: match
     !-------------------------------------------------------------
     if(command('match  ', &
          ' match [all|resolution|background] '//LF//&
          '   - matches data sets to each other'//LF//&
          '   resolution|res - matches resolution data to sample and background data'//LF//&
          '   background|bgr - matches background data to sample data'//LF//&
          '   all            - same as resolution and background $' )) then
          ' match [all|res|bgr|clear|show] '//LF//&
          '   - data matching command '//LF//&
          '     all                - same as "match resolution background"'//LF//&
          '     res|ref|resolution - matches sample/background to resolution'//LF//&
          '     bgr|background     - matches sample to background'//LF//&
          '     clear              - clear all matching data'//LF//&
          '     show               - show all matching data $' )) then

        !               ===============
        call cmd_match()
        cycle commandloop
@@ -1857,7 +1860,6 @@ CONTAINS
  subroutine cmd_match()
    !         ===========
    implicit none
    integer :: i, j
    integer :: match_role

    call msg_info('match', '===> matching datasets')
@@ -1869,15 +1871,11 @@ CONTAINS
        return
    end if

!! >>TEST>>
    do i= 1, size(data_scan)
      if ( .not. is_valid_scan(data_scan(i))) cycle
      do j=1, data_scan(i)%number_of_points
          call clear_matches(data_scan(i)%scan_point(j)%matching_ref_arr)
          call clear_matches(data_scan(i)%scan_point(j)%matching_bgr_arr)
      enddo
   enddo
!! <<TEST>>
    if (found('clear')) then
        call match_clear(data_scan, data_manager_size())
        call unused( 1, 1, 1, ier)
        return
    end if


    if( found('resolution') .or. found('res') ) match_role = ior(match_role, ROLE_REFERENCE )
+27 −4
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ module matching

  public  :: taupoint_match, taupoint_mismatch, cformat_match_accuracy
  public  :: clear_matches, list_matching_ids
  public  :: match_scans, match_show
  public  :: match_scans, match_show, match_clear
  public  :: matching_tolerance

contains
@@ -286,6 +286,8 @@ contains
  !! This subroutine matches scans in scan_data array based on match_role.
  !! @param scan_data  - array of scan_struct data
  !! @param scan_size  - size of scan_data
  !! @param match_role - target data role
  !! @note
  subroutine match_scans(scan_data, scan_size, match_role)
    type(scan_struct), dimension(:) :: scan_data
    integer, intent(in) :: scan_size
@@ -309,7 +311,7 @@ contains
  !! @param scan_data - array of scan_struct data
  !! @param scan_size - size of scan_data
  subroutine match_show(scan_data, scan_size)
    type(scan_struct), dimension(:), target :: scan_data
    type(scan_struct), intent(in), dimension(:), target :: scan_data
    integer, intent(in) :: scan_size
    !
    integer :: i, j
@@ -340,4 +342,25 @@ contains
    end do source_loop
  end subroutine match_show

  !> clear current matches
  !! @param scan_data - array of scan_struct data
  !! @param scan_size - size of scan_data
  subroutine match_clear(scan_data, scan_size)
    type(scan_struct), dimension(:), target :: scan_data
    integer, intent(in) :: scan_size
    !
    integer :: i, j
    !type(scan_data_struct), pointer :: src, tgt
    source_loop: do i= 1, scan_size
      if ( .not. is_valid_scan(scan_data(i))) cycle
      if ( has_role(scan_data(i)%role, ROLE_REFERENCE) ) cycle source_loop ! resolution cannot be a matched to source (PAZ: FIXME?)
      tau_loop: do j=1, scan_data(i)%number_of_points
          scan_data(i)%scan_point(j)%matching_ref => null()
          scan_data(i)%scan_point(j)%matching_bgr => null()
          call clear_matches(scan_data(i)%scan_point(j)%matching_ref_arr)
          call clear_matches(scan_data(i)%scan_point(j)%matching_bgr_arr)
      end do tau_loop
    end do source_loop
  end subroutine match_clear

end module matching