From 9f3590cd39e018b7412cc60ea37d057e414e4982 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Sun, 20 Dec 2015 18:40:07 -0500 Subject: [PATCH] Make cell % material an allocatable array --- src/geometry.F90 | 2 +- src/geometry_header.F90 | 14 ++++++++------ src/initialize.F90 | 6 +++--- src/input_xml.F90 | 13 +++++++------ src/plot.F90 | 6 +++--- src/summary.F90 | 4 ++-- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/geometry.F90 b/src/geometry.F90 index 9a084a77cb..19289f9a45 100644 --- a/src/geometry.F90 +++ b/src/geometry.F90 @@ -248,7 +248,7 @@ contains ! set material p % last_material = p % material - p % material = c % material + p % material = c % material(1) elseif (c % type == CELL_FILL) then CELL_TYPE ! ====================================================================== diff --git a/src/geometry_header.F90 b/src/geometry_header.F90 index 6ca13740ba..30d4a119b6 100644 --- a/src/geometry_header.F90 +++ b/src/geometry_header.F90 @@ -126,15 +126,17 @@ module geometry_header integer :: fill ! universe # filling this cell integer :: instances ! number of instances of this cell in ! the geom - integer :: material ! Material within cell (0 for - ! universe) - integer, allocatable :: offset (:) ! Distribcell offset for tally + integer, allocatable :: material(:) ! Material within cell. Multiple + ! materials for distribcell + ! instances. 0 signifies a universe + integer, allocatable :: offset(:) ! Distribcell offset for tally ! counter integer, allocatable :: region(:) ! Definition of spatial region as - ! Boolean expression of half-spaces + ! Boolean expression of half-spaces integer, allocatable :: rpn(:) ! Reverse Polish notation for region - ! expression - logical :: simple ! Is the region simple (intersections only) + ! expression + logical :: simple ! Is the region simple (intersections + ! only) ! Rotation matrix and translation vector real(8), allocatable :: translation(:) diff --git a/src/initialize.F90 b/src/initialize.F90 index 9d63eb4e93..802f890aa9 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -614,13 +614,13 @@ contains ! ======================================================================= ! ADJUST MATERIAL/FILL POINTERS FOR EACH CELL - id = c%material + id = c%material(1) if (id == MATERIAL_VOID) then c%type = CELL_NORMAL elseif (id /= 0) then if (material_dict%has_key(id)) then c%type = CELL_NORMAL - c%material = material_dict%get_key(id) + c%material(1) = material_dict%get_key(id) else call fatal_error("Could not find material " // trim(to_str(id)) & &// " specified on cell " // trim(to_str(c%id))) @@ -1137,7 +1137,7 @@ contains ! Allocate offset table for fill cells do i = 1, n_cells - if (cells(i)%material == NONE) then + if (cells(i) % type /= CELL_NORMAL) then allocate(cells(i)%offset(n_maps)) end if end do diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 5449b169dd..016b811ac4 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1085,36 +1085,37 @@ contains end if ! Read material + allocate(c % material(1)) word = '' if (check_for_node(node_cell, "material")) & call get_node_value(node_cell, "material", word) select case(to_lower(word)) case ('void') - c % material = MATERIAL_VOID + c % material(1) = MATERIAL_VOID case ('') ! This case is called if no material was specified - c % material = NONE + c % material(1) = NONE case default - c % material = int(str_to_int(word), 4) + c % material(1) = int(str_to_int(word), 4) ! Check for error - if (c % material == ERROR_INT) then + if (c % material(1) == ERROR_INT) then call fatal_error("Invalid material specified on cell " & &// to_str(c % id)) end if end select ! Check to make sure that either material or fill was specified - if (c % material == NONE .and. c % fill == NONE) then + if (c % material(1) == NONE .and. c % fill == NONE) then call fatal_error("Neither material nor fill was specified for cell " & &// trim(to_str(c % id))) end if ! Check to make sure that both material and fill haven't been ! specified simultaneously - if (c % material /= NONE .and. c % fill /= NONE) then + if (c % material(1) /= NONE .and. c % fill /= NONE) then call fatal_error("Cannot specify material and fill simultaneously") end if diff --git a/src/plot.F90 b/src/plot.F90 index a5497bc203..99d7e3ae94 100644 --- a/src/plot.F90 +++ b/src/plot.F90 @@ -82,7 +82,7 @@ contains if (pl % color_by == PLOT_COLOR_MATS) then ! Assign color based on material c => cells(p % coord(j) % cell) - if (c % material == MATERIAL_VOID) then + if (c % material(1) == MATERIAL_VOID) then ! By default, color void cells white rgb = 255 id = -1 @@ -91,8 +91,8 @@ contains rgb = pl % not_found % rgb id = -1 else - rgb = pl % colors(c % material) % rgb - id = materials(c % material) % id + rgb = pl % colors(c % material(1)) % rgb + id = materials(c % material(1)) % id end if else if (pl % color_by == PLOT_COLOR_CELLS) then ! Assign color based on cell diff --git a/src/summary.F90 b/src/summary.F90 index f2c261ec75..e9c809cf0c 100644 --- a/src/summary.F90 +++ b/src/summary.F90 @@ -150,10 +150,10 @@ contains select case (c%type) case (CELL_NORMAL) call write_dataset(cell_group, "fill_type", "normal") - if (c%material == MATERIAL_VOID) then + if (c%material(1) == MATERIAL_VOID) then call write_dataset(cell_group, "material", -1) else - call write_dataset(cell_group, "material", materials(c%material)%id) + call write_dataset(cell_group, "material", materials(c%material(1))%id) end if case (CELL_FILL)