Skip to content

Commit c19f193

Browse files
committed
inp/cell_options: updated trcl and fill forms
1 parent 4d6a833 commit c19f193

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+870
-115
lines changed

scripts/build_cell_options.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ def build_CellOption(cell_option: _data.CellOptionScheme):
1717
o += '\n'
1818
o += 'from ..cell_option import CellOption\n'
1919
o += 'from ..cell_keyword import CellKeyword\n'
20-
o += 'from ...utils import types, errors, _parser\n'
20+
o += 'from ...utils import types\n'
21+
o += 'from ...utils import errors\n'
22+
o += 'from ...utils import _parser\n'
2123
o += '\n'
2224
o += f'class {cell_option.name}(CellOption):\n'
2325
o += ' """\n'

scripts/build_data.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def build_DataEntry(entry: _data.DataEntryScheme):
2121
o += ' Attributes:\n'
2222

2323
for attribute in entry.attributes:
24-
o += f' {attribute.name}: {attribute.description}.\n'
24+
o += f' {attribute.name}: {attribute.description}.\n'
2525

2626
o += ' """\n'
2727
o += '\n'
@@ -35,7 +35,7 @@ def build_DataEntry(entry: _data.DataEntryScheme):
3535
o += ' Parameters:\n'
3636

3737
for attribute in entry.attributes:
38-
o += f' {attribute.name}: {attribute.description}.\n'
38+
o += f' {attribute.name}: {attribute.description}.\n'
3939

4040
o += '\n'
4141
o += ' Raises:\n'
@@ -325,7 +325,9 @@ def build_Data(data: _data.DataScheme):
325325
o += 'from ..data_entry import DataEntry\n' if data.entries else ''
326326
o += 'from ..data_option import DataOption\n' if data.options else ''
327327
o += 'from ..data_keyword import DataKeyword\n' if data.options else ''
328-
o += 'from ...utils import types, errors, _parser\n'
328+
o += 'from ...utils import types\n'
329+
o += 'from ...utils import errors\n'
330+
o += 'from ...utils import _parser\n'
329331
o += '\n'
330332

331333
# DATA.ENTRY

scripts/build_surfaces.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def build_Surface(surface: _data.SurfaceScheme):
1616
o += '\n'
1717
o += 'from ..surface import Surface\n'
1818
o += 'from ..surface_mnemonic import SurfaceMnemonic\n'
19-
o += 'from ...utils import types, errors, _parser\n'
19+
o += 'from ...utils import types\n'
20+
o += 'from ...utils import errors\n'
21+
o += 'from ...utils import _parser\n'
2022
o += '\n'
2123
o += f'class {surface.name}(Surface):\n'
2224
o += ' """\n'

src/pymcnp/files/inp/__init__.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .cell_geometry import CellGeometry
55
from .cell_keyword import CellKeyword
66
from .cell_option import CellOption
7+
from .cell_entry import CellEntry
78
from .cell_options import Imp as CellImp
89
from .cell_options import Vol as CellVol
910
from .cell_options import Pwt as CellPwt
@@ -15,9 +16,13 @@
1516
from .cell_options import Pd as CellPd
1617
from .cell_options import Tmp as CellTmp
1718
from .cell_options import U as CellU
18-
from .cell_options import Trcl as CellTrcl
19+
from .cell_options import TrclEntry as CellTrclEntry
20+
from .cell_options import Trcl_Form1 as CellTrcl_Form1
21+
from .cell_options import Trcl_Form2 as CellTrcl_Form2
1922
from .cell_options import Lat as CellLat
20-
from .cell_options import Fill as CellFill
23+
from .cell_options import FillEntry as CellFillEntry
24+
from .cell_options import Fill_Form1 as CellFill_Form1
25+
from .cell_options import Fill_Form2 as CellFill_Form2
2126
from .cell_options import Elpt as CellElpt
2227
from .cell_options import Cosy as CellCosy
2328
from .cell_options import Bflcl as CellBflcl
@@ -126,6 +131,7 @@
126131
'CellKeyword',
127132
'CellGeometry',
128133
'CellOption',
134+
'CellEntry',
129135
'CellImp',
130136
'CellVol',
131137
'CellPwt',
@@ -137,9 +143,13 @@
137143
'CellPd',
138144
'CellTmp',
139145
'CellU',
140-
'CellTrcl',
146+
'CellTrclEntry',
147+
'CellTrcl_Form1',
148+
'CellTrcl_Form2',
141149
'CellLat',
142-
'CellFill',
150+
'CellFillEntry',
151+
'CellFill_Form1',
152+
'CellFill_Form2',
143153
'CellElpt',
144154
'CellCosy',
145155
'CellBflcl',

src/pymcnp/files/inp/cell.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
from .cell_options import Pd
2121
from .cell_options import Tmp
2222
from .cell_options import U
23-
from .cell_options import Trcl
23+
from .cell_options import Trcl_Form1
24+
from .cell_options import Trcl_Form2
2425
from .cell_options import Lat
25-
from .cell_options import Fill
26+
from .cell_options import Fill_Form1
27+
from .cell_options import Fill_Form2
2628
from .cell_options import Elpt
2729
from .cell_options import Cosy
2830
from .cell_options import Bflcl
@@ -176,11 +178,17 @@ def from_mcnp(source: str):
176178
case 'u':
177179
options['u'] = U.from_mcnp(f'{keyword}{value}')
178180
case 'trcl':
179-
options['trcl'] = Trcl.from_mcnp(f'{keyword}{value}')
181+
if ' ' in value:
182+
options['trcl'] = Trcl_Form2.from_mcnp(f'{keyword}{value}')
183+
else:
184+
options['trcl'] = Trcl_Form1.from_mcnp(f'{keyword}{value}')
180185
case 'lat':
181186
options['lat'] = Lat.from_mcnp(f'{keyword}{value}')
182187
case 'fill':
183-
options['fill'] = Fill.from_mcnp(f'{keyword}{value}')
188+
if ':' in value:
189+
options['fill'] = Fill_Form2.from_mcnp(f'{keyword}{value}')
190+
else:
191+
options['fill'] = Fill_Form1.from_mcnp(f'{keyword}{value}')
184192
case 'elpt':
185193
options['elpt'] = Elpt.from_mcnp(f'{keyword}{value}')
186194
case 'cosy':

src/pymcnp/files/inp/cell_entry.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Contains classes representing INP cell card option entries.
3+
"""
4+
5+
from . import _card
6+
7+
8+
class CellEntry(_card.CardEntry):
9+
"""
10+
Represents INP cell card option entry.
11+
12+
``CellEntry`` extends the ``_card.CardEntry`` abstract class.
13+
"""
14+
15+
@staticmethod
16+
def from_mcnp(source: str):
17+
raise NotImplementedError

src/pymcnp/files/inp/cell_options/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
from .pd import Pd
1010
from .tmp import Tmp
1111
from .u import U
12-
from .trcl import Trcl
12+
from .trcl import TrclEntry
13+
from .trcl import Trcl_Form1
14+
from .trcl import Trcl_Form2
1315
from .lat import Lat
14-
from .fill import Fill
16+
from .fill import FillEntry
17+
from .fill import Fill_Form1
18+
from .fill import Fill_Form2
1519
from .elpt import Elpt
1620
from .cosy import Cosy
1721
from .bflcl import Bflcl
@@ -29,9 +33,13 @@
2933
'Pd',
3034
'Tmp',
3135
'U',
32-
'Trcl',
36+
'TrclEntry',
37+
'Trcl_Form1',
38+
'Trcl_Form2',
3339
'Lat',
34-
'Fill',
40+
'FillEntry',
41+
'Fill_Form1',
42+
'Fill_Form2',
3543
'Elpt',
3644
'Cosy',
3745
'Bflcl',

src/pymcnp/files/inp/cell_options/bflcl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
from ..cell_option import CellOption
99
from ..cell_keyword import CellKeyword
10-
from ...utils import types, errors, _parser
10+
from ...utils import types
11+
from ...utils import errors
12+
from ...utils import _parser
1113

1214

1315
class Bflcl(CellOption):

src/pymcnp/files/inp/cell_options/cosy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
from ..cell_option import CellOption
99
from ..cell_keyword import CellKeyword
10-
from ...utils import types, errors, _parser
10+
from ...utils import types
11+
from ...utils import errors
12+
from ...utils import _parser
1113

1214

1315
class Cosy(CellOption):

src/pymcnp/files/inp/cell_options/dxc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
from ..cell_option import CellOption
99
from ..cell_keyword import CellKeyword
10-
from ...utils import types, errors, _parser
10+
from ...utils import types
11+
from ...utils import errors
12+
from ...utils import _parser
1113

1214

1315
class Dxc(CellOption):

0 commit comments

Comments
 (0)