Solver: RubarBE: Add MAIL file.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-04-05 16:03:55 +02:00
1 parent 329572d191
commit 9f87a38107
2 files changed
+57

No files matched your search

+37
View File
@@ -195,3 +195,40 @@ class RubarBE(CommandLineSolver):
)
ind += 1
def _export_mail(self, study, repertory, files, qlog, name="0"):
if qlog is not None:
qlog.put("Export MAIL file")
with open(
os.path.join(
repertory, f"mail.{name}"
), "w+"
) as f:
for edge in study.river.enable_edges():
lm = len(edge) + 1
f.write(f"{lm:>13}")
# TMAIL
ind = 0
for inter in edge.reach.inter_profiles_kp():
f.write(f"{inter:15.3f}")
ind += 1
if ind % 3 == 0:
f.write("\n")
# New line (if last iteration do not finish with new
# line)
if ind % 3 != 0:
f.write("\n")
# XTMAIL
ind = 0
for profile in edge.reach.profiles:
f.write(f" {profile.kp:15.3f} ")
ind += 1
if ind % 3 == 0:
f.write("\n")