@@ -201,6 +201,15 @@ class Settings:
201201 :max_particles: Maximum number of particles to be banked on surfaces per
202202 process (int)
203203 :mcpl: Output in the form of an MCPL-file (bool)
204+ :cell: Cell ID used to determine if particles crossing identified
205+ surfaces are to be banked. Particles coming from or going to this
206+ declared cell will be banked (int)
207+ :cellfrom: Cell ID used to determine if particles crossing identified
208+ surfaces are to be banked. Particles coming from this
209+ declared cell will be banked (int)
210+ :cellto: Cell ID used to determine if particles crossing identified
211+ surfaces are to be banked. Particles going to this declared
212+ cell will be banked (int)
204213 survival_biasing : bool
205214 Indicate whether survival biasing is to be used
206215 tabular_legendre : dict
@@ -693,23 +702,30 @@ def surf_source_write(self) -> dict:
693702
694703 @surf_source_write .setter
695704 def surf_source_write (self , surf_source_write : dict ):
696- cv .check_type (' surface source writing options' , surf_source_write , Mapping )
705+ cv .check_type (" surface source writing options" , surf_source_write , Mapping )
697706 for key , value in surf_source_write .items ():
698- cv .check_value ('surface source writing key' , key ,
699- ('surface_ids' , 'max_particles' , 'mcpl' ))
700- if key == 'surface_ids' :
701- cv .check_type ('surface ids for source banking' , value ,
702- Iterable , Integral )
707+ cv .check_value (
708+ "surface source writing key" ,
709+ key ,
710+ ("surface_ids" , "max_particles" , "mcpl" , "cell" , "cellfrom" , "cellto" ),
711+ )
712+ if key == "surface_ids" :
713+ cv .check_type (
714+ "surface ids for source banking" , value , Iterable , Integral
715+ )
703716 for surf_id in value :
704- cv .check_greater_than ('surface id for source banking' ,
705- surf_id , 0 )
706- elif key == 'max_particles' :
707- cv .check_type ('maximum particle banks on surfaces per process' ,
708- value , Integral )
709- cv .check_greater_than ('maximum particle banks on surfaces per process' ,
710- value , 0 )
711- elif key == 'mcpl' :
712- cv .check_type ('write to an MCPL-format file' , value , bool )
717+ cv .check_greater_than ("surface id for source banking" , surf_id , 0 )
718+ elif key == "mcpl" :
719+ cv .check_type ("write to an MCPL-format file" , value , bool )
720+ elif key in ("max_particles" , "cell" , "cellfrom" , "cellto" ):
721+ name = {
722+ "max_particles" : "maximum particle banks on surfaces per process" ,
723+ "cell" : "Cell ID for source banking (from or to)" ,
724+ "cellfrom" : "Cell ID for source banking (from only)" ,
725+ "cellto" : "Cell ID for source banking (to only)" ,
726+ }[key ]
727+ cv .check_type (name , value , Integral )
728+ cv .check_greater_than (name , value , 0 )
713729
714730 self ._surf_source_write = surf_source_write
715731
@@ -1207,16 +1223,18 @@ def _create_surf_source_read_subelement(self, root):
12071223 def _create_surf_source_write_subelement (self , root ):
12081224 if self ._surf_source_write :
12091225 element = ET .SubElement (root , "surf_source_write" )
1210- if ' surface_ids' in self ._surf_source_write :
1226+ if " surface_ids" in self ._surf_source_write :
12111227 subelement = ET .SubElement (element , "surface_ids" )
1212- subelement .text = ' ' .join (
1213- str (x ) for x in self ._surf_source_write ['surface_ids' ])
1214- if 'max_particles' in self ._surf_source_write :
1215- subelement = ET .SubElement (element , "max_particles" )
1216- subelement .text = str (self ._surf_source_write ['max_particles' ])
1217- if 'mcpl' in self ._surf_source_write :
1228+ subelement .text = " " .join (
1229+ str (x ) for x in self ._surf_source_write ["surface_ids" ]
1230+ )
1231+ if "mcpl" in self ._surf_source_write :
12181232 subelement = ET .SubElement (element , "mcpl" )
1219- subelement .text = str (self ._surf_source_write ['mcpl' ]).lower ()
1233+ subelement .text = str (self ._surf_source_write ["mcpl" ]).lower ()
1234+ for key in ("max_particles" , "cell" , "cellfrom" , "cellto" ):
1235+ if key in self ._surf_source_write :
1236+ subelement = ET .SubElement (element , key )
1237+ subelement .text = str (self ._surf_source_write [key ])
12201238
12211239 def _create_confidence_intervals (self , root ):
12221240 if self ._confidence_intervals is not None :
@@ -1381,9 +1399,9 @@ def _create_create_fission_neutrons_subelement(self, root):
13811399 elem .text = str (self ._create_fission_neutrons ).lower ()
13821400
13831401 def _create_create_delayed_neutrons_subelement (self , root ):
1384- if self ._create_delayed_neutrons is not None :
1385- elem = ET .SubElement (root , "create_delayed_neutrons" )
1386- elem .text = str (self ._create_delayed_neutrons ).lower ()
1402+ if self ._create_delayed_neutrons is not None :
1403+ elem = ET .SubElement (root , "create_delayed_neutrons" )
1404+ elem .text = str (self ._create_delayed_neutrons ).lower ()
13871405
13881406 def _create_delayed_photon_scaling_subelement (self , root ):
13891407 if self ._delayed_photon_scaling is not None :
@@ -1610,17 +1628,18 @@ def _surf_source_read_from_xml_element(self, root):
16101628
16111629 def _surf_source_write_from_xml_element (self , root ):
16121630 elem = root .find ('surf_source_write' )
1613- if elem is not None :
1614- for key in ('surface_ids' , 'max_particles' ,'mcpl' ):
1615- value = get_text (elem , key )
1616- if value is not None :
1617- if key == 'surface_ids' :
1618- value = [int (x ) for x in value .split ()]
1619- elif key in ('max_particles' ):
1620- value = int (value )
1621- elif key == 'mcpl' :
1622- value = value in ('true' , '1' )
1623- self .surf_source_write [key ] = value
1631+ if elem is None :
1632+ return
1633+ for key in ('surface_ids' , 'max_particles' , 'mcpl' , 'cell' , 'cellto' , 'cellfrom' ):
1634+ value = get_text (elem , key )
1635+ if value is not None :
1636+ if key == 'surface_ids' :
1637+ value = [int (x ) for x in value .split ()]
1638+ elif key == 'mcpl' :
1639+ value = value in ('true' , '1' )
1640+ elif key in ('max_particles' , 'cell' , 'cellfrom' , 'cellto' ):
1641+ value = int (value )
1642+ self .surf_source_write [key ] = value
16241643
16251644 def _confidence_intervals_from_xml_element (self , root ):
16261645 text = get_text (root , 'confidence_intervals' )
0 commit comments