@@ -16,6 +16,10 @@ module ace_header
16
16
integer , allocatable :: type (:) ! type of distribution
17
17
integer , allocatable :: location(:) ! location of each table
18
18
real (8 ), allocatable :: data (:) ! angular distribution data
19
+
20
+ ! Type-Bound procedures
21
+ contains
22
+ procedure :: clear = > distangle_clear ! Deallocates DistAngle
19
23
end type DistAngle
20
24
21
25
! ===============================================================================
@@ -31,6 +35,10 @@ module ace_header
31
35
! For reactions that may have multiple energy distributions such as (n.2n),
32
36
! this pointer allows multiple laws to be stored
33
37
type (DistEnergy), pointer :: next = > null ()
38
+
39
+ ! Type-Bound procedures
40
+ contains
41
+ procedure :: clear = > distenergy_clear ! Deallocates DistEnergy
34
42
end type DistEnergy
35
43
36
44
! ===============================================================================
@@ -48,7 +56,11 @@ module ace_header
48
56
logical :: has_angle_dist ! Angle distribution present?
49
57
logical :: has_energy_dist ! Energy distribution present?
50
58
type (DistAngle) :: adist ! Secondary angular distribution
51
- type (DistEnergy), pointer :: edist ! Secondary energy distribution
59
+ type (DistEnergy), pointer :: edist = > null () ! Secondary energy distribution
60
+
61
+ ! Type-Bound procedures
62
+ contains
63
+ procedure :: clear = > reaction_clear ! Deallocates Reaction
52
64
end type Reaction
53
65
54
66
! ===============================================================================
@@ -64,6 +76,10 @@ module ace_header
64
76
logical :: multiply_smooth ! multiply by smooth cross section?
65
77
real (8 ), allocatable :: energy(:) ! incident energies
66
78
real (8 ), allocatable :: prob(:,:,:) ! actual probabibility tables
79
+
80
+ ! Type-Bound procedures
81
+ contains
82
+ procedure :: clear = > urrdata_clear ! Deallocates UrrData
67
83
end type UrrData
68
84
69
85
! ===============================================================================
@@ -121,7 +137,10 @@ module ace_header
121
137
! Reactions
122
138
integer :: n_reaction ! # of reactions
123
139
type (Reaction), pointer :: reactions(:) = > null ()
124
-
140
+
141
+ ! Type-Bound procedures
142
+ contains
143
+ procedure :: clear = > nuclide_clear ! Deallocates Nuclide
125
144
end type Nuclide
126
145
127
146
! ===============================================================================
@@ -216,4 +235,129 @@ module ace_header
216
235
real (8 ) :: kappa_fission ! macroscopic energy-released from fission
217
236
end type MaterialMacroXS
218
237
238
+ contains
239
+
240
+ ! ===============================================================================
241
+ ! DISTANGLE_CLEAR resets and deallocates data in Reaction.
242
+ ! ===============================================================================
243
+
244
+ subroutine distangle_clear (this )
245
+
246
+ class(DistAngle), intent (inout ) :: this ! The DistAngle object to clear
247
+
248
+ if (allocated (this % energy)) &
249
+ deallocate (this % energy, this % type, this % location, this % data )
250
+
251
+ end subroutine distangle_clear
252
+
253
+ ! ===============================================================================
254
+ ! DISTENERGY_CLEAR resets and deallocates data in DistEnergy.
255
+ ! ===============================================================================
256
+
257
+ recursive subroutine distenergy_clear (this )
258
+
259
+ class(DistEnergy), intent (inout ) :: this ! The DistEnergy object to clear
260
+
261
+ ! Clear p_valid
262
+ call this % p_valid % clear()
263
+
264
+ if (allocated (this % data )) &
265
+ deallocate (this % data )
266
+
267
+ if (associated (this % next)) then
268
+ ! recursively clear this item
269
+ call this % next % clear()
270
+ deallocate (this % next)
271
+ end if
272
+
273
+ end subroutine distenergy_clear
274
+
275
+ ! ===============================================================================
276
+ ! REACTION_CLEAR resets and deallocates data in Reaction.
277
+ ! ===============================================================================
278
+
279
+ subroutine reaction_clear (this )
280
+
281
+ class(Reaction), intent (inout ) :: this ! The Reaction object to clear
282
+
283
+ if (allocated (this % sigma)) &
284
+ deallocate (this % sigma)
285
+
286
+ if (associated (this % edist)) then
287
+ call this % edist % clear()
288
+ deallocate (this % edist)
289
+ end if
290
+
291
+ call this % adist % clear()
292
+
293
+ end subroutine reaction_clear
294
+
295
+ ! ===============================================================================
296
+ ! URRDATA_CLEAR resets and deallocates data in Reaction.
297
+ ! ===============================================================================
298
+
299
+ subroutine urrdata_clear (this )
300
+
301
+ class(UrrData), intent (inout ) :: this ! The UrrData object to clear
302
+
303
+ if (allocated (this % energy)) &
304
+ deallocate (this % energy, this % prob)
305
+
306
+ end subroutine urrdata_clear
307
+
308
+ ! ===============================================================================
309
+ ! NUCLIDE_CLEAR resets and deallocates data in Nuclide.
310
+ ! ===============================================================================
311
+
312
+ subroutine nuclide_clear (this )
313
+
314
+ class(Nuclide), intent (inout ) :: this ! The Nuclide object to clear
315
+
316
+ integer :: i ! Loop counter
317
+
318
+ if (allocated (this % grid_index)) &
319
+ deallocate (this % grid_index)
320
+
321
+ if (allocated (this % energy)) &
322
+ deallocate (this % total, this % elastic, this % fission, &
323
+ this % nu_fission, this % absorption)
324
+ if (allocated (this % heating)) &
325
+ deallocate (this % heating)
326
+
327
+ if (allocated (this % index_fission)) &
328
+ deallocate (this % index_fission)
329
+
330
+ if (allocated (this % nu_t_data)) &
331
+ deallocate (this % nu_t_data)
332
+
333
+ if (allocated (this % nu_p_data)) &
334
+ deallocate (this % nu_p_data)
335
+
336
+ if (allocated (this % nu_d_data)) &
337
+ deallocate (this % nu_d_data)
338
+
339
+ if (allocated (this % nu_d_precursor_data)) &
340
+ deallocate (this % nu_d_precursor_data)
341
+
342
+ if (associated (this % nu_d_edist)) then
343
+ do i = 1 , size (this % nu_d_edist)
344
+ call this % nu_d_edist(i) % clear()
345
+ end do
346
+ deallocate (this % nu_d_edist)
347
+ end if
348
+
349
+ if (associated (this % urr_data)) then
350
+ call this % urr_data % clear()
351
+ deallocate (this % urr_data)
352
+ end if
353
+
354
+ if (associated (this % reactions)) then
355
+ do i = 1 , size (this % reactions)
356
+ call this % reactions(i) % clear()
357
+ end do
358
+ deallocate (this % reactions)
359
+ end if
360
+
361
+ end subroutine nuclide_clear
362
+
219
363
end module ace_header
0 commit comments