Make the grid's lines (circles in 1 degree steps, meridians in 0.5 degree steps), in place of the old.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(LatLonGrid), | intent(inout) | :: | self |
subroutine make_grid(self) type(LatLonGrid), intent(inout) :: self integer, parameter :: n_around = 360, n_meridian = 360 ! 1 and 0.5 degree steps real(wp), allocatable :: grid(:,:), main(:,:) real(wp) :: circle(3, n_around), meridian(3, n_meridian + 1), lat, lon type(c_ptr) :: group integer :: i, k, sgn if (.not. c_associated(self%nodes%contents)) return allocate(grid(3, 0), main(3, 0)) if (self%lat_spacing > 0.0_wp) then ! the equator, then pairs north and south k = 0 do while (k * self%lat_spacing < 0.5_wp * pi - 1.0e-6_wp) do sgn = 1, merge(1, 2, k == 0) lat = merge(1.0_wp, -1.0_wp, sgn == 1) * k * self%lat_spacing do i = 1, n_around circle(:, i) = surface_point(self%radii_, lat, 2.0_wp * pi * (i - 1) / n_around) end do if (k == 0) then call append(main, closed_segments(circle)) else call append(grid, closed_segments(circle)) end if end do k = k + 1 end do end if if (self%lon_spacing > 0.0_wp) then ! the prime meridian, then the others k = 0 do while (k * self%lon_spacing < 2.0_wp * pi - 1.0e-6_wp) lon = k * self%lon_spacing do i = 1, n_meridian + 1 meridian(:, i) = surface_point(self%radii_, -0.5_wp * pi + pi * (i - 1) / n_meridian, lon) end do if (k == 0) then call append(main, open_segments(meridian)) else call append(grid, open_segments(meridian)) end if k = k + 1 end do end if group = vkf_switch_create() call add(group, line_node(grid, self%color(), self%width_, .true.)) call add(group, line_node(main, self%color(), self%main_width, .true.)) call self%nodes%replace(group) end subroutine make_grid