Example #1
0
    def __init__(self, model: Model = None, output_directory: str = None, delete_directory: bool = True, resume=None, variable: bool = False):
        if model is None:
            raise gillespyError.SimulationError("A model is required to run the simulation.")

        if len(BuildEngine.get_missing_dependencies()) > 0:
            raise gillespyError.SimulationError(
                "Please install/configure 'g++' and 'make' on your system, to ensure that GillesPy2 C solvers will run properly."
            )

        if platform.system() == "Windows" and " " in gillespy2.__file__:
            raise gillespy2Error.SimulationError("GillesPy2 does not support spaces in its path on Windows systems.")

        self.delete_directory = False
        self.model = copy.deepcopy(model)
        self.resume = resume
        self.variable = variable
        self.build_engine: BuildEngine = None

        # Validate output_directory, ensure that it doesn't already exist
        if isinstance(output_directory, str):
            output_directory = os.path.abspath(output_directory)

            if os.path.exists(output_directory):
                raise gillespyError.DirectoryError(
                    f"Could not write to specified output directory: {output_directory}"
                    " (already exists)"
                )
        self.output_directory = output_directory
        self.delete_directory = delete_directory

        if self.model is not None:
            self._set_model()

        self.is_instantiated = True
Example #2
0
def check_cpp_support():
    return not len(BuildEngine.get_missing_dependencies()) > 0
Example #3
0
 def test_check_cpp_support(self):
     self.assertEqual(not len(BuildEngine.get_missing_dependencies()),
                      self.old_check_cpp_support())