Commit 9ccc8650 authored by Patrick Shriwise's avatar Patrick Shriwise
Browse files

Always set 'mesh' and 'input' properties as str. Refactor input concatenation

parent 8894c831
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -42,9 +42,9 @@ class PyGriffin:

        Parameters
        ----------
        input : str or pathlib.Path object
        input : str object
            Griffin input file
        mesh : str or pathlib.Path object
        mesh : str object
            Location of the griffin mesh (either input or exodus)
        cwd : str or  pathlib.Path object
            Directory from which to run Griffin
@@ -127,7 +127,9 @@ class PyGriffin:
        return p.returncode

    def report_materials(self):

        """
        Prints materials assigned and available ISOXML isotopes to screen
        """
        mesh_materials = self.get_material_assignments()
        mat_str = "Materials applied in the Griffin mesh:\n"
        for material, isotopes in mesh_materials.items():
@@ -159,14 +161,16 @@ class PyGriffin:

        return invalid_mats, unused_mats


    def get_material_assignments(self):
        """
        Concatenate all MOOSE inputs and
        """
        # open the mesh and options files
        lines = []
        with open(self.input, 'r') as input:
            lines += input.readlines()
        with open(self.mesh, 'r') as mesh:
            lines += mesh.readlines()
        for file in (self.input, self.mesh):
            if file.endswith('.i'):
                with open(file, 'r') as fh:
                    lines += fh.readlines()

        return parse_moose_materials(lines)

@@ -254,7 +258,7 @@ class PyGriffin:
    @input.setter
    def input(self, input):
        cv.check_type('Griffin input', input, (str, Path))
        self._input = Path(input).absolute()
        self._input = str(Path(input).absolute())

    @property
    def mesh(self):
@@ -263,7 +267,7 @@ class PyGriffin:
    @mesh.setter
    def mesh(self, mesh):
        cv.check_type('Griffin mesh', mesh, (str, Path))
        self._mesh = mesh
        self._mesh = str(mesh)

    @property
    def xs(self):