Skip to content

Commit

Permalink
Added Cell Parameter Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
BitterB0NG0 committed Aug 15, 2024
1 parent 5f2f05b commit 225e1b6
Show file tree
Hide file tree
Showing 3 changed files with 415 additions and 45 deletions.
29 changes: 12 additions & 17 deletions src/pymcnp/files/inp/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def cast_cell_keyword(
if string.startswith("*"):
string = string[:1]

if string.startswith(("wwn", "dxc")):
if string.startswith(("wwn", "dxc", "tmp")):
if (
len(string) < 4
and types.cast_fortran_integer(string[:3]) is None
Expand Down Expand Up @@ -373,7 +373,7 @@ def from_mcnp(cls, string: str):
parameter.__class__ = Cell.WeightWindowBounds

# Processing Suffix/Keyword
suffix = types.cast_fortran_integer(tokens.popl())[3:]
suffix = types.cast_fortran_integer(tokens.popl()[3:])
parameter.set_suffix(suffix)

# Processing Value
Expand All @@ -388,7 +388,7 @@ def from_mcnp(cls, string: str):
parameter.__class__ = Cell.DxtranContribution

# Processing Suffix/Keyword
suffix = types.cast_fortran_integer(tokens.popl())[3:]
suffix = types.cast_fortran_integer(tokens.popl()[3:])
parameter.set_suffix(suffix)

# Processing Value
Expand All @@ -412,11 +412,8 @@ def from_mcnp(cls, string: str):
case "pd":
parameter.__class__ = Cell.DetectorContribution

# Processing Keyword
tokens.popl()

# Processing Suffix/Keyword
suffix = types.cast_fortran_integer(tokens.popl())[2:]
suffix = types.cast_fortran_integer(tokens.popl()[2:])
parameter.set_suffix(suffix)

# Processing Value
Expand All @@ -426,11 +423,8 @@ def from_mcnp(cls, string: str):
case "tmp":
parameter.__class__ = Cell.GasThermalTemperature

# Processing Keyword
tokens.popl()

# Processing Suffix/Keyword
suffix = types.cast_fortran_integer(tokens.popl())[2:]
suffix = types.cast_fortran_integer(tokens.popl()[3:])
parameter.set_suffix(suffix)

# Processing Value
Expand Down Expand Up @@ -614,10 +608,10 @@ def __init__(self):

super().__init__()

self.importance: any = None
self.importance: int = None
self.designator: tuple[types.Designator] = None

def set_value(self, value: any) -> None:
def set_value(self, value: int) -> None:
"""
'set_value' sets cell card particle importance parameter values.
Expand Down Expand Up @@ -671,9 +665,9 @@ def __init__(self):

super().__init__()

self.volume: any = None
self.volume: float = None

def set_value(self, value: any) -> None:
def set_value(self, value: float) -> None:
"""
'set_value' sets cell card volume parameter values.
Expand Down Expand Up @@ -711,9 +705,9 @@ def __init__(self):

super().__init__()

self.weight: any = None
self.weight: float = None

def set_value(self, value: any) -> None:
def set_value(self, value: float) -> None:
"""
'set_value' sets cell card proton weight parameter values.
Expand Down Expand Up @@ -1704,6 +1698,7 @@ def from_mcnp(cls, card: str) -> Self:
cell.set_parameters(tuple(parameters))

# Processing Geometry
print(tokens)
cell.geometry = cls.CellGeometry().from_mcnp(" ".join(tokens.deque))

return cell
Expand Down
Loading

0 comments on commit 225e1b6

Please sign in to comment.