Remove some uses of mesh_dict

This commit is contained in:
Paul Romano 2018-08-30 10:51:05 -05:00
parent 666553da27
commit 21a79eefd9
3 changed files with 27 additions and 32 deletions

View file

@ -2064,6 +2064,7 @@ contains
integer :: i, j
integer :: n_cols, col_id, n_comp, n_masks, n_meshlines
integer :: meshid
integer(C_INT) :: err, idx
integer, allocatable :: iarray(:)
logical :: file_exists ! does plots.xml file exist?
character(MAX_LINE_LEN) :: filename ! absolute path to plots.xml
@ -2386,7 +2387,7 @@ contains
// trim(to_str(pl % id)))
end if
pl % meshlines_mesh => meshes(index_ufs_mesh)
pl % index_meshlines_mesh = index_ufs_mesh
case ('cmfd')
@ -2404,7 +2405,7 @@ contains
// trim(to_str(pl % id)))
end if
pl % meshlines_mesh => meshes(index_entropy_mesh)
pl % index_meshlines_mesh = index_entropy_mesh
case ('tally')
@ -2417,17 +2418,13 @@ contains
end if
! Check if the specified tally mesh exists
if (mesh_dict % has(meshid)) then
pl % meshlines_mesh => meshes(mesh_dict % get(meshid))
if (meshes(meshid) % type /= MESH_REGULAR) then
call fatal_error("Non-rectangular mesh specified in &
&meshlines for plot " // trim(to_str(pl % id)))
end if
else
err = openmc_get_mesh_index(meshid, idx)
if (err /= 0) then
call fatal_error("Could not find mesh " &
// trim(to_str(meshid)) // " specified in meshlines for &
&plot " // trim(to_str(pl % id)))
end if
pl % index_meshlines_mesh = idx
case default
call fatal_error("Invalid type for meshlines on plot " &

View file

@ -5,7 +5,7 @@ module tally_filter_mesh
use constants
use dict_header, only: EMPTY
use error
use mesh_header, only: RegularMesh, meshes, n_meshes, mesh_dict
use mesh_header
use hdf5_interface
use particle_header, only: Particle
use string, only: to_str
@ -38,10 +38,11 @@ contains
class(MeshFilter), intent(inout) :: this
type(XMLNode), intent(in) :: node
integer :: i_mesh
integer :: i
integer :: id
integer :: n
integer :: val
integer(C_INT) :: err
type(RegularMesh) :: m
n = node_word_count(node, "bins")
@ -52,19 +53,18 @@ contains
call get_node_value(node, "bins", id)
! Get pointer to mesh
val = mesh_dict % get(id)
if (val /= EMPTY) then
i_mesh = val
else
err = openmc_get_mesh_index(id, this % mesh)
if (err /= 0) then
call fatal_error("Could not find mesh " // trim(to_str(id)) &
// " specified on filter.")
end if
! Determine number of bins
this % n_bins = product(meshes(i_mesh) % dimension)
! Store the index of the mesh
this % mesh = i_mesh
m = meshes(this % mesh)
this % n_bins = 1
do i = 1, m % n_dimension()
this % n_bins = this % n_bins * m % dimension(i)
end do
end subroutine from_xml
subroutine get_all_bins_mesh(this, p, estimator, match)

View file

@ -5,7 +5,7 @@ module tally_filter_meshsurface
use constants
use dict_header, only: EMPTY
use error
use mesh_header, only: RegularMesh, meshes, n_meshes, mesh_dict
use mesh_header
use hdf5_interface
use particle_header, only: Particle
use string, only: to_str
@ -38,11 +38,11 @@ contains
class(MeshSurfaceFilter), intent(inout) :: this
type(XMLNode), intent(in) :: node
integer :: i_mesh
integer :: i
integer :: id
integer :: n
integer :: n_dim
integer :: val
type(RegularMesh) :: m
n = node_word_count(node, "bins")
@ -53,20 +53,18 @@ contains
call get_node_value(node, "bins", id)
! Get pointer to mesh
val = mesh_dict % get(id)
if (val /= EMPTY) then
i_mesh = val
else
err = openmc_get_mesh_index(id, this % mesh)
if (err /= 0) then
call fatal_error("Could not find mesh " // trim(to_str(id)) &
// " specified on filter.")
end if
! Determine number of bins
n_dim = meshes(i_mesh) % n_dimension
this % n_bins = 4*n_dim*product(meshes(i_mesh) % dimension)
! Store the index of the mesh
this % mesh = i_mesh
m = meshes(this % mesh)
this % n_bins = 4 * m % n_dimension()
do i = 1, m % n_dimension()
this % n_bins = this % n_bins * m % dimension(i)
end do
end subroutine from_xml
subroutine get_all_bins(this, p, estimator, match)