From 11ab56ef20cc0ce76c39674db2e372a37da564fd Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 7 May 2015 23:37:41 -0400 Subject: [PATCH] Made coord mapping array a pointer instead of allocatable for gfortran <=4.6 compatibility --- src/geometry.F90 | 6 +++--- src/particle_header.F90 | 6 ++++-- src/tally.F90 | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/geometry.F90 b/src/geometry.F90 index 70e4192e4f..2d2ec9baea 100644 --- a/src/geometry.F90 +++ b/src/geometry.F90 @@ -199,7 +199,7 @@ contains p % coord % universe = c % fill ! Determine all distribcell offsets for this cell level - if (.not. allocated(p % coord % mapping)) then + if (.not. associated(p % coord % mapping)) then allocate(p % coord % mapping(n_maps)) end if do j = 1, n_maps @@ -264,7 +264,7 @@ contains ! Determine all distribcell offsets for this cell level if (lat % are_valid_indices(i_xyz)) then - if (.not. allocated(p % coord % mapping)) then + if (.not. associated(p % coord % mapping)) then allocate(p % coord % mapping(n_maps)) end if @@ -637,7 +637,7 @@ contains p % coord % universe = lat % universes(i_xyz(1), i_xyz(2), i_xyz(3)) ! Determine all distribcell offsets for this lattice cell - if (.not. allocated(p % coord % mapping)) then + if (.not. associated(p % coord % mapping)) then allocate(p % coord % mapping(n_maps)) end if do i = 1, n_maps diff --git a/src/particle_header.F90 b/src/particle_header.F90 index 8528f3112c..3224d63468 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -28,7 +28,7 @@ module particle_header logical :: rotated = .false. ! Distributed Mapping Info - integer, allocatable :: mapping(:) + integer, pointer :: mapping(:) => null() ! Pointer to next (more local) set of coordinates type(LocalCoord), pointer :: next => null() @@ -105,7 +105,9 @@ contains if (associated(coord % next)) call deallocate_coord(coord%next) ! deallocate original coordinate - if (allocated(coord % mapping)) deallocate(coord % mapping) + if (associated(coord % mapping)) deallocate(coord % mapping) + + ! deallocate this coord deallocate(coord) end if diff --git a/src/tally.F90 b/src/tally.F90 index 4bc0b31a10..47502b5d40 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -1160,7 +1160,7 @@ contains coord => p % coord0 offset = 0 do while(associated(coord)) - if (allocated(coord % mapping)) then + if (associated(coord % mapping)) then offset = offset + coord % mapping(t % filters(i) % offset) end if if (t % filters(i) % int_bins(1) == coord % cell) then