From cfe1f1dfcd420bc235432c3edef5848e45f6076f Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 18 Nov 2015 11:10:31 -0500 Subject: [PATCH] Added check to MGXS Library domains setter to compare with domains in geometry --- openmc/mgxs/library.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index ee9ffc4fa3..9def79eeb2 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -240,15 +240,24 @@ class Library(object): else: if self.domain_type == 'material': cv.check_iterable_type('domain', domains, openmc.Material) + all_domains = self.openmc_geometry.get_all_materials() elif self.domain_type in ['cell', 'distribcell']: cv.check_iterable_type('domain', domains, openmc.Cell) + all_domains = self.openmc_geometry.get_all_material_cells() elif self.domain_type == 'universe': cv.check_iterable_type('domain', domains, openmc.Universe) + all_domains = self.openmc_geometry.get_all_universes() else: msg = 'Unable to set domains with ' \ 'domain type "{}"'.format(self.domain_type) raise ValueError(msg) + # Check that each domain can be found in the geometry + for domain in domains: + if domain not in all_domains: + msg = 'Domain "{}" could not be found in the geometry' + raise ValueError(msg) + self._domains = domains @correction.setter