Address #925 comments

This commit is contained in:
Sterling Harper 2017-10-24 13:19:57 -04:00
parent 27b1e7d228
commit 64be3267d0
5 changed files with 10 additions and 20 deletions

View file

@ -45,8 +45,6 @@ _dll.openmc_filter_set_type.errcheck = _error_handler
_dll.openmc_get_filter_index.argtypes = [c_int32, POINTER(c_int32)]
_dll.openmc_get_filter_index.restype = c_int
_dll.openmc_get_filter_index.errcheck = _error_handler
_dll.openmc_get_free_filter_id.argtypes = [POINTER(c_int32)]
_dll.openmc_get_free_filter_id.restype = None
_dll.openmc_material_filter_get_bins.argtypes = [
c_int32, POINTER(POINTER(c_int32)), POINTER(c_int32)]
_dll.openmc_material_filter_get_bins.restype = c_int
@ -255,12 +253,4 @@ class _FilterMapping(Mapping):
def __repr__(self):
return repr(dict(self))
filters = _FilterMapping()
def get_free_filter_id():
"""Returns an ID number that has not been used by any other filters."""
id_ = c_int32()
_dll.openmc_get_free_filter_id(id_)
return id_.value

View file

@ -51,7 +51,7 @@ module openmc_api
public :: openmc_get_cell_index
public :: openmc_get_keff
public :: openmc_get_filter_index
public :: openmc_get_free_filter_id
public :: openmc_get_filter_next_id
public :: openmc_get_material_index
public :: openmc_get_nuclide_index
public :: openmc_get_tally_index

View file

@ -382,7 +382,7 @@ contains
! Set up mesh filter
i_filt = i_filt_start
err = openmc_filter_set_type(i_filt, C_CHAR_'mesh' // C_NULL_CHAR)
call openmc_get_free_filter_id(filt_id)
call openmc_get_filter_next_id(filt_id)
err = openmc_filter_set_id(i_filt, filt_id)
err = openmc_mesh_filter_set_mesh(i_filt, i_start)
@ -390,7 +390,7 @@ contains
! Read and set incoming energy mesh filter
i_filt = i_filt + 1
err = openmc_filter_set_type(i_filt, C_CHAR_'energy' // C_NULL_CHAR)
call openmc_get_free_filter_id(filt_id)
call openmc_get_filter_next_id(filt_id)
err = openmc_filter_set_id(i_filt, filt_id)
! Get energies and set bins
@ -402,7 +402,7 @@ contains
! Read and set outgoing energy mesh filter
i_filt = i_filt + 1
err = openmc_filter_set_type(i_filt, C_CHAR_'energyout' // C_NULL_CHAR)
call openmc_get_free_filter_id(filt_id)
call openmc_get_filter_next_id(filt_id)
err = openmc_filter_set_id(i_filt, filt_id)
err = openmc_energy_filter_set_bins(i_filt, ng, energies)
end if
@ -411,7 +411,7 @@ contains
! tallies use this filter and we need to change the dimension
i_filt = i_filt + 1
err = openmc_filter_set_type(i_filt, C_CHAR_'mesh' // C_NULL_CHAR)
call openmc_get_free_filter_id(filt_id)
call openmc_get_filter_next_id(filt_id)
err = openmc_filter_set_id(i_filt, filt_id)
err = openmc_mesh_filter_set_mesh(i_filt, i_start)

View file

@ -3146,7 +3146,7 @@ contains
filters(i_filt_start) % obj % n_bins = product(m % dimension + 1)
! Set ID
call openmc_get_free_filter_id(filter_id)
call openmc_get_filter_next_id(filter_id)
err = openmc_filter_set_id(i_filt_start, filter_id)
@ -3169,7 +3169,7 @@ contains
filt % current = .true.
! Set ID
call openmc_get_free_filter_id(filter_id)
call openmc_get_filter_next_id(filter_id)
err = openmc_filter_set_id(i_filt_end, filter_id)
end select

View file

@ -19,7 +19,7 @@ module tally_filter_header
public :: openmc_filter_get_id
public :: openmc_filter_set_id
public :: openmc_get_filter_index
public :: openmc_get_free_filter_id
public :: openmc_get_filter_next_id
!===============================================================================
! TALLYFILTERMATCH stores every valid bin and weight for a filter
@ -246,11 +246,11 @@ contains
end function openmc_get_filter_index
subroutine openmc_get_free_filter_id(id) bind(C)
subroutine openmc_get_filter_next_id(id) bind(C)
! Returns an ID number that has not been used by any other filters.
integer(C_INT32_T), intent(out) :: id
id = largest_filter_id + 1
end subroutine openmc_get_free_filter_id
end subroutine openmc_get_filter_next_id
end module tally_filter_header