Skip to content

Commit

Permalink
Fix axis min/max set in Tao. (#1290)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSagan authored Nov 14, 2024
1 parent 62d2f25 commit 5dde5a4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bmad/output/type_ele.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1424,8 +1424,8 @@ subroutine type_ele (ele, type_zero_attrib, type_mat6, type_taylor, twiss_out, t
srz => ele%wake%sr%z_long
nl=nl+1; li(nl) = ' smoothing_sigma = ' // to_str(srz%smoothing_sigma)
nl=nl+1; li(nl) = ' position_dependence = ' // trim(sr_transverse_position_dep_name(srz%position_dependence))
nl=nl+1; li(nl) = ' dz = ' // to_str(srz%dz)
nl=nl+1; li(nl) = ' +/- Wake range: ' // to_str(srz%z0)
nl=nl+1; li(nl) = ' dz [m] = ' // to_str(srz%dz)
nl=nl+1; li(nl) = ' Wake range [m]: +/-' // to_str(srz%z0)
nl=nl+1; write (li(nl), '(a, i0)') ' # wake points: ', size(srz%w)

else
Expand Down
27 changes: 20 additions & 7 deletions tao/code/tao_init_plotting.f90
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ function old_style_title_syntax(iu) result (is_old_style)
plt%autoscale_x = plot%autoscale_x
plt%autoscale_y = plot%autoscale_y

call transfer_this_axis(plot%x, default_graph%x) ! Remember: plot%x is deprecated.
call transfer_plot_axis(plot%x, default_graph%x) ! Remember: plot%x is deprecated.

if (default_graph%x%major_div < 0 .and. default_graph%x%major_div_nominal < 0) default_graph%x%major_div_nominal = 7

Expand Down Expand Up @@ -511,10 +511,6 @@ function old_style_title_syntax(iu) result (is_old_style)
grph%title = graph%title
grph%margin = graph%margin
grph%scale_margin = graph%scale_margin
grph%x = graph%x
grph%y = graph%y
grph%x2 = graph%x2
grph%y2 = graph%y2
grph%ix_universe = graph%ix_universe
grph%ix_branch = graph%ix_branch
grph%clip = graph%clip
Expand All @@ -528,6 +524,10 @@ function old_style_title_syntax(iu) result (is_old_style)
grph%title_suffix = ''
grph%text_legend = ''
grph%y2_mirrors_y = .true.
call transfer_this_axis (grph%x, graph%x)
call transfer_this_axis (grph%y, graph%y)
call transfer_this_axis (grph%x2, graph%x2)
call transfer_this_axis (grph%y2, graph%y2)

if (grph%x%major_div < 0 .and. grph%x%major_div_nominal < 0) grph%x%major_div_nominal = 7
if (grph%y%major_div < 0 .and. grph%y%major_div_nominal < 0) grph%y%major_div_nominal = 4
Expand Down Expand Up @@ -836,6 +836,19 @@ function old_style_title_syntax(iu) result (is_old_style)
!----------------------------------------------------------------------------------------
contains

subroutine transfer_this_axis (axis_out, axis_in)

type (qp_axis_struct) axis_out, axis_in

axis_out = axis_in
axis_out%eval_min = axis_out%min
axis_out%eval_max = axis_out%max

end subroutine transfer_this_axis

!----------------------------------------------------------------------------------------
! contains

subroutine tao_transfer_shape (shape_input, shape_array, namelist_name)

type (tao_ele_shape_input), target :: shape_input(:)
Expand Down Expand Up @@ -3062,7 +3075,7 @@ end subroutine default_plot_init
!----------------------------------------------------------------------------------------
! contains

subroutine transfer_this_axis (ax_in, ax_out)
subroutine transfer_plot_axis (ax_in, ax_out)

type (qp_axis_struct) ax_in, ax_out

Expand Down Expand Up @@ -3094,7 +3107,7 @@ subroutine transfer_this_axis (ax_in, ax_out)
if (.not. ax_in%draw_label) ax_out%draw_label = ax_in%draw_label
if (.not. ax_in%draw_numbers) ax_out%draw_numbers = ax_in%draw_numbers

end subroutine transfer_this_axis
end subroutine transfer_plot_axis

end subroutine tao_init_plotting

Expand Down
2 changes: 2 additions & 0 deletions tao/code/tao_set_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3685,8 +3685,10 @@ subroutine tao_set_qp_axis_struct (qp_axis_name, component, qp_axis, value, erro

case ('min')
call tao_set_real_value (qp_axis%min, qp_axis_name, value, error, dflt_uni = ix_uni)
qp_axis%eval_min = qp_axis%min
case ('max')
call tao_set_real_value (qp_axis%max, qp_axis_name, value, error, dflt_uni = ix_uni)
qp_axis%eval_max = qp_axis%max
case ('number_offset')
call tao_set_real_value (qp_axis%number_offset, qp_axis_name, value, error, dflt_uni = ix_uni)
case ('label_offset')
Expand Down
2 changes: 1 addition & 1 deletion tao/version/tao_version_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
!-

module tao_version_mod
character(*), parameter :: tao_version_date = "2024/11/12 01:38:51"
character(*), parameter :: tao_version_date = "2024/11/14 05:18:08"
end module

0 comments on commit 5dde5a4

Please sign in to comment.