Skip to content

Commit

Permalink
inp/data_cards: added data card subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
BitterB0NG0 committed Jan 14, 2025
1 parent 3e98283 commit f5cb297
Show file tree
Hide file tree
Showing 104 changed files with 8,122 additions and 819 deletions.
1,418 changes: 1,338 additions & 80 deletions scripts/_data.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions scripts/build_cell_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def build_CellOption(cell_option: _data.CellOptionScheme):
init_imports.append(f'from .{cell_option.name.lower()} import {cell_option.name}')
init_all.append(f'"{cell_option.name}",')

init_path = pathlib.Path(__file__).parent / pathlib.Path(
'../src/pymcnp/files/inp/cell_options/__init__.py'
)
with init_path.open('w') as file:
file.write(
'\n'.join(init_imports) + '\n\n__all__ = [\n ' + '\n '.join(init_all) + '\n]\n'
)
# init_path = pathlib.Path(__file__).parent / pathlib.Path(
# '../src/pymcnp/files/inp/cell_options/__init__.py'
# )
# with init_path.open('w') as file:
# file.write(
# '\n'.join(init_imports) + '\n\n__all__ = [\n ' + '\n '.join(init_all) + '\n]\n'
# )
2 changes: 1 addition & 1 deletion scripts/build_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def build_Data(data: _data.DataScheme):

if 'suffix' in attribute_names and 'designator' in attribute_names:
o += ' return _parser.Postprocessor.add_continuation_lines(f"{self.mnemonic.to_mcnp()}{self.suffix.to_mcnp()}:{self.designator.to_mcnp()}'
if 'designator' in attribute_names:
elif 'designator' in attribute_names:
o += ' return _parser.Postprocessor.add_continuation_lines(f"{self.mnemonic.to_mcnp()}:{self.designator.to_mcnp()}'
elif 'suffix' in attribute_names:
o += ' return _parser.Postprocessor.add_continuation_lines(f"{self.mnemonic.to_mcnp()}{self.suffix.to_mcnp()}'
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/bflcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class Bflcl(CellOption):
``Bflcl`` implements ``_card.CardOption``.
Attributes:
number: Cell magnetic field number.
number: Cell magnetic field number
"""

def __init__(self, number: types.McnpInteger):
"""
Initializes ``Bflcl``.
Parameters:
number: Cell magnetic field number.
number: Cell magnetic field number
Raises:
McnpError: INVALID_CELL_OPTION_VALUE.
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/cosy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class Cosy(CellOption):
``Cosy`` implements ``_card.CardOption``.
Attributes:
number: Cell cosy map number.
number: Cell cosy map number
"""

def __init__(self, number: types.McnpInteger):
"""
Initializes ``Cosy``.
Parameters:
number: Cell cosy map number.
number: Cell cosy map number
Raises:
McnpError: INVALID_CELL_OPTION_VALUE.
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/dxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Dxc(CellOption):
``Dxc`` implements ``_card.CardOption``.
Attributes:
probability: Cell probability of DXTRAN contribution.
probability: Cell probability of DXTRAN contribution
suffix: Cell option suffix
designator: Cell option particle designator
"""
Expand All @@ -31,7 +31,7 @@ def __init__(
Initializes ``Dxc``.
Parameters:
probability: Cell probability of DXTRAN contribution.
probability: Cell probability of DXTRAN contribution
suffix: Cell option suffix
designator: Cell option particle designator
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/elpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Elpt(CellOption):
``Elpt`` implements ``_card.CardOption``.
Attributes:
cutoff: Cell energy cutoff.
cutoff: Cell energy cutoff
designator: Cell option particle designator
"""

Expand All @@ -28,7 +28,7 @@ def __init__(self, cutoff: types.McnpReal, designator: types.Designator):
Initializes ``Elpt``.
Parameters:
cutoff: Cell energy cutoff.
cutoff: Cell energy cutoff
designator: Cell option particle designator
Raises:
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/fcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Fcl(CellOption):
``Fcl`` implements ``_card.CardOption``.
Attributes:
control: Cell forced-collision control.
control: Cell forced-collision control
designator: Cell option particle designator
"""

Expand All @@ -28,7 +28,7 @@ def __init__(self, control: types.McnpReal, designator: types.Designator):
Initializes ``Fcl``.
Parameters:
control: Cell forced-collision control.
control: Cell forced-collision control
designator: Cell option particle designator
Raises:
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/lat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class Lat(CellOption):
``Lat`` implements ``_card.CardOption``.
Attributes:
shape: Cell lattice shape.
shape: Cell lattice shape
"""

def __init__(self, shape: types.McnpInteger):
"""
Initializes ``Lat``.
Parameters:
shape: Cell lattice shape.
shape: Cell lattice shape
Raises:
McnpError: INVALID_CELL_OPTION_VALUE.
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/nonu.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class Nonu(CellOption):
``Nonu`` implements ``_card.CardOption``.
Attributes:
setting: Cell fission setting.
setting: Cell fission setting
"""

def __init__(self, setting: types.McnpInteger):
"""
Initializes ``Nonu``.
Parameters:
setting: Cell fission setting.
setting: Cell fission setting
Raises:
McnpError: INVALID_CELL_OPTION_VALUE.
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/pd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Pd(CellOption):
``Pd`` implements ``_card.CardOption``.
Attributes:
probability: Cell probability of DXTRAN contribution.
probability: Cell probability of DXTRAN contribution
suffix: Cell option suffix
"""

Expand All @@ -28,7 +28,7 @@ def __init__(self, probability: types.McnpReal, suffix: types.McnpInteger):
Initializes ``Pd``.
Parameters:
probability: Cell probability of DXTRAN contribution.
probability: Cell probability of DXTRAN contribution
suffix: Cell option suffix
Raises:
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/tmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Tmp(CellOption):
``Tmp`` implements ``_card.CardOption``.
Attributes:
temperature: Cell temperature at suffix time index.
temperature: Cell temperature at suffix time index
suffix: Cell option suffix
"""

Expand All @@ -28,7 +28,7 @@ def __init__(self, temperature: types.McnpReal, suffix: types.McnpInteger):
Initializes ``Tmp``.
Parameters:
temperature: Cell temperature at suffix time index.
temperature: Cell temperature at suffix time index
suffix: Cell option suffix
Raises:
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/u.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class U(CellOption):
``U`` implements ``_card.CardOption``.
Attributes:
number: Cell universe number.
number: Cell universe number
"""

def __init__(self, number: types.McnpInteger):
"""
Initializes ``U``.
Parameters:
number: Cell universe number.
number: Cell universe number
Raises:
McnpError: INVALID_CELL_OPTION_VALUE.
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/unc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Unc(CellOption):
``Unc`` implements ``_card.CardOption``.
Attributes:
setting: Cell uncollided secondaries setting.
setting: Cell uncollided secondaries setting
designator: Cell option particle designator
"""

Expand All @@ -28,7 +28,7 @@ def __init__(self, setting: types.McnpInteger, designator: types.Designator):
Initializes ``Unc``.
Parameters:
setting: Cell uncollided secondaries setting.
setting: Cell uncollided secondaries setting
designator: Cell option particle designator
Raises:
Expand Down
4 changes: 2 additions & 2 deletions src/pymcnp/files/inp/cell_options/wwn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Wwn(CellOption):
``Wwn`` implements ``_card.CardOption``.
Attributes:
bound: Cell weight-window space, time, or energy lower bound.
bound: Cell weight-window space, time, or energy lower bound
suffix: Cell option suffix
designator: Cell option particle designator
"""
Expand All @@ -31,7 +31,7 @@ def __init__(
Initializes ``Wwn``.
Parameters:
bound: Cell weight-window space, time, or energy lower bound.
bound: Cell weight-window space, time, or energy lower bound
suffix: Cell option suffix
designator: Cell option particle designator
Expand Down
65 changes: 65 additions & 0 deletions src/pymcnp/files/inp/data_cards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,40 @@
from .ksrc import Ksrc
from .kopts import Kopts
from .hsrc import Hsrc
from .fc import Fc
from .fq import Fq
from .em import Em
from .tm import Tm
from .cm import Cm
from .cf import Cf
from .sf import Sf
from .pert import Pert
from .kpert import Kpert
from .ksen import Ksen
from .dose import Dose
from .imp import Imp
from .var import Var
from .wwe import Wwe
from .wwt import Wwt
from .wwn import Wwn
from .wwp import Wwp
from .wwge import Wwge
from .wwgt import Wwgt
from .mesh import Mesh
from .ext import Ext
from .fcl import Fcl
from .pd import Pd
from .dxc import Dxc
from .bbrem import Bbrem
from .pwt import Pwt
from .nps import Nps
from .ctme import Ctme
from .prdmp import Prdmp
from .ptrac import Ptrac
from .rand import Rand
from .lost import Lost
from .idum import Idum
from .rdum import Rdum

__all__ = [
'Area',
Expand Down Expand Up @@ -98,6 +130,39 @@
'Ksrc',
'Kopts',
'Hsrc',
'Fc',
'Fq',
'Em',
'Tm',
'Cm',
'Cf',
'Sf',
'Pert',
'Kpert',
'Ksen',
'Dose',
'Imp',
'Var',
'Wwe',
'Wwt',
'Wwn',
'Wwp',
'Wwge',
'Wwgt',
'Mesh',
'Ext',
'Ext',
'Fcl',
'Pd',
'Dxc',
'Bbrem',
'Pwt',
'Nps',
'Ctme',
'Prdmp',
'Ptrac',
'Rand',
'Lost',
'Idum',
'Rdum',
]
8 changes: 4 additions & 4 deletions src/pymcnp/files/inp/data_cards/awtab.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class AwtabEntry(DataEntry):
``AwtabEntry`` implements ``DataEntry``.
Attributes:
zaid: Zaid alias for nuclide.
weight_ratio: Atomic weight ratios.
zaid: Zaid alias for nuclide.
weight_ratio: Atomic weight ratios.
"""

def __init__(self, zaid: types.Zaid, weight_ratio: types.McnpReal):
"""
Initializes ``AwtabEntry``.
Parameters:
zaid: Zaid alias for nuclide.
weight_ratio: Atomic weight ratios.
zaid: Zaid alias for nuclide.
weight_ratio: Atomic weight ratios.
Raises:
McnpError: INVALID_DATA_ENTRY_PARAMETER.
Expand Down
Loading

0 comments on commit f5cb297

Please sign in to comment.