anchor.diff:  ! return : number of member in specified group
   
   function get_grp_member_n( hecMESH, grp_type_name, name )
  -        implicit none
  -        integer(kind=kint) :: get_grp_member_n
  -        type (hecmwST_local_mesh),target :: hecMESH
  -        character(len=*) :: grp_type_name
  -        character(len=*) :: name
  -
  -        integer(kind=kint) :: i
  -
  -        call set_group_pointers( hecMESH, grp_type_name )
  -
  -        do i = 1, n_grp
  -                if( fstr_streqr(grp_name%s(i),name)) then
  -                        get_grp_member_n = grp_index(i) - grp_index(i-1)
  -                        return
  -                end if
  -        end do
  -        get_grp_member_n = 0
  -        return
  +  implicit none
  +  integer(kind=kint) :: get_grp_member_n
  +  type (hecmwST_local_mesh),target :: hecMESH
  +  character(len=*) :: grp_type_name
  +  character(len=*) :: name
  +  integer(kind=kint) :: i
  +
  +  call set_group_pointers( hecMESH, grp_type_name )
  +
  +  do i = 1, n_grp
  +    if( fstr_streqr(grp_name%s(i),name)) then
  +      get_grp_member_n = grp_index(i) - grp_index(i-1)
  +      return
  +    end if
  +  end do
  +  get_grp_member_n = 0
  +  return
   end function get_grp_member_n
   
   !------------------------------------------------------------------------------
  
positive.code: !-----------------------------------------------------------------------------!
  
  subroutine fstr_setup_visualize( ctrl )
          implicit none
          integer(kind=kint) :: ctrl
          integer(kind=kint) :: rcode
          integer(kind=kint) :: i, start_n, end_n
          character(HECMW_FILENAME_LEN) :: vis_filename = 'hecmw_vis.ini'
          integer(kind=kint), parameter :: buffsize = 127
          character( buffsize ) :: buff
          character( buffsize ) :: head
          character( buffsize ) :: msg
  
          rcode = fstr_ctrl_seek_header( ctrl, '!VISUAL ' )
          if( rcode == 0 ) return
  
          start_n = fstr_ctrl_get_c_h_pos( ctrl )
          end_n = fstr_ctrl_get_rec_number( ctrl )
  
          open ( IFVS, file = trim(vis_filename), status = 'replace', err = 1000)
          do i=start_n, end_n
                  rcode = fstr_ctrl_get_line( ctrl, i, buff, buffsize )
                  if( rcode /= 0 ) exit
                  read( buff, *) head
                  if( head == '!END') exit
                  write( IFVS, '(a)') buff
          end do
          close( IFVS );
  
          return
  
  1000    write(msg,*) 'Error: cannot create file:"', trim(vis_filename), '" for visualization'
          call fstr_setup_util_err_stop(msg)
  end subroutine fstr_setup_visualize
  
  !******************************************************************************
  
negative.code: !------------------------------------------------------------------------------
  
  subroutine fstr_ctrl_err_stop
    implicit none
    character(len=256) :: msg
  
    call fstr_ctrl_get_err_msg( msg, 256 )
    write(*,*) msg
    write(imsg,*) msg
    call hecmw_abort( hecmw_comm_get_comm())
  end subroutine fstr_ctrl_err_stop
  
  !------------------------------------------------------------------------------
  
  subroutine fstr_setup_util_err_stop( msg )
    implicit none
    character(*) :: msg
  
    write(*,*) msg
    write(imsg,*) msg
    call hecmw_abort( hecmw_comm_get_comm())
  end subroutine fstr_setup_util_err_stop
  
  !------------------------------------------------------------------------------
  
  ! grp_type_name : 'node_grp', 'elem_grp' or 'surf_grp'
  
  subroutine set_group_pointers( hecMESH, grp_type_name )
    type (hecmwST_local_mesh),target :: hecMESH
    character(len=*) :: grp_type_name
  
    if( grp_type_name == 'node_grp' ) then
      grp_type = 1
      n_grp      => hecMESH%node_group%n_grp
      grp_name%s => hecMESH%node_group%grp_name
      grp_index  => hecMESH%node_group%grp_index
      grp_item   => hecMESH%node_group%grp_item
    else if( grp_type_name == 'elem_grp' ) then
      grp_type = 2
      n_grp      => hecMESH%elem_group%n_grp
      grp_name%s => hecMESH%elem_group%grp_name
      grp_index  => hecMESH%elem_group%grp_index
      grp_item   => hecMESH%elem_group%grp_item
    else if( grp_type_name == 'surf_grp' ) then
      grp_type = 3
      n_grp      => hecMESH%surf_group%n_grp
      grp_name%s => hecMESH%surf_group%grp_name
      grp_index  => hecMESH%surf_group%grp_index
      grp_item   => hecMESH%surf_group%grp_item
    else
      STOP 'assert in set_group_pointers'
    end if
  end subroutine set_group_pointers
  
  subroutine backset_group_pointers( hecMESH, grp_type_name )
    type (hecmwST_local_mesh),target :: hecMESH
    character(len=*) :: grp_type_name
  
    if( grp_type_name == 'node_grp' ) then
      grp_type = 1
      hecMESH%node_group%grp_name => grp_name%s
      hecMESH%node_group%grp_index => grp_index
      hecMESH%node_group%grp_item => grp_item
    else if( grp_type_name == 'elem_grp' ) then
      grp_type = 2
      hecMESH%elem_group%grp_name => grp_name%s
      hecMESH%elem_group%grp_index => grp_index
      hecMESH%elem_group%grp_item => grp_item
    else if( grp_type_name == 'surf_grp' ) then
      grp_type = 3
      hecMESH%surf_group%grp_name => grp_name%s
      hecMESH%surf_group%grp_index => grp_index
      hecMESH%surf_group%grp_item => grp_item
    else
      STOP 'assert in set_group_pointers'
    end if
  end subroutine backset_group_pointers
  
  function node_global_to_local( hecMESH, list, n )
    implicit none
    type (hecmwST_local_mesh), target :: hecMESH
    integer(kind=kint) :: list(:)
    integer(kind=kint) :: n, i, j
    logical:: fg
    integer(kind=kint):: node_global_to_local
  
    node_global_to_local = 0
    do j=1, n
      fg = .false.
      do i=1, hecMESH%n_node
        if( hecMESH%global_node_ID(i) == list(j)) then
          list(j) = i
          fg = .true.
          node_global_to_local = node_global_to_local +1
          exit
        endif
      end do
      if( .not. fg ) then
        list(j) = -list(j) ! not exist node
      endif
    end do
  end function node_global_to_local
  
  function elem_global_to_local( hecMESH, list, n )
    implicit none
    type (hecmwST_local_mesh), target :: hecMESH
    integer(kind=kint), pointer :: list(:)
    integer(kind=kint) :: n, i, j
    logical :: fg
    integer(kind=kint) :: elem_global_to_local
  
    elem_global_to_local = 0
    do j=1, n
      fg = .false.
      do i=1, hecMESH%n_elem
        if( hecMESH%global_elem_ID(i) == list(j)) then
          list(j) = i
          fg = .true.
          elem_global_to_local = elem_global_to_local+1
          exit
        endif
      end do
      if( .not. fg ) then
        list(j) = -list(j)
      endif
    end do
  end function elem_global_to_local
  
  function append_single_group( hecMESH, grp_type_name, no_count, no_list )
    implicit none
    type (hecmwST_local_mesh), target :: hecMESH
    character(len=*) :: grp_type_name
    integer(kind=kint) :: no_count
    integer(kind=kint),pointer :: no_list(:)
    integer(kind=kint):: append_single_group
    integer(kind=kint) :: old_grp_number, new_grp_number
    integer(kind=kint) :: old_item_number, new_item_number
    integer(kind=kint) :: i,j,k, exist_n
    integer(kind=kint), save :: grp_count = 1
    character(50) :: grp_name_s
  
    call set_group_pointers( hecMESH, grp_type_name )
    if( grp_type_name == 'node_grp') then
      exist_n = node_global_to_local( hecMESH, no_list, no_count )
    else if( grp_type_name == 'elem_grp') then
      exist_n = elem_global_to_local( hecMESH, no_list, no_count )
    endif
  
    old_grp_number = n_grp
    new_grp_number = old_grp_number + no_count
  
    old_item_number = grp_index(n_grp)
    new_item_number = old_item_number + exist_n
  
    call fstr_expand_name_array( grp_name, old_grp_number, new_grp_number )
    call fstr_expand_index_array( grp_index, old_grp_number + 1, new_grp_number+1)
    call fstr_expand_integer_array( grp_item, old_item_number, new_item_number )
  
    n_grp = new_grp_number
  
    j = old_grp_number + 1
    k = old_item_number + 1
    do i = 1, no_count
      write( grp_name_s, '(a,i0,a,i0)') 'FSTR_', grp_count, '_', i
      grp_name%s(j) = grp_name_s
      if( no_list(i) >= 0) then
        grp_item(k) = no_list(i)
        grp_index(j) = grp_index(j-1)+1
        k = k + 1
      else
        grp_index(j) = grp_index(j-1)
      endif
      j = j + 1
    end do
    grp_count = grp_count + 1
    call backset_group_pointers( hecMESH, grp_type_name )
    append_single_group = exist_n
  end function append_single_group
  
  !------------------------------------------------------------------------------
  