Commit 1df5dc64 authored by Patrick Shriwise's avatar Patrick Shriwise
Browse files

Overwrite isoxml file if already present

parent 06339e49
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ class PyGriffin:
        p.wait()
        return p.returncode

    def process_xs(self, overwrite=False, particle='neutron', cwd=None):
    def process_xs(self, overwrite=True, particle='neutron', cwd=None):
        """
        Runs ISOXML on the current set of cross sections

@@ -148,16 +148,21 @@ class PyGriffin:
            "doesn't exist: {}".format(cwd))
            raise ValueError(msg)

        # run isoxml executable on the current xs file
        cmd = [str(self.config.isoxml_exec), p_flag, str(self.xs)]
        p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd))
        p.wait()

        # construct the name of the new xs file and return it
        name_parts = str(self.xs).split('.')
        name_parts[-1] = 'xml'
        xs_name = '.'.join(name_parts)

        xs_path = cwd / Path(xs_name)
        if overwrite and xs_path.exists():
            warnings.warn("ISOXML output file already exists. Removing...")
            os.remove(xs_path)
        
        # run isoxml executable on the current xs file
        cmd = [str(self.config.isoxml_exec), p_flag, str(self.xs)]
        p = subprocess.Popen(cmd, universal_newlines=True, cwd=str(cwd))
        p.wait()
        
        return xs_name

    def generate_mesh(self, overwrite=False):