Exemplo n.º 1
0
    def _export(self, options, dirpath, errors):
        casfile = File()

        # Load template (from geometry)
        fileobj = self._get_sim_template(options.sample, errors)
        if fileobj is None:
            return
        casfile.readFromFileObject(fileobj)

        # Run exporters
        simdata = casfile.getOptionSimulationData()
        simops = simdata.getSimulationOptions()
        self._run_exporters(options, errors, simdata, simops)

        # Write to disk
        filepath = os.path.join(dirpath, self.DEFAULT_SIM_FILENAME)
        casfile.write(filepath)
Exemplo n.º 2
0
    async def _export(self, options, dirpath, erracc, dry_run=False):
        casfile = File()

        # Load template (from geometry)
        fileobj = self._get_sim_template(options.sample, erracc)
        if fileobj is not None:
            casfile.readFromFileObject(fileobj)

        # Run exporters
        simdata = casfile.getOptionSimulationData()
        simops = simdata.getSimulationOptions()
        if simdata is None or simops is None:
            erracc.add_exception(IOError("Could not open .sim template file"))

        self._run_exporters(options, erracc, simdata, simops)

        # Write to disk
        if not dry_run:
            filepath = os.path.join(dirpath, self.DEFAULT_SIM_FILENAME)
            casfile.write(filepath)