Changed label to name

This commit is contained in:
Will Boyd 2015-04-27 08:20:30 -04:00
parent 92eaa43320
commit c738c73486
19 changed files with 127 additions and 127 deletions

View file

@ -708,8 +708,8 @@ Each ``<surface>`` element can have the following attributes or sub-elements:
*Default*: None
:label:
An optional string label to identify the surface in summary output
:name:
An optional string name to identify the surface in summary output
files. This string is limited to 52 characters for formatting purposes.
*Default*: ""
@ -794,8 +794,8 @@ Each ``<cell>`` element can have the following attributes or sub-elements:
*Default*: None
:label:
An optional string label to identify the cell in summary output files.
:name:
An optional string name to identify the cell in summary output files.
This string is limmited to 52 characters for formatting purposes.
*Default*: ""
@ -865,8 +865,8 @@ the following attributes or sub-elements:
:id:
A unique integer that can be used to identify the lattice.
:label:
An optional string label to identify the lattice in summary output
:name:
An optional string name to identify the lattice in summary output
files. This string is limited to 52 characters for formatting purposes.
*Default*: ""
@ -930,8 +930,8 @@ the following attributes or sub-elements:
:id:
A unique integer that can be used to identify the lattice.
:label:
An optional string label to identify the hex_lattice in summary output
:name:
An optional string name to identify the hex_lattice in summary output
files. This string is limited to 52 characters for formatting purposes.
*Default*: ""
@ -1013,8 +1013,8 @@ Each ``material`` element can have the following attributes or sub-elements:
:id:
A unique integer that can be used to identify the material.
:label:
An optional string label to identify the material in summary output
:name:
An optional string name to identify the material in summary output
files. This string is limited to 52 characters for formatting purposes.
*Default*: ""
@ -1121,8 +1121,8 @@ and ``<assume_separate>``.
The ``<tally>`` element accepts the following sub-elements:
:label:
An optional string label to identify the tally in summary output
:name:
An optional string name to identify the tally in summary output
files. This string is limited to 52 characters for formatting purposes.
*Default*: ""

View file

@ -200,7 +200,7 @@ mesh_filter = openmc.Filter()
mesh_filter.mesh = mesh
# Instantiate the Tally
tally = openmc.Tally(tally_id=1)
tally = openmc.Tally(tally_id=1, name='tally 1')
tally.add_filter(energy_filter)
tally.add_filter(mesh_filter)
tally.add_score('flux')

View file

@ -460,8 +460,8 @@ contains
if (i == 1) then
! Set label
t % label = "CMFD flux, total, scatter-1"
! Set name
t % name = "CMFD flux, total, scatter-1"
! Set tally estimator to analog
t % estimator = ESTIMATOR_ANALOG
@ -491,8 +491,8 @@ contains
else if (i == 2) then
! Set label
t % label = "CMFD neutron production"
! Set name
t % name = "CMFD neutron production"
! Set tally estimator to analog
t % estimator = ESTIMATOR_ANALOG
@ -536,8 +536,8 @@ contains
else if (i == 3) then
! Set label
t % label = "CMFD surface currents"
! Set name
t % name = "CMFD surface currents"
! Set tally estimator to analog
t % estimator = ESTIMATOR_ANALOG

View file

@ -22,7 +22,7 @@ module geometry_header
type, abstract :: Lattice
integer :: id ! Universe number for lattice
character(len=52) :: label = "" ! User-defined label
character(len=52) :: name = "" ! User-defined name
real(8), allocatable :: pitch(:) ! Pitch along each axis
integer, allocatable :: universes(:,:,:) ! Specified universes
integer :: outside ! Material to fill area outside
@ -117,7 +117,7 @@ module geometry_header
type Surface
integer :: id ! Unique ID
character(len=52) :: label = "" ! User-defined label
character(len=52) :: name = "" ! User-defined name
integer :: type ! Type of surface
real(8), allocatable :: coeffs(:) ! Definition of surface
integer, allocatable :: &
@ -132,7 +132,7 @@ module geometry_header
type Cell
integer :: id ! Unique ID
character(len=52) :: label = "" ! User-defined label
character(len=52) :: name = "" ! User-defined name
integer :: type ! Type of cell (normal, universe, lattice)
integer :: universe ! universe # this cell is in
integer :: fill ! universe # filling this cell

View file

@ -127,8 +127,8 @@ contains
call su % write_data(i, "index", &
group="geometry/cells/cell " // trim(to_str(c % id)))
! Write label for this cell
call su % write_data(c % label, "label", &
! Write name for this cell
call su % write_data(c % name, "name", &
group="geometry/cells/cell " // trim(to_str(c % id)))
! Write universe for this cell
@ -204,8 +204,8 @@ contains
call su % write_data(i, "index", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
! Write label for this surface
call su % write_data(s % label, "label", &
! Write name for this surface
call su % write_data(s % name, "name", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
! Write surface type
@ -319,8 +319,8 @@ contains
call su % write_data(i, "index", &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
! Write label for this lattice
call su % write_data(lat % label, "label", &
! Write name for this lattice
call su % write_data(lat % name, "name", &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
! Write lattice type
@ -449,8 +449,8 @@ contains
call su % write_data(i, "index", &
group="materials/material " // trim(to_str(m % id)))
! Write label for this material
call su % write_data(m % label, "label", &
! Write name for this material
call su % write_data(m % name, "name", &
group="materials/material " // trim(to_str(m % id)))
! Write atom density with units

View file

@ -976,10 +976,10 @@ contains
call fatal_error("Must specify id of cell in geometry XML file.")
end if
! Copy cell label
c % label = ''
if (check_for_node(node_cell, "label")) then
call get_node_value(node_cell, "label", c % label)
! Copy cell name
c % name = ''
if (check_for_node(node_cell, "name")) then
call get_node_value(node_cell, "name", c % name)
end if
if (check_for_node(node_cell, "universe")) then
@ -1161,10 +1161,10 @@ contains
&// to_str(s % id))
end if
! Copy surface label
s % label = ''
if (check_for_node(node_surf, "label")) then
call get_node_value(node_surf, "label", s % label)
! Copy surface name
s % name = ''
if (check_for_node(node_surf, "name")) then
call get_node_value(node_surf, "name", s % name)
end if
! Copy and interpret surface type
@ -1289,10 +1289,10 @@ contains
&// to_str(lat % id))
end if
! Copy lattice label
lat % label = ''
if (check_for_node(node_lat, "label")) then
call get_node_value(node_lat, "label", lat % label)
! Copy lattice name
lat % name = ''
if (check_for_node(node_lat, "name")) then
call get_node_value(node_lat, "name", lat % name)
end if
! Read number of lattice cells in each dimension
@ -1418,10 +1418,10 @@ contains
&// to_str(lat % id))
end if
! Copy lattice label
lat % label = ''
if (check_for_node(node_lat, "label")) then
call get_node_value(node_lat, "label", lat % label)
! Copy lattice name
lat % name = ''
if (check_for_node(node_lat, "name")) then
call get_node_value(node_lat, "name", lat % name)
end if
! Read number of lattice cells in each dimension
@ -1669,10 +1669,10 @@ contains
&// to_str(mat % id))
end if
! Copy material label
mat % label = ''
if (check_for_node(node_mat, "label")) then
call get_node_value(node_mat, "label", mat % label)
! Copy material name
mat % name = ''
if (check_for_node(node_mat, "name")) then
call get_node_value(node_mat, "name", mat % name)
end if
if (run_mode == MODE_PLOTTING) then
@ -2237,10 +2237,10 @@ contains
&// to_str(t % id))
end if
! Copy tally label
t % label = ''
if (check_for_node(node_tal, "label")) &
call get_node_value(node_tal, "label", t % label)
! Copy tally name
t % name = ''
if (check_for_node(node_tal, "name")) &
call get_node_value(node_tal, "name", t % name)
! =======================================================================
! READ DATA FOR FILTERS

View file

@ -8,7 +8,7 @@ module material_header
type Material
integer :: id ! unique identifier
character(len=52) :: label = "" ! User-defined label
character(len=52) :: name = "" ! User-defined name
integer :: n_nuclides ! number of nuclides
integer, allocatable :: nuclide(:) ! index in nuclides array
real(8) :: density ! total atom density in atom/b-cm

View file

@ -369,8 +369,8 @@ contains
! Write user-specified id for cell
write(unit_,*) 'Cell ' // to_str(c % id)
! Write user-specified label for cell
write(unit_,*) ' Label = ' // c % label
! Write user-specified name for cell
write(unit_,*) ' Name = ' // c % name
! Find index in cells array and write
index_cell = cell_dict % get_key(c % id)
@ -490,8 +490,8 @@ contains
! Write information about lattice
write(unit_,*) 'Lattice ' // to_str(lat % id)
! Write user-specified label for lattice
write(unit_,*) ' Label = ' // lat % label
! Write user-specified name for lattice
write(unit_,*) ' Name = ' // lat % name
select type(lat)
type is (RectLattice)
@ -578,8 +578,8 @@ contains
! Write user-specified id of surface
write(unit_,*) 'Surface ' // to_str(surf % id)
! Write user-specified label for surface
write(unit_,*) ' Label = ' // surf % label
! Write user-specified name for surface
write(unit_,*) ' Name = ' // surf % name
! Write type of surface
select case (surf % type)
@ -677,8 +677,8 @@ contains
! Write identifier for material
write(unit_,*) 'Material ' // to_str(mat % id)
! Write user-specified label for material
write(unit_,*) ' Label = ' // mat % label
! Write user-specified name for material
write(unit_,*) ' Name = ' // mat % name
! Write total atom density in atom/b-cm
write(unit_,*) ' Atom Density = ' // trim(to_str(mat % density)) &
@ -1779,12 +1779,12 @@ contains
end if
! Write header block
if (t % label == "") then
if (t % name == "") then
call header("TALLY " // trim(to_str(t % id)), unit=UNIT_TALLY, &
level=3)
else
call header("TALLY " // trim(to_str(t % id)) // ": " &
// trim(t % label), unit=UNIT_TALLY, level=3)
// trim(t % name), unit=UNIT_TALLY, level=3)
endif
! Handle surface current tallies separately

View file

@ -236,10 +236,10 @@ contains
! Get pointer to tally
tally => tallies(i)
call sp % write_data(len(tally % label), "label_size", &
call sp % write_data(len(tally % name), "name_size", &
group="tallies/tally " // trim(to_str(tally % id)))
if (len(tally % label) > 0) then
call sp % write_data(tally % label, "label", &
if (len(tally % name) > 0) then
call sp % write_data(tally % name, "name", &
group="tallies/tally " // trim(to_str(tally % id)))
endif
@ -649,7 +649,7 @@ contains
character(MAX_FILE_LEN) :: path_temp
character(19) :: current_time
character(52) :: label
character(52) :: name
integer :: i, j, k
integer :: length(4)
integer :: int_array(3)
@ -826,10 +826,10 @@ contains
tally => tallies(i)
curr_key = key_array(id_array(i))
call sp % read_data(j, "label_size", group="tallies/tally " // &
call sp % read_data(j, "name_size", group="tallies/tally " // &
trim(to_str(curr_key)))
if (j > 0) then
call sp % read_data(label, "label", group="tallies/tally " // &
call sp % read_data(name, "name", group="tallies/tally " // &
trim(to_str(curr_key)))
end if

View file

@ -71,7 +71,7 @@ module tally_header
! Basic data
integer :: id ! user-defined identifier
character(len=52) :: label = "" ! user-defined label
character(len=52) :: name = "" ! user-defined name
integer :: type ! volume, surface current
integer :: estimator ! collision, track-length
real(8) :: volume ! volume of region
@ -159,7 +159,7 @@ module tally_header
! This routine will go through each item in TallyObject and set the value
! to its default, as-initialized values, including deallocations.
this % label = ""
this % name = ""
if (allocated(this % filters)) then
do i = 1, size(this % filters)

View file

@ -375,7 +375,7 @@ class Material(object):
element.set("id", str(self._id))
if len(self._name) > 0:
element.set("label", str(self._name))
element.set("name", str(self._name))
# Create density XML subelement
subelement = ET.SubElement(element, "density")

View file

@ -298,17 +298,17 @@ class StatePoint(object):
# Iterate over all Tallies
for tally_key in self._tally_keys:
# Read user-specified Tally label (if specified)
label_size = self._get_int(
path='{0}{1}/label_size'.format(base, tally_key))[0]
# Read user-specified Tally name (if specified)
name_size = self._get_int(
path='{0}{1}/name_size'.format(base, tally_key))[0]
if label_size > 0:
label = self._get_string(
label_size, path='{0}{1}/label'.format(base, tally_key))
if name_size > 0:
name = self._get_string(
name_size, path='{0}{1}/name'.format(base, tally_key))
# Remove leading and trailing characters from string label
label = label.lstrip('[\'')
label = label.rstrip('\']')
# Remove leading and trailing characters from string name
name = name.lstrip('[\'')
name = name.rstrip('\']')
# Read integer Tally estimator type code (analog or tracklength)
estimator_type = self._get_int(
@ -319,7 +319,7 @@ class StatePoint(object):
path='{0}{1}/n_realizations'.format(base, tally_key))[0]
# Create Tally object and assign basic properties
tally = openmc.Tally(tally_key, label)
tally = openmc.Tally(tally_key, name)
tally.estimator = ESTIMATOR_TYPES[estimator_type]
tally.num_realizations = n_realizations
@ -570,7 +570,7 @@ class StatePoint(object):
def get_tally(self, score, filters, nuclides,
label='', estimator='tracklength'):
name='', estimator='tracklength'):
"""Finds and returns a Tally object with certain properties.
Parameters
@ -584,8 +584,8 @@ class StatePoint(object):
nuclides : list
A list of Nuclide objects
label : str
The label specified for the Tally (default is '')
name : str
The name specified for the Tally (default is '')
estimator: str
The type of estimator ('tracklength' (default) or 'analog')
@ -597,8 +597,8 @@ class StatePoint(object):
# Iterate over all tallies to find the appropriate one
for tally_id, test_tally in self._tallies.items():
# Determine if the queried Tally label is the same as this Tally
if not label == test_tally._label:
# Determine if the queried Tally name is the same as this Tally
if not name == test_tally._name:
continue
# Determine if the queried Tally estimator is the same as this Tally
@ -643,7 +643,7 @@ class StatePoint(object):
return tally
def get_tally_id(self, score, filters, label='', estimator='tracklength'):
def get_tally_id(self, score, filters, name='', estimator='tracklength'):
"""Retrieve the Tally ID for a given list of filters and score(s).
Parameters
@ -654,14 +654,14 @@ class StatePoint(object):
filters : list
A list of Filter objects
label : str
The label specified for the Tally (default is '')
name : str
The name specified for the Tally (default is '')
estimator: str
The type of estimator ('tracklength' (default) or 'analog')
"""
tally = self.get_tally(score, filters, label, estimator)
tally = self.get_tally(score, filters, name, estimator)
return tally._id

View file

@ -105,7 +105,7 @@ class Summary(object):
material_id = int(key.lstrip('material '))
index = self._f['materials'][key]['index'][0]
name = self._f['materials'][key]['label'][0]
name = self._f['materials'][key]['name'][0]
density = self._f['materials'][key]['atom_density'][0]
nuc_densities = self._f['materials'][key]['nuclide_densities'][...]
nuclides = self._f['materials'][key]['nuclides'][...]
@ -165,7 +165,7 @@ class Summary(object):
surface_id = int(key.lstrip('surface '))
index = self._f['geometry/surfaces'][key]['index'][0]
name = self._f['geometry/surfaces'][key]['label'][0]
name = self._f['geometry/surfaces'][key]['name'][0]
surf_type = self._f['geometry/surfaces'][key]['type'][...][0]
bc = self._f['geometry/surfaces'][key]['boundary_condition'][...][0]
coeffs = self._f['geometry/surfaces'][key]['coefficients'][...]
@ -257,7 +257,7 @@ class Summary(object):
cell_id = int(key.lstrip('cell '))
index = self._f['geometry/cells'][key]['index'][0]
name = self._f['geometry/cells'][key]['label'][0]
name = self._f['geometry/cells'][key]['name'][0]
fill_type = self._f['geometry/cells'][key]['fill_type'][...][0]
if fill_type == 'normal':
@ -351,7 +351,7 @@ class Summary(object):
lattice_id = int(key.lstrip('lattice '))
index = self._f['geometry/lattices'][key]['index'][0]
name = self._f['geometry/lattices'][key]['label'][0]
name = self._f['geometry/lattices'][key]['name'][0]
lattice_type = self._f['geometry/lattices'][key]['type'][...][0]
if lattice_type == 'rectangular':

View file

@ -135,7 +135,7 @@ class Surface(object):
element.set("id", str(self._id))
if len(self._name) > 0:
element.set("label", str(self._name))
element.set("name", str(self._name))
element.set("type", self._type)
element.set("boundary", self._boundary_type)

View file

@ -584,11 +584,11 @@ class Mesh(object):
class Tally(object):
def __init__(self, tally_id=None, label=''):
def __init__(self, tally_id=None, name=''):
# Initialize Tally class attributes
self.id = tally_id
self.label = label
self.name = name
self._filters = []
self._nuclides = []
self._scores = []
@ -612,7 +612,7 @@ class Tally(object):
clone = type(self).__new__(type(self))
clone._id = self._id
clone._label = self._label
clone._name = self._name
clone._estimator = self._estimator
clone._num_score_bins = self._num_score_bins
clone._num_realizations = self._num_realizations
@ -678,7 +678,7 @@ class Tally(object):
hashable.append(score)
hashable.append(self._estimator)
hashable.append(self._label)
hashable.append(self._name)
return hash(tuple(hashable))
@ -699,8 +699,8 @@ class Tally(object):
@property
def label(self):
return self._label
def name(self):
return self._name
@property
@ -819,16 +819,16 @@ class Tally(object):
self._id = tally_id
@label.setter
def label(self, label):
@name.setter
def name(self, name):
if not is_string(label):
if not is_string(name):
msg = 'Unable to set name for Tally ID={0} with a non-string ' \
'value {1}'.format(self._id, label)
'value {1}'.format(self._id, name)
raise ValueError(msg)
else:
self._label = label
self._name = name
def add_filter(self, filter):
@ -945,7 +945,7 @@ class Tally(object):
string = 'Tally\n'
string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._label)
string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name)
string += '{0: <16}\n'.format('\tFilters')
@ -976,9 +976,9 @@ class Tally(object):
# Tally ID
element.set("id", str(self._id))
# Optional Tally label
if self._label != '':
element.set("label", self._label)
# Optional Tally name
if self._name != '':
element.set("name", self._name)
# Optional Tally filters
for filter in self._filters:
@ -1220,7 +1220,7 @@ class Tally(object):
# Add basic Tally data to the HDF5 group
tally_group.create_dataset('id', data=self._id)
tally_group.create_dataset('label', data=self._label)
tally_group.create_dataset('name', data=self._name)
tally_group.create_dataset('estimator', data=self._estimator)
tally_group.create_dataset('scores', data=np.array(self._scores))
@ -1268,7 +1268,7 @@ class Tally(object):
# Add basic Tally data to the nested dictionary
tally_group['id'] = self._id
tally_group['label'] = self._label
tally_group['name'] = self._name
tally_group['estimator'] = self._estimator
tally_group['scores'] = np.array(self._scores)

View file

@ -346,7 +346,7 @@ class Cell(object):
element.set("id", str(self._id))
if len(self._name) > 0:
element.set("label", str(self._name))
element.set("name", str(self._name))
if isinstance(self._fill, openmc.Material):
element.set("material", str(self._fill._id))
@ -991,7 +991,7 @@ class RectLattice(Lattice):
lattice_subelement.set("id", str(self._id))
if len(self._name) > 0:
lattice_subelement.set("label", str(self._name))
lattice_subelement.set("name", str(self._name))
# Export the Lattice cell pitch
if len(self._pitch) == 3:
@ -1320,7 +1320,7 @@ class HexLattice(Lattice):
lattice_subelement.set("id", str(self._id))
if len(self._name) > 0:
lattice_subelement.set("label", str(self._name))
lattice_subelement.set("name", str(self._name))
# Export the Lattice cell pitch
if len(self._pitch) == 2:

View file

@ -23,11 +23,11 @@ results1[0::2] = tally1._sum.ravel()
results1[1::2] = tally1._sum_sq.ravel()
for tally_id in sp._tallies:
if 'CMFD flux, total, scatter-1' in sp._tallies[tally_id]._label:
if 'CMFD flux, total, scatter-1' in sp._tallies[tally_id]._name:
tally2 = sp._tallies[tally_id]
elif 'CMFD neutron production' in sp._tallies[tally_id]._label:
elif 'CMFD neutron production' in sp._tallies[tally_id]._name:
tally3 = sp._tallies[tally_id]
elif 'CMFD surface currents' in sp._tallies[tally_id]._label:
elif 'CMFD surface currents' in sp._tallies[tally_id]._name:
tally4 = sp._tallies[tally_id]
results2 = np.zeros((tally2._sum.size + tally2._sum.size, ))

View file

@ -23,11 +23,11 @@ results1[0::2] = tally1._sum.ravel()
results1[1::2] = tally1._sum_sq.ravel()
for tally_id in sp._tallies:
if 'CMFD flux, total, scatter-1' in sp._tallies[tally_id]._label:
if 'CMFD flux, total, scatter-1' in sp._tallies[tally_id]._name:
tally2 = sp._tallies[tally_id]
elif 'CMFD neutron production' in sp._tallies[tally_id]._label:
elif 'CMFD neutron production' in sp._tallies[tally_id]._name:
tally3 = sp._tallies[tally_id]
elif 'CMFD surface currents' in sp._tallies[tally_id]._label:
elif 'CMFD surface currents' in sp._tallies[tally_id]._name:
tally4 = sp._tallies[tally_id]
results2 = np.zeros((tally2._sum.size + tally2._sum.size, ))

View file

@ -23,11 +23,11 @@ results1[0::2] = tally1._sum.ravel()
results1[1::2] = tally1._sum_sq.ravel()
for tally_id in sp._tallies:
if 'CMFD flux, total, scatter-1' in sp._tallies[tally_id]._label:
if 'CMFD flux, total, scatter-1' in sp._tallies[tally_id]._name:
tally2 = sp._tallies[tally_id]
elif 'CMFD neutron production' in sp._tallies[tally_id]._label:
elif 'CMFD neutron production' in sp._tallies[tally_id]._name:
tally3 = sp._tallies[tally_id]
elif 'CMFD surface currents' in sp._tallies[tally_id]._label:
elif 'CMFD surface currents' in sp._tallies[tally_id]._name:
tally4 = sp._tallies[tally_id]
results2 = np.zeros((tally2._sum.size + tally2._sum.size, ))