6 pure module function surfd_get_size(this, dim) result(x)
7 class(surface_plot_data),
intent(in) :: this
8 integer(int32),
intent(in) :: dim
10 if (
allocated(this%m_x))
then
11 x =
size(this%m_x, dim)
18 pure module function surfd_get_x(this, i, j) result(x)
19 class(surface_plot_data),
intent(in) :: this
20 integer(int32),
intent(in) :: i, j
22 if (
allocated(this%m_x))
then
30 module subroutine surfd_set_x(this, i, j, x)
31 class(surface_plot_data),
intent(inout) :: this
32 integer(int32),
intent(in) :: i, j
33 real(real64),
intent(in) :: x
34 if (
allocated(this%m_x))
then
40 pure module function surfd_get_y(this, i, j) result(x)
41 class(surface_plot_data),
intent(in) :: this
42 integer(int32),
intent(in) :: i, j
44 if (
allocated(this%m_y))
then
52 module subroutine surfd_set_y(this, i, j, x)
53 class(surface_plot_data),
intent(inout) :: this
54 integer(int32),
intent(in) :: i, j
55 real(real64),
intent(in) :: x
56 if (
allocated(this%m_y))
then
62 pure module function surfd_get_z(this, i, j) result(x)
63 class(surface_plot_data),
intent(in) :: this
64 integer(int32),
intent(in) :: i, j
66 if (
allocated(this%m_z))
then
74 module subroutine surfd_set_z(this, i, j, x)
75 class(surface_plot_data),
intent(inout) :: this
76 integer(int32),
intent(in) :: i, j
77 real(real64),
intent(in) :: x
78 if (
allocated(this%m_z))
then
84 pure module function surfd_get_wireframe(this) result(x)
85 class(surface_plot_data),
intent(in) :: this
91 module subroutine surfd_set_wireframe(this, x)
92 class(surface_plot_data),
intent(inout) :: this
93 logical,
intent(in) :: x
98 module function surfd_get_cmd(this) result(x)
100 class(surface_plot_data),
intent(in) :: this
101 character(len = :),
allocatable :: x
104 type(string_builder) :: str
108 call str%initialize()
111 n = len_trim(this%get_name())
113 call str%append(
' "-" title "')
114 call str%append(this%get_name())
117 call str%append(
' "-" notitle')
121 if (this%get_use_wireframe())
then
122 call str%append(
" with lines")
124 call str%append(
" with pm3d")
128 x = char(str%to_string())
132 module function surfd_get_data_cmd(this) result(x)
134 class(surface_plot_data),
intent(in) :: this
135 character(len = :),
allocatable :: x
138 type(string_builder) :: str
139 integer(int32) :: i, j, m, n
140 character :: delimiter, nl
143 call str%initialize()
152 call str%append(to_string(this%get_x(i,j)))
153 call str%append(delimiter)
154 call str%append(to_string(this%get_y(i,j)))
155 call str%append(delimiter)
156 call str%append(to_string(this%get_z(i,j)))
159 if (j /= n)
call str%append(nl)
163 x = char(str%to_string())
167 module subroutine surfd_set_data_1(this, x, y, z, err)
169 class(surface_plot_data),
intent(inout) :: this
170 real(real64),
intent(in),
dimension(:,:) :: x, y, z
171 class(errors),
intent(inout),
optional,
target :: err
174 integer(int32) :: i, j, m, n, flag
175 class(errors),
pointer :: errmgr
176 type(errors),
target :: deferr
181 if (
present(err))
then
188 if (
size(y, 1) /= m .or.
size(y, 2) /= n .or.
size(z, 1) /= m .or.
size(z, 2) /= n)
then
189 call errmgr%report_error(
"surfd_set_data_1", &
190 "The input arrays are not the same size.", &
191 plot_array_size_mismatch_error)
196 if (
allocated(this%m_x))
deallocate(this%m_x)
197 if (
allocated(this%m_y))
deallocate(this%m_y)
198 if (
allocated(this%m_z))
deallocate(this%m_z)
199 allocate(this%m_x(m, n), stat = flag)
200 if (flag == 0)
allocate(this%m_y(m, n), stat = flag)
201 if (flag == 0)
allocate(this%m_z(m, n), stat = flag)
203 call errmgr%report_error(
"surfd_set_data_1", &
204 "Insufficient memory available.", plot_out_of_memory_error)
207 do concurrent(j = 1:n)
209 this%m_x(i, j) = x(i, j)
210 this%m_y(i, j) = y(i, j)
211 this%m_z(i, j) = z(i, j)