@@ -25,30 +25,35 @@ def __init__(self, name: str):
2525 self ._read_metadata ()
2626
2727 @abstractmethod
28- def build_materials (self ):
28+ def _build_materials (self ):
2929 """Build materials for the benchmark."""
3030 pass
3131
3232 @abstractmethod
33- def build_geometry (self ):
33+ def _build_geometry (self ):
3434 """Build geometry for the benchmark."""
3535 pass
3636
3737 @abstractmethod
38- def build_source (self ):
38+ def _build_source (self ):
3939 """Build source for the benchmark."""
4040 pass
4141
4242 @abstractmethod
43- def build_settings (self ):
43+ def _build_settings (self ):
4444 """Build settings for the benchmark."""
4545 pass
4646
4747 @abstractmethod
48- def build_tallies (self ):
48+ def _build_tallies (self ):
4949 """Build tallies for the benchmark."""
5050 pass
5151
52+ @abstractmethod
53+ def _build_model (self ):
54+ """Build the whole model for the benchmark."""
55+ pass
56+
5257 def _read_metadata (self ):
5358 """Read metadata from the benchmark specification."""
5459 metadata = self ._benchmark_spec ['metadata' ]
@@ -108,7 +113,9 @@ def __init__(self, name: str):
108113 self ._settings = None
109114 self ._tallies = None
110115
111- def build_materials (self ):
116+ self .model = self ._build_model ()
117+
118+ def _build_materials (self ):
112119 # Implement the logic to build materials for OpenMC
113120 material_data = self ._benchmark_spec ['materials' ]
114121
@@ -135,7 +142,7 @@ def build_materials(self):
135142
136143 return materials
137144
138- def build_geometry (self ):
145+ def _build_geometry (self ):
139146
140147 def build_mesh (cad_file : str , material_tags , set_size : dict , global_mesh_size_min : float , global_mesh_size_max : float , mesh_file : str = "mesh.h5m" ):
141148
@@ -181,7 +188,7 @@ def build_mesh(cad_file: str, material_tags, set_size: dict, global_mesh_size_mi
181188
182189 return openmc .Geometry (root = dag_universe )
183190
184- def build_source (self ):
191+ def _build_source (self ):
185192 source_data = self ._benchmark_spec ['sources' ]
186193
187194 def energy_conversion (values , units ):
@@ -296,7 +303,7 @@ def angular_conversion(values, units):
296303
297304 return source
298305
299- def build_tallies (self ):
306+ def _build_tallies (self ):
300307 tallies_data = self ._benchmark_spec ['tallies' ]
301308
302309 # Initialize openmc tallies
@@ -333,7 +340,7 @@ def build_tallies(self):
333340
334341 return tallies
335342
336- def build_settings (self ):
343+ def _build_settings (self ):
337344 settings_data = self ._benchmark_spec ['settings' ]
338345
339346 settings = openmc .Settings ()
@@ -353,3 +360,16 @@ def build_settings(self):
353360 settings .source = source
354361
355362 return settings
363+
364+ def _build_model (self ):
365+ materials = self ._build_materials ()
366+ geometry = self ._build_geometry ()
367+ settings = self ._build_settings ()
368+ tallies = self ._build_tallies ()
369+ model = openmc .Model (
370+ materials = materials ,
371+ geometry = geometry ,
372+ settings = settings ,
373+ tallies = tallies
374+ )
375+ return model
0 commit comments