Esempio 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
Esempio 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")
Esempio 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")
Esempio 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))
Esempio n. 5
0
 def finalize_time_step(self) -> None:
     with cd(self.working_directory):
         self.execute_function(self.lib.finalize_time_step)
Esempio 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))
Esempio n. 7
0
 def update(self) -> None:
     with cd(self.working_directory):
         self.execute_function(self.lib.update)