1
! Copyright (C) 2006 Imperial College London and others.
3
! Please see the AUTHORS file in the main source directory for a full list
4
! of copyright holders.
7
! Applied Modelling and Computation Group
8
! Department of Earth Science and Engineering
9
! Imperial College London
11
! amcgsoftware@imperial.ac.uk
13
! This library is free software; you can redistribute it and/or
14
! modify it under the terms of the GNU Lesser General Public
15
! License as published by the Free Software Foundation,
16
! version 2.1 of the License.
18
! This library is distributed in the hope that it will be useful,
19
! but WITHOUT ANY WARRANTY; without even the implied arranty of
20
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
! Lesser General Public License for more details.
23
! You should have received a copy of the GNU Lesser General Public
24
! License along with this library; if not, write to the Free Software
25
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30
module radiation_materials_interpolation_destroy
32
use radiation_materials_interpolation_data_types
41
module procedure particle_radmat_ii_destroy, &
42
energy_group_set_all_destroy, &
43
energy_group_set_destroy, &
44
region_id_ii_all_destroy, &
45
region_id_ii_destroy, &
52
! --------------------------------------------------------------------------
54
subroutine particle_radmat_ii_destroy(particle_radmat_ii)
56
!!< Destroy the particle_radmat_ii type
58
type(particle_radmat_ii_type), intent(inout) :: particle_radmat_ii
60
energy_group_set_ii_deallocate: if (allocated(particle_radmat_ii%energy_group_set_ii)) then
62
call destroy(particle_radmat_ii%energy_group_set_ii)
64
end if energy_group_set_ii_deallocate
67
particle_radmat_ii%created = .false.
69
particle_radmat_ii%formed = .false.
71
end subroutine particle_radmat_ii_destroy
73
! --------------------------------------------------------------------------
75
subroutine energy_group_set_all_destroy(energy_group_set_ii)
77
!!< Destroy all the energy_group_set_ii type
79
type(energy_group_set_ii_type), dimension(:), allocatable, intent(inout) :: energy_group_set_ii
84
energy_group_set_loop: do g_set = 1,size(energy_group_set_ii)
86
call destroy(energy_group_set_ii(g_set))
88
end do energy_group_set_loop
90
deallocate(energy_group_set_ii)
92
end subroutine energy_group_set_all_destroy
94
! --------------------------------------------------------------------------
96
subroutine energy_group_set_destroy(energy_group_set_ii)
98
!!< Destroy the energy_group_set_ii type
100
type(energy_group_set_ii_type), intent(inout) :: energy_group_set_ii
102
region_id_ii_deallocate: if (allocated(energy_group_set_ii%region_id_ii)) then
104
call destroy(energy_group_set_ii%region_id_ii)
106
end if region_id_ii_deallocate
108
call destroy(energy_group_set_ii%ii_size)
110
end subroutine energy_group_set_destroy
112
! --------------------------------------------------------------------------
114
subroutine region_id_ii_all_destroy(region_id_ii)
116
!!< Destroy all the region_id_ii type
118
type(region_id_ii_type), dimension(:), allocatable, intent(inout) :: region_id_ii
123
node_loop: do n = 1,size(region_id_ii)
125
call destroy(region_id_ii(n))
129
deallocate(region_id_ii)
131
end subroutine region_id_ii_all_destroy
133
! --------------------------------------------------------------------------
135
subroutine region_id_ii_destroy(region_id_ii)
137
!!< Destroy the region_id_ii type
139
type(region_id_ii_type), intent(inout) :: region_id_ii
141
call destroy(region_id_ii%dataset_ii)
143
end subroutine region_id_ii_destroy
145
! --------------------------------------------------------------------------
147
subroutine dataset_ii_destroy(dataset_ii)
149
!!< Destroy the dataset_ii type
151
type(dataset_ii_type), intent(inout) :: dataset_ii
153
fraction_deallocate: if (allocated(dataset_ii%physical_radmat_ii%fraction)) then
155
deallocate(dataset_ii%physical_radmat_ii%fraction)
157
end if fraction_deallocate
159
coordinate_deallocate: if (allocated(dataset_ii%physical_radmat_ii%radmat_base_coordinate)) then
161
deallocate(dataset_ii%physical_radmat_ii%radmat_base_coordinate)
163
end if coordinate_deallocate
165
end subroutine dataset_ii_destroy
167
! --------------------------------------------------------------------------
169
subroutine ii_size_destroy(ii_size)
171
!!< Destroy the ii_size type
173
type(ii_size_type), intent(inout) :: ii_size
175
region_id_ii_size_deallocate: if (allocated(ii_size%region_id_ii_size)) then
177
deallocate(ii_size%region_id_ii_size)
179
end if region_id_ii_size_deallocate
182
ii_size%size_set = .false.
184
end subroutine ii_size_destroy
186
! --------------------------------------------------------------------------
188
end module radiation_materials_interpolation_destroy