From f108e75be42ead7ba2f210826278df2090eef684 Mon Sep 17 00:00:00 2001 From: Nick Horelik Date: Sat, 30 Aug 2014 03:01:47 -0400 Subject: [PATCH] Switched to pointer for plot mesh --- src/input_xml.F90 | 17 +++++++++-------- src/plot.F90 | 4 ++-- src/plot_header.F90 | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 5d9d54a976..8e43ab3973 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -2682,8 +2682,9 @@ contains subroutine read_plots_xml() - integer i, j - integer n_cols, col_id, n_comp, n_masks, n_meshlines + integer :: i, j + integer :: n_cols, col_id, n_comp, n_masks, n_meshlines + integer :: meshid integer, allocatable :: iarray(:) logical :: file_exists ! does plots.xml file exist? character(MAX_LINE_LEN) :: filename ! absolute path to plots.xml @@ -2973,7 +2974,7 @@ contains ! Ensure that there is a mesh id for this meshlines specification if (check_for_node(node_meshlines, "mesh")) then - call get_node_value(node_meshlines, "mesh", pl % meshlines_id) + call get_node_value(node_meshlines, "mesh", meshid) else message = "Must specify a mesh id for meshlines " // & "specification in plot " // trim(to_str(pl % id)) @@ -3009,16 +3010,16 @@ contains 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) - if (meshes(pl % meshlines_id) % type /= LATTICE_RECT) then + if (mesh_dict % has_key(meshid)) then + pl % meshlines_mesh => meshes(mesh_dict % get_key(meshid)) + if (meshes(meshid) % type /= LATTICE_RECT) then message = "Non-rectangular mesh specified in meshlines for" // & " plot " // trim(to_str(pl % id)) call fatal_error() end if else - message = "Could not find tally mesh " // & - trim(to_str(pl % meshlines_id)) // & + message = "Could not find mesh " // & + trim(to_str(meshid)) // & " specified in meshlines for plot " // & trim(to_str(pl % id)) call fatal_error() diff --git a/src/plot.F90 b/src/plot.F90 index 97ead21cb1..f6a41c9513 100644 --- a/src/plot.F90 +++ b/src/plot.F90 @@ -168,7 +168,7 @@ contains end do ! Draw tally mesh boundaries on the image if requested - if (pl % meshlines_id > 0) call draw_mesh_lines(pl, img) + if (associated(pl % meshlines_mesh)) call draw_mesh_lines(pl, img) ! Write out the ppm to a file call output_ppm(pl,img) @@ -206,7 +206,7 @@ contains real(8) :: xyz_ur(3) ! upper right xyz type(StructuredMesh), pointer :: m => null() - m => meshes(pl % meshlines_id) + m => pl % meshlines_mesh r = pl % meshlines_color % rgb(1) g = pl % meshlines_color % rgb(2) diff --git a/src/plot_header.F90 b/src/plot_header.F90 index e66bf9077e..68eb89a11a 100644 --- a/src/plot_header.F90 +++ b/src/plot_header.F90 @@ -1,6 +1,7 @@ module plot_header use constants + use mesh_header, only: StructuredMesh implicit none @@ -25,8 +26,8 @@ module plot_header real(8) :: width(3) ! xyz widths of plot integer :: basis ! direction of plot slice 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(StructuredMesh), pointer :: meshlines_mesh => null() ! mesh to plot 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