Ejemplo n.º 1
0
 def solve(self, component_id=1) -> bool:
     cid = c_int(component_id)
     has_converged = c_int(0)
     with cd(self.working_directory):
         self.execute_function(self.lib.solve, byref(cid),
                               byref(has_converged))
     return has_converged.value == 1
Ejemplo n.º 2
0
 def finalize(self) -> None:
     if self._state == State.INITIALIZED:
         with cd(self.working_directory):
             self.execute_function(self.lib.finalize)
             self._state = State.UNINITIALIZED
     else:
         raise InputError("The library is not initialized yet")
Ejemplo n.º 3
0
 def initialize(self, config_file: str = "") -> None:
     if self._state == State.UNINITIALIZED:
         with cd(self.working_directory):
             self.execute_function(self.lib.initialize, config_file)
             self._state = State.INITIALIZED
     else:
         raise InputError("The library is already initialized")
Ejemplo n.º 4
0
    def finalize_solve(self, component_id=1) -> None:
        cid = c_int(component_id)

        with cd(self.working_directory):
            self.execute_function(self.lib.finalize_solve, byref(cid))
Ejemplo n.º 5
0
 def finalize_time_step(self) -> None:
     with cd(self.working_directory):
         self.execute_function(self.lib.finalize_time_step)
Ejemplo n.º 6
0
 def prepare_time_step(self, dt) -> None:
     with cd(self.working_directory):
         dt = c_double(dt)
         self.execute_function(self.lib.prepare_time_step, byref(dt))
Ejemplo n.º 7
0
 def update(self) -> None:
     with cd(self.working_directory):
         self.execute_function(self.lib.update)