mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Make cell % material an allocatable array
This commit is contained in:
parent
eb15337309
commit
9f3590cd39
6 changed files with 24 additions and 21 deletions
|
|
@ -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
|
||||
! ======================================================================
|
||||
|
|
|
|||
|
|
@ -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(:)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue