Skip to content

Commit

Permalink
files/inp: replaced cadquery with pyvista
Browse files Browse the repository at this point in the history
  • Loading branch information
BitterB0NG0 committed Nov 30, 2024
1 parent c28c379 commit 08b0cf5
Show file tree
Hide file tree
Showing 44 changed files with 1,354 additions and 426 deletions.
2 changes: 2 additions & 0 deletions src/pymcnp/files/inp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
from .surface_cards import Trc as SurfaceTrc
from .surface_cards import Ell as SurfaceEll
from .surface_cards import Wed as SurfaceWed
from .surface_cards import Arb as SurfaceArb
from .data import Data
from .data_mnemonic import DataMnemonic
from .data_entry import DataEntry
Expand Down Expand Up @@ -183,6 +184,7 @@
'SurfaceTrc',
'SurfaceEll',
'SurfaceWed',
'SurfaceArb',
'Data',
'DataMnemonic',
'DataEntry',
Expand Down
317 changes: 0 additions & 317 deletions src/pymcnp/files/inp/_cadquery.py

This file was deleted.

19 changes: 18 additions & 1 deletion src/pymcnp/files/inp/inp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"""

import re
import pathlib
from typing import Final

import pathlib
import pyvista

from .comment import Comment
from .cell import Cell
Expand Down Expand Up @@ -104,6 +105,7 @@
from ..utils import errors
from ..utils import _parser
from ..utils import _object
from ..utils import _visualization


class Inp(_object.PyMcnpFileObject):
Expand Down Expand Up @@ -726,3 +728,18 @@ def to_mcnp_file(self, filename: str | pathlib.Path):

filename = pathlib.Path(filename)
filename.write_text(self.to_mcnp())

def to_pyvista(self) -> pyvista.PolyData:
"""
Generates ``pyvista.PolyData`` representing ``Inp``.
Returns:
``pyvista.PolyData`` for ``Inp``.
"""

vis = _visualization.PyMcnpVisualization()

for surface in self.surfaces.values():
vis += _visualization.PyMcnpVisualization(surface.to_pyvista())

return vis.data
3 changes: 3 additions & 0 deletions src/pymcnp/files/inp/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ def to_mcnp(self) -> str:
source = f'{number_str} {transform_str} {self.mnemonic.to_mcnp()} {parameter_str}'

return _parser.Postprocessor.add_continuation_lines(source)

def to_pyvista(self):
raise NotImplementedError
Loading

0 comments on commit 08b0cf5

Please sign in to comment.