diff --git a/openmc/cell.py b/openmc/cell.py index 033972a38c..8dd97c0fcf 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -103,7 +103,7 @@ class Cell(object): self._rotation_matrix = None self._temperature = None self._translation = None - self._paths = [] + self._paths = None self._num_instances = None self._volume = None self._atoms = None @@ -215,7 +215,7 @@ class Cell(object): @property def paths(self): - if not self._paths: + if self._paths is None: raise ValueError('Cell instance paths have not been determined. ' 'Call the Geometry.determine_paths() method.') return self._paths @@ -230,6 +230,10 @@ class Cell(object): @property def num_instances(self): + if self._num_instances is None: + raise ValueError( + 'Number of cell instances have not been determined. Call the ' + 'Geometry.determine_paths() method.') return self._num_instances @id.setter diff --git a/openmc/geometry.py b/openmc/geometry.py index 642b3ce96c..860d3028ff 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -491,7 +491,7 @@ class Geometry(object): Parameters ---------- - instances_only : bool + instances_only : bool, optional If true, this method will only determine the number of instances of each cell and material. diff --git a/openmc/material.py b/openmc/material.py index f4c30da81d..da415ec680 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -97,7 +97,7 @@ class Material(object): self._density = None self._density_units = '' self._depletable = False - self._paths = [] + self._paths = None self._num_instances = None self._volume = None self._atoms = {} @@ -210,13 +210,17 @@ class Material(object): @property def paths(self): - if not self._paths: + if self._paths is None: raise ValueError('Material instance paths have not been determined. ' 'Call the Geometry.determine_paths() method.') return self._paths @property def num_instances(self): + if self._num_instances is None: + raise ValueError( + 'Number of material instances have not been determined. Call ' + 'the Geometry.determine_paths() method.') return self._num_instances @property