Solver: Mage: Fix <list>.node error.

setup.py
Pierre-Antoine Rouby 2024-01-23 11:30:34 +01:00
parent 6c4636917a
commit 3c9eccdfab
1 changed files with 8 additions and 2 deletions

View File

@ -234,7 +234,7 @@ class Mage(CommandLineSolver):
def _export_BC(self, t, bounds, repertory, qlog, name="0"):
files = []
if len(bounds) == 0 or bounds.node is None:
if len(bounds) == 0:
return files
if qlog is not None:
@ -244,6 +244,9 @@ class Mage(CommandLineSolver):
files.append(f"{name}.{t}")
for bound in bounds:
if bound.node is None:
continue
name = f"{bound.node.id:3}".replace(" ", "x")
f.write(f"* {bound.node.name} ({name}) {bound.bctype}\n")
f.write(f"${name}\n")
@ -419,7 +422,7 @@ class Mage(CommandLineSolver):
files = []
reservoirs = study.river.reservoir.lst
if len(reservoirs) == 0 or reservoirs.node is None:
if len(reservoirs) == 0:
return files
if qlog is not None:
@ -429,6 +432,9 @@ class Mage(CommandLineSolver):
files.append(f"{name}.CAS")
for reservoir in reservoirs:
if reservoir.node is None:
continue
reservoir.sort()
node = reservoir.node
name = f"{node.id:3}".replace(" ", "x")