Added support for setting the color of a meshlines plot overlay

This commit is contained in:
Nick Horelik 2014-08-20 10:46:51 -04:00
parent 2ae8fe4e8a
commit cdcbd277ea
3 changed files with 32 additions and 8 deletions

View file

@ -2990,6 +2990,24 @@ contains
call fatal_error()
end if
! Check for color
if (check_for_node(node_meshlines, "color")) then
! Check and make sure 3 values are specified for RGB
if (get_arraysize_double(node_meshlines, "color") /= 3) then
message = "Bad RGB for meshlines color " &
// "in plot " // trim(to_str(pl % id))
call fatal_error()
end if
call get_node_array(node_meshlines, "color", &
pl % meshlines_color % rgb)
else
pl % meshlines_color % rgb = (/ 0, 0, 0 /)
end if
! Check if the specified tally mesh exists
if (mesh_dict % has_key(pl % meshlines_id)) then
pl % meshlines_id = mesh_dict % get_key(pl % meshlines_id)

View file

@ -191,6 +191,7 @@ contains
logical :: in_mesh
integer :: x, y ! pixel location
integer :: r, g, b ! RGB color for meshlines pixels
integer :: xrange(2), yrange(2) ! range of pixel locations
integer :: i, j ! loop indices
integer :: ijk(3)
@ -207,6 +208,10 @@ contains
m => meshes(pl % meshlines_id)
r = pl % meshlines_color % rgb(1)
g = pl % meshlines_color % rgb(2)
b = pl % meshlines_color % rgb(3)
select case (pl % basis)
case(PLOT_BASIS_XY)
xyz_ll_plot(1) = pl % origin(1) - pl % width(1) / 2.0
@ -251,18 +256,18 @@ contains
! draw black lines
do x = xrange(1), xrange(2)
do plus = 0, pl % meshlines_width
call set_pixel(img, x, yrange(1) + plus, 0, 0, 0)
call set_pixel(img, x, yrange(2) + plus, 0, 0, 0)
call set_pixel(img, x, yrange(1) - plus, 0, 0, 0)
call set_pixel(img, x, yrange(2) - plus, 0, 0, 0)
call set_pixel(img, x, yrange(1) + plus, r, g, b)
call set_pixel(img, x, yrange(2) + plus, r, g, b)
call set_pixel(img, x, yrange(1) - plus, r, g, b)
call set_pixel(img, x, yrange(2) - plus, r, g, b)
end do
end do
do y = yrange(2), yrange(1)
do plus = 0, pl % meshlines_width
call set_pixel(img, xrange(1) + plus, y, 0, 0, 0)
call set_pixel(img, xrange(2) + plus, y, 0, 0, 0)
call set_pixel(img, xrange(1) - plus, y, 0, 0, 0)
call set_pixel(img, xrange(2) - plus, y, 0, 0, 0)
call set_pixel(img, xrange(1) + plus, y, r, g, b)
call set_pixel(img, xrange(2) + plus, y, r, g, b)
call set_pixel(img, xrange(1) - plus, y, r, g, b)
call set_pixel(img, xrange(2) - plus, y, r, g, b)
end do
end do

View file

@ -27,6 +27,7 @@ module plot_header
integer :: pixels(3) ! pixel width/height of plot slice
integer :: meshlines_id = -1 ! id of the mesh to plot lines of
integer :: meshlines_width ! pixel width of meshlines
type(ObjectColor) :: meshlines_color ! Color for meshlines
type(ObjectColor) :: not_found ! color for positions where no cell found
type(ObjectColor), allocatable :: colors(:) ! colors of cells/mats
end type ObjectPlot