mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Declare the recorded MGXS generation method in Settings.__init__
Initializing _mgxs_generation_method to None makes it a declared private attribute rather than one added dynamically outside __init__, and lets convert_to_multigroup access it directly (type-checking settings first). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
550fe2b11a
commit
37d15f655b
2 changed files with 9 additions and 2 deletions
|
|
@ -2773,7 +2773,10 @@ class Model:
|
|||
# mgxs_generation_settings) is used, defaulting to "material_wise".
|
||||
# Conflicting specifications are rejected, since the generation
|
||||
# defaults differ by method.
|
||||
settings_method = getattr(settings, '_mgxs_generation_method', None)
|
||||
if settings is not None:
|
||||
check_type('settings', settings, openmc.Settings)
|
||||
settings_method = (settings._mgxs_generation_method
|
||||
if settings is not None else None)
|
||||
if method is None:
|
||||
method = settings_method or 'material_wise'
|
||||
elif settings_method is not None and method != settings_method:
|
||||
|
|
@ -2817,7 +2820,6 @@ class Model:
|
|||
if temperature_settings is not None:
|
||||
settings.temperature = temperature_settings
|
||||
else:
|
||||
check_type('settings', settings, openmc.Settings)
|
||||
# batches and particles are required for any OpenMC transport
|
||||
# run; catch their absence here so a hand-built settings object
|
||||
# fails with a pointer to the defaults rather than a mysterious
|
||||
|
|
|
|||
|
|
@ -501,6 +501,11 @@ class Settings:
|
|||
|
||||
self._random_ray = {}
|
||||
|
||||
# MGXS generation method recorded by Model.mgxs_generation_settings()
|
||||
# and read back by Model.convert_to_multigroup; provenance only, not
|
||||
# written to XML
|
||||
self._mgxs_generation_method = None
|
||||
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue