Have mesh filter store a pointer to a mesh rather than the index

This commit is contained in:
Paul Romano 2017-08-09 15:53:30 -05:00
parent 01fcdf9acd
commit fd1d6faf0f
7 changed files with 16 additions and 21 deletions

View file

@ -102,9 +102,8 @@ contains
i_filt = t % filter(t % find_filter(FILTER_MESH))
select type(filt => filters(i_filt) % obj)
type is (MeshFilter)
i_mesh = filt % mesh
m => filt % mesh
end select
m => meshes(i_mesh)
! Set mesh widths
cmfd % hxyz(1,:,:,:) = m % width(1) ! set x width
@ -121,9 +120,8 @@ contains
i_filt = t % filter(t % find_filter(FILTER_MESH))
select type(filt => filters(i_filt) % obj)
type is (MeshFilter)
i_mesh = filt % mesh
m => filt % mesh
end select
m => meshes(i_mesh)
! Check for energy filters
energy_filters = (t % find_filter(FILTER_ENERGYIN) > 0)

View file

@ -391,7 +391,7 @@ contains
type is (MeshFilter)
filt % id = i_filt
filt % n_bins = product(m % dimension)
filt % mesh = n_user_meshes + 1
filt % mesh => meshes(n_user_meshes + 1)
! Add filter to dictionary
call filter_dict % add_key(filt % id, i_filt)
end select
@ -436,7 +436,7 @@ contains
! We need to increase the dimension by one since we also need
! currents coming into and out of the boundary mesh cells.
filt % n_bins = product(m % dimension + 1)
filt % mesh = n_user_meshes + 1
filt % mesh => meshes(n_user_meshes + 1)
! Add filter to dictionary
call filter_dict % add_key(filt % id, i_filt)
end select

View file

@ -3117,7 +3117,7 @@ contains
filt % n_bins = product(m % dimension)
! Store the index of the mesh
filt % mesh = i_mesh
filt % mesh => meshes(i_mesh)
end select
case ('energy')
@ -3859,8 +3859,7 @@ contains
! Get pointer to mesh
select type(filt => filters(i_filter_mesh) % obj)
type is (MeshFilter)
i_mesh = filt % mesh
m => meshes(i_mesh)
m => filt % mesh
end select
! Copy filter indices to temporary array
@ -3888,7 +3887,7 @@ contains
select type(filt => filters(i_filt) % obj)
type is (MeshFilter)
filt % id = i_filt
filt % mesh = i_mesh
filt % mesh => m
! We need to increase the dimension by one since we also need
! currents coming into and out of the boundary mesh cells.
@ -4347,7 +4346,6 @@ contains
integer :: i, j
integer :: n_cols, col_id, n_comp, n_masks, n_meshlines
integer :: meshid
integer :: i_mesh
integer, allocatable :: iarray(:)
logical :: file_exists ! does plots.xml file exist?
character(MAX_LINE_LEN) :: filename ! absolute path to plots.xml
@ -4682,9 +4680,8 @@ contains
select type(filt => filters(cmfd_tallies(1) % &
filter(cmfd_tallies(1) % find_filter(FILTER_MESH))) % obj)
type is (MeshFilter)
i_mesh = filt % mesh
pl % meshlines_mesh => filt % mesh
end select
pl % meshlines_mesh => meshes(i_mesh)
case ('entropy')

View file

@ -1023,7 +1023,7 @@ contains
i_filter_mesh = t % filter(t % find_filter(FILTER_MESH))
select type(filt => filters(i_filter_mesh) % obj)
type is (MeshFilter)
m => meshes(filt % mesh)
m => filt % mesh
end select
! Get surface filter index and stride

View file

@ -3250,7 +3250,7 @@ contains
! Get pointer to mesh
select type(filt => filters(i_filter_mesh) % obj)
type is (MeshFilter)
m => meshes(filt % mesh)
m => filt % mesh
end select
n_dim = m % n_dimension

View file

@ -4,7 +4,7 @@ module tally_filter_mesh
use constants
use error, only: warning
use mesh_header
use mesh_header, only: RegularMesh
use hdf5_interface
use particle_header, only: Particle
use string, only: to_str
@ -22,7 +22,7 @@ module tally_filter_mesh
!===============================================================================
type, extends(TallyFilter) :: MeshFilter
integer :: mesh
type(RegularMesh), pointer :: mesh => null()
contains
procedure :: get_all_bins => get_all_bins_mesh
procedure :: to_statepoint => to_statepoint_mesh
@ -62,7 +62,7 @@ contains
weight = ERROR_REAL
! Get a pointer to the mesh.
m => meshes(this % mesh)
m => this % mesh
n = m % n_dimension
if (estimator /= ESTIMATOR_TRACKLENGTH) then
@ -217,7 +217,7 @@ contains
call write_dataset(filter_group, "type", "mesh")
call write_dataset(filter_group, "n_bins", this % n_bins)
call write_dataset(filter_group, "bins", meshes(this % mesh) % id)
call write_dataset(filter_group, "bins", this % mesh % id)
end subroutine to_statepoint_mesh
function text_label_mesh(this, bin) result(label)
@ -227,7 +227,7 @@ contains
integer, allocatable :: ijk(:)
associate (m => meshes(this % mesh))
associate (m => this % mesh)
allocate(ijk(m % n_dimension))
call m % get_indices_from_bin(bin, ijk)
if (m % n_dimension == 1) then

View file

@ -315,7 +315,7 @@ contains
i_filter_surf = t % filter(t % find_filter(FILTER_SURFACE))
select type(filt => filters(i_filter_mesh) % obj)
type is (MeshFilter)
m => meshes(filt % mesh)
m => filt % mesh
end select
! initialize bins array