Skip to content

Drivers

Driver ¤

Bases: ABC

Initialises the main objects of the program and triggers the simulation

Source code in feniax/drivers/driver.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class Driver(ABC):
    """ Initialises the main objects of the program and triggers the simulation

    """
    @abstractmethod
    def _set_simulation(self):
        """Initialise the simulation object

        """
        pass

    @abstractmethod
    def _set_systems(self):
        """Initialise the system of equations objects

        """
        pass

    @abstractmethod
    def pre_simulation(self):
        """Run any computation pre-simulation

        """

        pass

    @abstractmethod
    def run_cases(self):
        """Trigger the simulations

        """
        pass

    @abstractmethod
    def post_simulation(self):
        """Run any computation post-simulation

        For instance the forager pattern that launches other programs

        """

        pass

    def __init_subclass__(cls, **kwargs):
        assert "cls_name" in kwargs
        super().__init_subclass__()
        if kwargs["cls_name"] in __DRIVER_DICT__:
            raise ValueError("Name %s already registered!" % kwargs["cls_name"])
        __DRIVER_DICT__[kwargs["cls_name"]] = cls

post_simulation() abstractmethod ¤

Run any computation post-simulation

For instance the forager pattern that launches other programs

Source code in feniax/drivers/driver.py
39
40
41
42
43
44
45
46
47
@abstractmethod
def post_simulation(self):
    """Run any computation post-simulation

    For instance the forager pattern that launches other programs

    """

    pass

pre_simulation() abstractmethod ¤

Run any computation pre-simulation

Source code in feniax/drivers/driver.py
24
25
26
27
28
29
30
@abstractmethod
def pre_simulation(self):
    """Run any computation pre-simulation

    """

    pass

run_cases() abstractmethod ¤

Trigger the simulations

Source code in feniax/drivers/driver.py
32
33
34
35
36
37
@abstractmethod
def run_cases(self):
    """Trigger the simulations

    """
    pass