load boundary conditions from file

This commit is contained in:
Theophile Terraz committed 2025-09-12 14:22:46 +02:00
1 parent 7c4c772f43
commit b582e133a1
6 files changed
+110 -16

No files matched your search

+20
View File
@@ -211,3 +211,23 @@ class TableModel(PamhyrTableModel):
)
self.layoutAboutToBeChanged.emit()
self.update()
def read_from_file(self, file_name, bctype):
logger.debug(f"Import initial conditions from {file_name}")
data0 = []
data1 = []
if bctype == "ZD":
mult = 1
else:
mult = 60
with open(file_name, encoding="utf-8") as ini_file:
for line in ini_file:
if not (line.startswith("#") or
line.startswith("*") or
line.startswith("$")):
line = line.split()
data0.append(float(line[0]) * mult)
data1.append(line[1])
self.replace_data(data0, data1)