mirror of https://gitlab.com/pamhyr/pamhyr2
Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr
commit
0a63f16f62
|
|
@ -57,12 +57,14 @@ class FrictionList(PamhyrModelList):
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def _db_save(self, execute, data=None):
|
def _db_save(self, execute, data=None):
|
||||||
|
frictions = self.lst
|
||||||
|
|
||||||
reach = data["reach"]
|
reach = data["reach"]
|
||||||
execute(f"DELETE FROM friction WHERE reach = {reach.id}")
|
execute(f"DELETE FROM friction WHERE reach = {reach.id}")
|
||||||
|
|
||||||
ok = True
|
ok = True
|
||||||
ind = 0
|
ind = 0
|
||||||
for friction in self._lst:
|
for friction in frictions:
|
||||||
data["ind"] = ind
|
data["ind"] = ind
|
||||||
ok &= friction._db_save(execute, data=data)
|
ok &= friction._db_save(execute, data=data)
|
||||||
ind += 1
|
ind += 1
|
||||||
|
|
|
||||||
|
|
@ -173,11 +173,13 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
)
|
)
|
||||||
execute(sql)
|
execute(sql)
|
||||||
|
|
||||||
|
points = self.points
|
||||||
|
|
||||||
data["profile"] = self
|
data["profile"] = self
|
||||||
execute(f"DELETE FROM geometry_pointXYZ WHERE profile = {self.id}")
|
execute(f"DELETE FROM geometry_pointXYZ WHERE profile = {self.id}")
|
||||||
|
|
||||||
ind = 0
|
ind = 0
|
||||||
for point in self.points:
|
for point in points:
|
||||||
data["ind"] = ind
|
data["ind"] = ind
|
||||||
ok &= point._db_save(execute, data)
|
ok &= point._db_save(execute, data)
|
||||||
ind += 1
|
ind += 1
|
||||||
|
|
|
||||||
|
|
@ -71,15 +71,16 @@ class Reach(SQLSubModel):
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def _db_save(self, execute, data=None):
|
def _db_save(self, execute, data=None):
|
||||||
|
profiles = self.profiles
|
||||||
|
|
||||||
# Delete old data
|
# Delete old data
|
||||||
execute(f"DELETE FROM geometry_profileXYZ WHERE reach = {self.id}")
|
execute(f"DELETE FROM geometry_profileXYZ WHERE reach = {self.id}")
|
||||||
# execute(f"DELETE FROM geometry_pointXYZ")
|
|
||||||
|
|
||||||
if data is None:
|
if data is None:
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
ind = 0
|
ind = 0
|
||||||
for profile in self.profiles:
|
for profile in profiles:
|
||||||
data["ind"] = ind
|
data["ind"] = ind
|
||||||
profile._db_save(execute, data)
|
profile._db_save(execute, data)
|
||||||
ind += 1
|
ind += 1
|
||||||
|
|
|
||||||
|
|
@ -55,14 +55,18 @@ class InitialConditionsDict(PamhyrModelDict):
|
||||||
if data is None:
|
if data is None:
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
execute("DELETE FROM initial_conditions")
|
ics = self._dict
|
||||||
|
for reach in ics:
|
||||||
for reach in self._dict:
|
|
||||||
data["reach"] = reach
|
data["reach"] = reach
|
||||||
v = self._dict[reach]
|
v = self._dict[reach]
|
||||||
if isinstance(v, types.GeneratorType):
|
if isinstance(v, types.GeneratorType):
|
||||||
self._dict[reach] = list(v)[0]
|
self._dict[reach] = list(v)[0]
|
||||||
|
|
||||||
|
execute(
|
||||||
|
"DELETE FROM initial_conditions " +
|
||||||
|
f"WHERE reach = '{reach.id}'"
|
||||||
|
)
|
||||||
|
|
||||||
ok &= self._dict[reach]._db_save(execute, data)
|
ok &= self._dict[reach]._db_save(execute, data)
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
|
|
|
||||||
|
|
@ -200,9 +200,9 @@ class Mage(CommandLineSolver):
|
||||||
wfile.write(f"{num}{c1}{c2}{t} {kp} {pname} {sediment}\n")
|
wfile.write(f"{num}{c1}{c2}{t} {kp} {pname} {sediment}\n")
|
||||||
|
|
||||||
def _export_ST_point_line(self, wfile, files, point):
|
def _export_ST_point_line(self, wfile, files, point):
|
||||||
x = f"{point.x:<12f}"[0:12]
|
x = f"{point.x:<12.4f}"[0:12]
|
||||||
y = f"{point.y:<12f}"[0:12]
|
y = f"{point.y:<12.4f}"[0:12]
|
||||||
z = f"{point.z:<12f}"[0:12]
|
z = f"{point.z:<12.4f}"[0:12]
|
||||||
n = f"{point.name:<3}"
|
n = f"{point.name:<3}"
|
||||||
|
|
||||||
# Generate sediment additional data if available
|
# Generate sediment additional data if available
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ class SolverLogWindow(PamhyrWindow):
|
||||||
def new_process(self, parent):
|
def new_process(self, parent):
|
||||||
new = QProcess(parent)
|
new = QProcess(parent)
|
||||||
new.setWorkingDirectory(self._workdir)
|
new.setWorkingDirectory(self._workdir)
|
||||||
|
new.setProcessChannelMode(QProcess.MergedChannels)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def setup_action(self):
|
def setup_action(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue