resolve_box_filter_args Subroutine

public subroutine resolve_box_filter_args(box_min, box_max, require_elem_inside, use_box_filter, box_min_local, box_max_local, box_tol, require_inside_elem)

box filter 関連の optional 引数を検証付きで展開する。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in), optional :: box_min(3)
real(kind=dp), intent(in), optional :: box_max(3)
logical, intent(in), optional :: require_elem_inside
logical, intent(out) :: use_box_filter
real(kind=dp), intent(out) :: box_min_local(3)
real(kind=dp), intent(out) :: box_max_local(3)
real(kind=dp), intent(out) :: box_tol
logical, intent(out) :: require_inside_elem

Called by

proc~~resolve_box_filter_args~~CalledByGraph proc~resolve_box_filter_args resolve_box_filter_args proc~find_first_hit_base find_first_hit_base proc~find_first_hit_base->proc~resolve_box_filter_args proc~find_first_hit_periodic2 find_first_hit_periodic2 proc~find_first_hit_periodic2->proc~resolve_box_filter_args proc~find_first_hit_periodic2->proc~find_first_hit_base proc~find_first_hit find_first_hit proc~find_first_hit->proc~find_first_hit_base proc~find_first_hit->proc~find_first_hit_periodic2 proc~sample_photo_raycast_particles sample_photo_raycast_particles proc~sample_photo_raycast_particles->proc~find_first_hit proc~sample_photo_species_state sample_photo_species_state proc~sample_photo_species_state->proc~sample_photo_raycast_particles proc~init_particle_batch_from_config init_particle_batch_from_config proc~init_particle_batch_from_config->proc~sample_photo_species_state

Source Code

  subroutine resolve_box_filter_args( &
    box_min, box_max, require_elem_inside, use_box_filter, box_min_local, box_max_local, box_tol, require_inside_elem &
    )
    real(dp), intent(in), optional :: box_min(3), box_max(3)
    logical, intent(in), optional :: require_elem_inside
    logical, intent(out) :: use_box_filter, require_inside_elem
    real(dp), intent(out) :: box_min_local(3), box_max_local(3), box_tol

    use_box_filter = present(box_min) .or. present(box_max)
    if (use_box_filter .and. .not. (present(box_min) .and. present(box_max))) then
      error stop 'find_first_hit requires both box_min and box_max when using box filter.'
    end if
    if (use_box_filter) then
      box_min_local = box_min
      box_max_local = box_max
      box_tol = 1.0d-12*max(1.0d0, maxval(abs(box_max_local - box_min_local)))
    else
      box_min_local = 0.0d0
      box_max_local = 0.0d0
      box_tol = 0.0d0
    end if

    require_inside_elem = .false.
    if (present(require_elem_inside)) require_inside_elem = require_elem_inside
    if (require_inside_elem .and. .not. use_box_filter) then
      error stop 'find_first_hit require_elem_inside=true needs box_min/box_max.'
    end if
  end subroutine resolve_box_filter_args