From 21a79eefd910ceb2ca3aecb0da4894261b909d9f Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 30 Aug 2018 10:51:05 -0500 Subject: [PATCH] Remove some uses of mesh_dict --- src/input_xml.F90 | 15 ++++++--------- src/tallies/tally_filter_mesh.F90 | 22 +++++++++++----------- src/tallies/tally_filter_meshsurface.F90 | 22 ++++++++++------------ 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index bfd604f9e..be12870ad 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -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 " & diff --git a/src/tallies/tally_filter_mesh.F90 b/src/tallies/tally_filter_mesh.F90 index 486569da6..28eafcaaf 100644 --- a/src/tallies/tally_filter_mesh.F90 +++ b/src/tallies/tally_filter_mesh.F90 @@ -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) diff --git a/src/tallies/tally_filter_meshsurface.F90 b/src/tallies/tally_filter_meshsurface.F90 index 801d4252c..c7363a2db 100644 --- a/src/tallies/tally_filter_meshsurface.F90 +++ b/src/tallies/tally_filter_meshsurface.F90 @@ -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)