Skip to content

Commit

Permalink
fixup! Update C-API
Browse files Browse the repository at this point in the history
  • Loading branch information
schmoelder committed Aug 19, 2024
1 parent 3cd29cc commit 16de653
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cadet/cadet_dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@ def load_solution_times(self, sim: "Cadet") -> None:
def load_coordinates(self, sim: "Cadet") -> None:
"""Load coordinates data from simulation results."""
coordinates = addict.Dict()
for unit in range(sim.root.input.model.nunits):
for unit in range(self.res.nunits()):
unit_index = self._get_index_string('unit', unit)
write_coordinates = sim.root.input['return'][unit_index].get('write_coordinates', 0)
if write_coordinates:
Expand All @@ -1819,7 +1819,7 @@ def load_coordinates(self, sim: "Cadet") -> None:
def load_solution(self, sim: "Cadet") -> addict.Dict:
"""Load solution data from simulation results."""
solution = addict.Dict()
for unit in range(sim.root.input.model.nunits):
for unit in range(self.res.nunits()):
unit_index = self._get_index_string('unit', unit)
unit_solution = addict.Dict()

Expand Down Expand Up @@ -1855,7 +1855,7 @@ def load_sensitivity(self, sim: "Cadet") -> None:
for sens in range(nsens):
sens_index = self._get_index_string('param', sens)

for unit in range(sim.root.input.model.nunits):
for unit in range(self.res.nunits()):
unit_sensitivity = addict.Dict()
unit_index = self._get_index_string('unit', unit)

Expand Down Expand Up @@ -1925,7 +1925,7 @@ def load_state(self, sim: "Cadet") -> None:
sim.root.output[idx_str_ydot] = self.res.last_state_sensdot(idx)

solution = sim.root.output.solution
for unit in range(sim.root.input.model.nunits):
for unit in range(self.res.nunits()):
unit_index = self._get_index_string('unit', unit)
write_solution_last = sim.root.input['return'][unit_index].get('write_solution_last_unit', 0)
if write_solution_last:
Expand Down

0 comments on commit 16de653

Please sign in to comment.