Skip to content

Commit 43e526f

Browse files
committed
many little changes
generation of png is still intermittent, but good enough to proceed with making documentation.
1 parent a78db2a commit 43e526f

File tree

11 files changed

+220
-204
lines changed

11 files changed

+220
-204
lines changed

defaults/pggrid.defaults

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
file_flag = .FALSE.
22
file_dir = '.'
3-
file_prefix = 'grid'
3+
file_prefix = 'test_grid'
44
file_device = 'png'
55
file_extension = 'png'
6-
file_width = 12.0
6+
file_width = -1.0
77
win_width = 12.0
8-
file_aspect_ratio = 2.0/3.0
9-
win_aspect_ratio = 2.0/3.0
10-
max_fraction_padding = 1.0/3.0
11-
grid_num_cols = 3
12-
grid_num_rows = 2
13-
grid_num_plots = 4
8+
file_aspect_ratio = -1.0
9+
win_aspect_ratio = 1.0
10+
max_fraction_padding = 1.0
11+
grid_num_cols = 1
12+
grid_num_rows = 1
13+
grid_num_plots = 1
1414
grid_plot_names(:) = ''
15-
grid_plot_col(:) = 0
15+
grid_plot_col(:) = 0
1616
grid_plot_colspan(:) = 0
1717
grid_plot_row(:) = 0
1818
grid_plot_rowspan(:) = 0
@@ -24,9 +24,9 @@
2424
grid_bottom_margin = 0.02
2525
grid_subplot_text_scale = 0.85
2626
simplt_left_margin = 0.02
27-
simplt_right_margin = 0.02
27+
simplt_right_margin = 0.0
2828
simplt_top_margin = 0.02
29-
simplt_bottom_margin = 0.02
29+
simplt_bottom_margin = 0.02
3030
simplt_pad_left_in_em = 4.0
3131
simplt_pad_right_in_em = 0.0
3232
simplt_pad_top_in_em = 4.0
@@ -51,4 +51,3 @@
5151
lgdplt_legend_lineskip_in_em = 1.2
5252
lgdplt_legend_line_length_in_em = 2.0
5353
lgdplt_show_margin_box = .FALSE.
54-

private/pg_io.f

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ module pg_io
6060

6161
contains
6262

63-
subroutine read_pggrid_controls(p,filename,ierr)
63+
subroutine read_pggrid_controls(filename,ierr)
6464
use utils_lib
65-
type(pg_data), pointer :: p
6665
character(len=*), intent(in) :: filename
6766
integer, intent(out) :: ierr
6867
integer :: iounit
@@ -88,7 +87,7 @@ subroutine read_pggrid_controls(p,filename,ierr)
8887
end if
8988
close(iounit)
9089
call free_iounit(iounit)
91-
call store_pggrid_controls(p)
90+
call store_pggrid_controls
9291

9392
contains
9493
function failure(doing_what)
@@ -104,65 +103,67 @@ function failure(doing_what)
104103
end function failure
105104
end subroutine read_pggrid_controls
106105

107-
subroutine store_pggrid_controls(p)
106+
subroutine store_pggrid_controls
108107
type(pg_data), pointer :: p
108+
109+
call get_pg_pointer(p)
109110

110-
p% file_flag = file_flag
111-
p% file_dir = file_dir
112-
p% file_prefix = file_prefix
113-
p% file_device = file_device
114-
p% file_extension = file_extension
115-
p% file_width = file_width
116-
p% win_width = win_width
117-
p% file_aspect_ratio = file_aspect_ratio
118-
p% win_aspect_ratio = win_aspect_ratio
119-
p% max_fraction_padding = max_fraction_padding
120-
p% grid_num_cols = grid_num_cols
121-
p% grid_num_rows = grid_num_rows
122-
p% grid_num_plots = grid_num_plots
123-
p% grid_plot_names = grid_plot_names
124-
p% grid_plot_col = grid_plot_col
125-
p% grid_plot_colspan = grid_plot_colspan
126-
p% grid_plot_row = grid_plot_row
127-
p% grid_plot_rowspan = grid_plot_rowspan
128-
p% grid_col_offset_in_px = grid_col_offset_in_px
129-
p% grid_row_offset_in_px = grid_row_offset_in_px
130-
p% grid_left_margin = grid_left_margin
131-
p% grid_right_margin = grid_right_margin
132-
p% grid_top_margin = grid_top_margin
133-
p% grid_bottom_margin = grid_bottom_margin
134-
p% grid_subplot_text_scale = grid_subplot_text_scale
135-
p% simplt_left_margin = simplt_left_margin
136-
p% simplt_right_margin = simplt_right_margin
137-
p% simplt_top_margin = simplt_top_margin
138-
p% simplt_bottom_margin = simplt_bottom_margin
139-
p% simplt_pad_left_in_em = simplt_pad_left_in_em
140-
p% simplt_pad_right_in_em = simplt_pad_right_in_em
141-
p% simplt_pad_top_in_em = simplt_pad_top_in_em
142-
p% simplt_pad_bottom_in_em = simplt_pad_bottom_in_em
143-
p% simplt_char_size_in_px = simplt_char_size_in_px
144-
p% simplt_show_margin_box = simplt_show_margin_box
145-
p% lgdplt_left_margin = lgdplt_left_margin
146-
p% lgdplt_right_margin = lgdplt_right_margin
147-
p% lgdplt_top_margin = lgdplt_top_margin
148-
p% lgdplt_bottom_margin = lgdplt_bottom_margin
149-
p% lgdplt_pad_left_in_em = lgdplt_pad_left_in_em
150-
p% lgdplt_pad_right_in_em = lgdplt_pad_right_in_em
151-
p% lgdplt_pad_top_in_em = lgdplt_pad_top_in_em
152-
p% lgdplt_pad_bottom_in_em = lgdplt_pad_bottom_in_em
153-
p% lgdplt_char_size_in_px = lgdplt_char_size_in_px
154-
p% lgdplt_plot_right_edge = lgdplt_plot_right_edge
155-
p% lgdplt_legend_left_edge = lgdplt_legend_left_edge
156-
p% lgdplt_legend_txt_scale = lgdplt_legend_txt_scale
157-
p% lgdplt_legend_top_edge = lgdplt_legend_top_edge
158-
p% lgdplt_legend_left_margin_in_em = &
159-
& lgdplt_legend_left_margin_in_em
160-
p% lgdplt_legend_top_margin_in_em = &
161-
& lgdplt_legend_top_margin_in_em
162-
p% lgdplt_legend_lineskip_in_em = lgdplt_legend_lineskip_in_em
163-
p% lgdplt_legend_line_length_in_em = &
164-
& lgdplt_legend_line_length_in_em
165-
p% lgdplt_show_margin_box = lgdplt_show_margin_box
111+
p% file_flag = file_flag
112+
p% file_dir = file_dir
113+
p% file_prefix = file_prefix
114+
p% file_device = file_device
115+
p% file_extension = file_extension
116+
p% file_width = file_width
117+
p% win_width = win_width
118+
p% file_aspect_ratio = file_aspect_ratio
119+
p% win_aspect_ratio = win_aspect_ratio
120+
p% max_fraction_padding = max_fraction_padding
121+
p% grid_num_cols = grid_num_cols
122+
p% grid_num_rows = grid_num_rows
123+
p% grid_num_plots = grid_num_plots
124+
p% grid_plot_names = grid_plot_names
125+
p% grid_plot_col = grid_plot_col
126+
p% grid_plot_colspan = grid_plot_colspan
127+
p% grid_plot_row = grid_plot_row
128+
p% grid_plot_rowspan = grid_plot_rowspan
129+
p% grid_col_offset_in_px = grid_col_offset_in_px
130+
p% grid_row_offset_in_px = grid_row_offset_in_px
131+
p% grid_left_margin = grid_left_margin
132+
p% grid_right_margin = grid_right_margin
133+
p% grid_top_margin = grid_top_margin
134+
p% grid_bottom_margin = grid_bottom_margin
135+
p% grid_subplot_text_scale = grid_subplot_text_scale
136+
p% simplt_left_margin = simplt_left_margin
137+
p% simplt_right_margin = simplt_right_margin
138+
p% simplt_top_margin = simplt_top_margin
139+
p% simplt_bottom_margin = simplt_bottom_margin
140+
p% simplt_pad_left_in_em = simplt_pad_left_in_em
141+
p% simplt_pad_right_in_em = simplt_pad_right_in_em
142+
p% simplt_pad_top_in_em = simplt_pad_top_in_em
143+
p% simplt_pad_bottom_in_em = simplt_pad_bottom_in_em
144+
p% simplt_char_size_in_px = simplt_char_size_in_px
145+
p% simplt_show_margin_box = simplt_show_margin_box
146+
p% lgdplt_left_margin = lgdplt_left_margin
147+
p% lgdplt_right_margin = lgdplt_right_margin
148+
p% lgdplt_top_margin = lgdplt_top_margin
149+
p% lgdplt_bottom_margin = lgdplt_bottom_margin
150+
p% lgdplt_pad_left_in_em = lgdplt_pad_left_in_em
151+
p% lgdplt_pad_right_in_em = lgdplt_pad_right_in_em
152+
p% lgdplt_pad_top_in_em = lgdplt_pad_top_in_em
153+
p% lgdplt_pad_bottom_in_em = lgdplt_pad_bottom_in_em
154+
p% lgdplt_char_size_in_px = lgdplt_char_size_in_px
155+
p% lgdplt_plot_right_edge = lgdplt_plot_right_edge
156+
p% lgdplt_legend_left_edge = lgdplt_legend_left_edge
157+
p% lgdplt_legend_txt_scale = lgdplt_legend_txt_scale
158+
p% lgdplt_legend_top_edge = lgdplt_legend_top_edge
159+
p% lgdplt_legend_left_margin_in_em = &
160+
& lgdplt_legend_left_margin_in_em
161+
p% lgdplt_legend_top_margin_in_em = &
162+
& lgdplt_legend_top_margin_in_em
163+
p% lgdplt_legend_lineskip_in_em = lgdplt_legend_lineskip_in_em
164+
p% lgdplt_legend_line_length_in_em = &
165+
& lgdplt_legend_line_length_in_em
166+
p% lgdplt_show_margin_box = lgdplt_show_margin_box
166167

167168
end subroutine store_pggrid_controls
168169

private/pg_support.f

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,20 @@ subroutine do_open(p, ierr)
3333
have_initialized_pg = .TRUE.
3434
contains
3535
function failed(str)
36-
use, intrinsic:: iso_fortran_env, only: error_unit
37-
character (len=*), intent(in) :: str
38-
logical :: failed
36+
! use, intrinsic:: iso_fortran_env, only: error_unit
37+
character (len=*), intent(in) :: str
38+
logical :: failed
3939

40-
failed = (ierr /= 0)
41-
if (failed) then
42-
write(*, *) 'failure opening device '//trim(str) // ': ierr = ', &
43-
& ierr
44-
end if
40+
failed = (ierr /= 0)
41+
if (failed) then
42+
write(*, *) 'failure opening device '//trim(str)//': ierr = ', &
43+
& ierr
44+
end if
4545
end function failed
4646

4747
end subroutine do_open
4848

4949
subroutine create_file_name(dir, prefix, extension, name)
50-
use, intrinsic :: iso_fortran_env, only : error_unit
5150
character(len=*), intent(in) :: dir, prefix, extension
5251
character(len=*), intent(out) :: name
5352

@@ -60,7 +59,7 @@ subroutine create_file_name(dir, prefix, extension, name)
6059
end subroutine create_file_name
6160

6261
subroutine open_device(p,dev,ierr)
63-
use, intrinsic :: iso_fortran_env, only : error_unit
62+
! use, intrinsic :: iso_fortran_env, only : error_unit
6463
type(pg_data), pointer :: p
6564
character(len=*), intent(in) :: dev
6665
integer, intent(out) :: ierr
@@ -70,7 +69,7 @@ subroutine open_device(p,dev,ierr)
7069
ierr = 0
7170
p% device_id = pgopen(trim(dev))
7271
if (p% device_id <= 0) then
73-
write(error_unit,*) 'PGPLOT failed to open '//trim(dev)
72+
write(*,*) 'PGPLOT failed to open '//trim(dev)
7473
ierr = -1
7574
return
7675
end if

public/pggrid_lib.f

Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ subroutine load_pggrid_controls(filename,ierr)
77
use pg_io, only: read_pggrid_controls
88
character(len=*), intent(in) :: filename
99
integer, intent(out) :: ierr
10-
type(pg_data), pointer :: p
1110

12-
call get_pg_pointer(p)
13-
call read_pggrid_controls(p,filename,ierr)
11+
call read_pggrid_controls(filename,ierr)
1412
end subroutine load_pggrid_controls
1513

1614
subroutine make_pggrid_plot(which_plot,ierr)
@@ -27,24 +25,9 @@ subroutine make_pggrid_plot(which_plot,ierr)
2725

2826
call do_open(p, ierr)
2927
if (ierr /= 0) return
30-
31-
! if (xright < xleft .or. ytop < ybottom) then
32-
! write (error_unit,*) 'malformed plt: left, right, top, bottom = ', &
33-
! & xleft, xright, ytop, ybottom
34-
! ierr = -1
35-
! return
36-
! end if
3728

38-
! if (1.0-(xright-xleft) > p% max_fraction_padding .or. &
39-
! & 1.0-(ytop-ybottom) > p% max_fraction_padding) then
40-
! write (error_unit,*) 'warning: padding around grid exceeds ', &
41-
! & p% max_fraction_padding
42-
! write (error_unit,*) ' left, right, top, bottom = ', &
43-
! & xleft, xright, ytop, ybottom
44-
! ! keep as a warning
45-
! ierr = 0
46-
! end if
47-
29+
call print_pggrid_controls(p)
30+
4831
select case(which_plot)
4932
case('Grid_Plot')
5033
call do_grid(p,0.0,1.0,1.0,0.0,1.0)
@@ -64,4 +47,65 @@ subroutine make_pggrid_plot(which_plot,ierr)
6447
call pgclos()
6548

6649
end subroutine make_pggrid_plot
50+
51+
subroutine print_pggrid_controls(p)
52+
type(pg_data), pointer :: p
53+
54+
print *,'file_flag = ', p% file_flag
55+
print *,'file_dir = ', trim(p% file_dir)
56+
print *,'file_prefix = ', trim(p% file_prefix)
57+
print *,'file_device = ', trim(p% file_device)
58+
print *,'file_extension = ', trim(p% file_extension)
59+
print *,'file_width = ', p% file_width
60+
print *,'win_width = ', p% win_width
61+
print *,'file_aspect_ratio = ', p% file_aspect_ratio
62+
print *,'win_aspect_ratio = ', p% win_aspect_ratio
63+
print *,'max_fraction_padding = ', p% max_fraction_padding
64+
print *,'grid_num_cols = ', p% grid_num_cols
65+
print *,'grid_num_rows = ', p% grid_num_rows
66+
print *,'grid_num_plots = ', p% grid_num_plots
67+
print *,'grid_plot_names = ', p% grid_plot_names
68+
print *,'grid_plot_col = ', p% grid_plot_col
69+
print *,'grid_plot_colspan = ', p% grid_plot_colspan
70+
print *,'grid_plot_row = ', p% grid_plot_row
71+
print *,'grid_plot_rowspan = ', p% grid_plot_rowspan
72+
print *,'grid_col_offset_in_px = ', p% grid_col_offset_in_px
73+
print *,'grid_row_offset_in_px = ', p% grid_row_offset_in_px
74+
print *,'grid_left_margin = ', p% grid_left_margin
75+
print *,'grid_right_margin = ', p% grid_right_margin
76+
print *,'grid_top_margin = ', p% grid_top_margin
77+
print *,'grid_bottom_margin = ', p% grid_bottom_margin
78+
print *,'grid_subplot_text_scale = ', p% grid_subplot_text_scale
79+
print *,'simplt_left_margin = ', p% simplt_left_margin
80+
print *,'simplt_right_margin = ', p% simplt_right_margin
81+
print *,'simplt_top_margin = ', p% simplt_top_margin
82+
print *,'simplt_bottom_margin = ', p% simplt_bottom_margin
83+
print *,'simplt_pad_left_in_em = ', p% simplt_pad_left_in_em
84+
print *,'simplt_pad_right_in_em = ', p% simplt_pad_right_in_em
85+
print *,'simplt_pad_top_in_em = ', p% simplt_pad_top_in_em
86+
print *,'simplt_pad_bottom_in_em = ', p% simplt_pad_bottom_in_em
87+
print *,'simplt_char_size_in_px = ', p% simplt_char_size_in_px
88+
print *,'simplt_show_margin_box = ', p% simplt_show_margin_box
89+
print *,'lgdplt_left_margin = ', p% lgdplt_left_margin
90+
print *,'lgdplt_right_margin = ', p% lgdplt_right_margin
91+
print *,'lgdplt_top_margin = ', p% lgdplt_top_margin
92+
print *,'lgdplt_bottom_margin = ', p% lgdplt_bottom_margin
93+
print *,'lgdplt_pad_left_in_em = ', p% lgdplt_pad_left_in_em
94+
print *,'lgdplt_pad_right_in_em = ', p% lgdplt_pad_right_in_em
95+
print *,'lgdplt_pad_top_in_em = ', p% lgdplt_pad_top_in_em
96+
print *,'lgdplt_pad_bottom_in_em = ', p% lgdplt_pad_bottom_in_em
97+
print *,'lgdplt_char_size_in_px = ', p% lgdplt_char_size_in_px
98+
print *,'lgdplt_plot_right_edge = ', p% lgdplt_plot_right_edge
99+
print *,'lgdplt_legend_left_edge = ', p% lgdplt_legend_left_edge
100+
print *,'lgdplt_legend_txt_scale = ', p% lgdplt_legend_txt_scale
101+
print *,'lgdplt_legend_top_edge = ', p% lgdplt_legend_top_edge
102+
print *,'lgdplt_legend_left_margin_in_em = ', p% lgdplt_legend_left_margin_in_em
103+
print *,'lgdplt_legend_top_margin_in_em = ', p% lgdplt_legend_top_margin_in_em
104+
print *,'lgdplt_legend_lineskip_in_em = ', p% lgdplt_legend_lineskip_in_em
105+
print *,'lgdplt_legend_line_length_in_em = ', p% lgdplt_legend_line_length_in_em
106+
print *,'lgdplt_show_margin_box = ', p% lgdplt_show_margin_box
107+
print *,'device_id = ', p% device_id
108+
print *,'is_file = ', p% is_file
109+
end subroutine print_pggrid_controls
110+
67111
end module pggrid_lib

test/grid0.inlist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
&pggrid
2-
file_flag = .FALSE.
2+
file_flag = .TRUE.
33
file_dir = '.'
44
file_prefix = 'grid0'
55
file_device = 'png'

test/grid1.inlist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
&pggrid
2-
file_flag = .FALSE.
2+
file_flag = .TRUE.
33
file_dir = '.'
44
file_prefix = 'grid1'
55
file_device = 'png'

test/grid2.inlist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
&pggrid
2-
file_flag = .FALSE.
2+
file_flag = .TRUE.
33
file_dir = '.'
44
file_prefix = 'grid2'
55
file_device = 'png'

0 commit comments

Comments
 (0)