Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
schmoelder committed Dec 12, 2024
1 parent a495d23 commit ad35d65
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 117 deletions.
31 changes: 16 additions & 15 deletions cadet/cadet.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,55 +474,56 @@ def inverse_transform(self, x: str) -> str:
"""
return str.lower(x)

def run(
def run_load(
self,
timeout: Optional[int] = None,
clear: bool = True
) -> ReturnInformation:
"""
Run the CADET simulation.
Run the CADET simulation and load the results.
Parameters
----------
timeout : Optional[int]
Maximum time allowed for the simulation to run, in seconds.
clear : bool
If True, clear previous results after loading new ones.
Returns
-------
ReturnInformation
Information about the simulation run.
"""
return_information = self.cadet_runner.run(
self,
timeout=timeout,
)
return_information = self.run(timeout)
print(return_information)
self.load_results()

if clear:
self.clear()
return return_information

def run_load(
def run(
self,
timeout: Optional[int] = None,
clear: bool = True
) -> ReturnInformation:
"""
Run the CADET simulation and load the results.
Run the CADET simulation.
Parameters
----------
timeout : Optional[int]
Maximum time allowed for the simulation to run, in seconds.
clear : bool
If True, clear previous results after loading new ones.
Returns
-------
ReturnInformation
Information about the simulation run.
"""
return_information = self.run(timeout)
self.load_results()
return_information = self.cadet_runner.run(
self,
timeout=timeout,
)

if clear:
self.clear()
return return_information

def load_results(self) -> None:
Expand Down
5 changes: 5 additions & 0 deletions cadet/cadet_dll_parameterprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,28 @@ def __init__(self, simulation: "Cadet") -> None:
self.popScope = self._fields_[17][1](utils.param_provider_pop_scope)

_fields_ = [
# 0 (Position must match indices in __init__ method.)
('userData', ctypes.py_object),

# 1
('getDouble', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.POINTER(ctypes.c_double))),
('getInt', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, point_int)),
('getBool', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint8))),
('getString', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.POINTER(ctypes.c_char_p))),

# 5
('getDoubleArray', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, point_int, array_double)),
('getIntArray', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, point_int, ctypes.POINTER(point_int))),
('getBoolArray', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, point_int, ctypes.POINTER(ctypes.POINTER(ctypes.c_uint8)))),
('getStringArray', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, point_int, ctypes.POINTER(ctypes.POINTER(ctypes.c_char_p)))),

# 9
('getDoubleArrayItem', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.c_int, ctypes.POINTER(ctypes.c_double))),
('getIntArrayItem', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.c_int, point_int)),
('getBoolArrayItem', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.c_int, ctypes.POINTER(ctypes.c_uint8))),
('getStringArrayItem', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.c_int, ctypes.POINTER(ctypes.c_char_p))),

# 13
('exists', ctypes.CFUNCTYPE(ctypes.c_int, ctypes.py_object, ctypes.c_char_p)),
('isArray', ctypes.CFUNCTYPE(c_cadet_result, ctypes.py_object, ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint8))),
('numElements', ctypes.CFUNCTYPE(ctypes.c_int, ctypes.py_object, ctypes.c_char_p)),
Expand Down
Loading

0 comments on commit ad35d65

Please sign in to comment.