mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
5 Commits
6b14ed7efe
...
645a76b0e8
| Author | SHA1 | Date |
|---|---|---|
|
|
645a76b0e8 | |
|
|
6288f039d2 | |
|
|
3585b29b03 | |
|
|
96bac8ee1f | |
|
|
e7d14e7aa3 |
|
|
@ -503,10 +503,16 @@ class BoundaryCondition(SQLSubModel):
|
||||||
new_0 = self._types[0](data[0].replace(",", "."))
|
new_0 = self._types[0](data[0].replace(",", "."))
|
||||||
new_1 = self._types[1](data[1].replace(",", "."))
|
new_1 = self._types[1](data[1].replace(",", "."))
|
||||||
|
|
||||||
return Data(new_0, new_1)
|
return Data(
|
||||||
|
new_0, new_1,
|
||||||
|
status=self._status
|
||||||
|
)
|
||||||
|
|
||||||
def add(self, index: int):
|
def add(self, index: int):
|
||||||
value = Data(self._default_0, self._default_1)
|
value = Data(
|
||||||
|
self._default_0, self._default_1,
|
||||||
|
status=self._status
|
||||||
|
)
|
||||||
self._data.insert(index, value)
|
self._data.insert(index, value)
|
||||||
self.modified()
|
self.modified()
|
||||||
return value
|
return value
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,10 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
"name": point[3],
|
"name": point[3],
|
||||||
}
|
}
|
||||||
|
|
||||||
pt = PointXYZ(id=-1, **named_args, profile=self, status=self._status)
|
pt = PointXYZ(
|
||||||
|
id=-1, **named_args, profile=self,
|
||||||
|
status=self._status
|
||||||
|
)
|
||||||
self._points.append(pt)
|
self._points.append(pt)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
@ -524,7 +527,10 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
Nothing.
|
||||||
"""
|
"""
|
||||||
point_xyz = PointXYZ(x=0., y=0., z=0., profile=self, status=self._status)
|
point_xyz = PointXYZ(
|
||||||
|
x=0., y=0., z=0., profile=self,
|
||||||
|
status=self._status
|
||||||
|
)
|
||||||
self.points.append(point_xyz)
|
self.points.append(point_xyz)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class Graph(SQLSubModel):
|
||||||
def _enable_edges(self):
|
def _enable_edges(self):
|
||||||
"""Return a generator"""
|
"""Return a generator"""
|
||||||
return filter(
|
return filter(
|
||||||
lambda e: e.is_enable(),
|
lambda e: e.is_enable() and not e.is_deleted(),
|
||||||
self.edges()
|
self.edges()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,12 @@ class Mage(CommandLineSolver):
|
||||||
|
|
||||||
# Generate sediment additional data if available
|
# Generate sediment additional data if available
|
||||||
sediment = ""
|
sediment = ""
|
||||||
if profile.sl is not None:
|
if profile.sl is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if profile.sl.is_deleted():
|
||||||
|
return
|
||||||
|
|
||||||
if not any(filter(lambda f: ".GRA" in f, files)):
|
if not any(filter(lambda f: ".GRA" in f, files)):
|
||||||
files.append(self._gra_file)
|
files.append(self._gra_file)
|
||||||
|
|
||||||
|
|
@ -278,7 +283,12 @@ class Mage(CommandLineSolver):
|
||||||
# Generate sediment additional data if available
|
# Generate sediment additional data if available
|
||||||
sediment = ""
|
sediment = ""
|
||||||
prev = point.z
|
prev = point.z
|
||||||
if point.sl is not None:
|
if point.sl is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if point.sl.is_deleted():
|
||||||
|
return
|
||||||
|
|
||||||
# Number of layers
|
# Number of layers
|
||||||
nl = len(point.sl)
|
nl = len(point.sl)
|
||||||
sediment = f"{nl:>3}"
|
sediment = f"{nl:>3}"
|
||||||
|
|
@ -311,6 +321,9 @@ class Mage(CommandLineSolver):
|
||||||
if bound.node is None:
|
if bound.node is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if bound.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
name = self.get_node_name(bound.node)
|
name = self.get_node_name(bound.node)
|
||||||
f.write(f"* {bound.node.name} ({name}) {bound.bctype}\n")
|
f.write(f"* {bound.node.name} ({name}) {bound.bctype}\n")
|
||||||
f.write(f"${name}\n")
|
f.write(f"${name}\n")
|
||||||
|
|
@ -383,6 +396,9 @@ class Mage(CommandLineSolver):
|
||||||
if lateral.edge is None:
|
if lateral.edge is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if lateral.is_deleted():
|
||||||
|
return
|
||||||
|
|
||||||
edges = study.river.enable_edges()
|
edges = study.river.enable_edges()
|
||||||
if lateral.edge not in edges:
|
if lateral.edge not in edges:
|
||||||
return
|
return
|
||||||
|
|
@ -405,6 +421,9 @@ class Mage(CommandLineSolver):
|
||||||
f.write(f"*{header[0]:>9}|{header[1]:>10}\n")
|
f.write(f"*{header[0]:>9}|{header[1]:>10}\n")
|
||||||
|
|
||||||
for d in lateral.data:
|
for d in lateral.data:
|
||||||
|
if d.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
if lateral.lctype in ["EV"]:
|
if lateral.lctype in ["EV"]:
|
||||||
f.write(f"{d[0]:10.3f}{-d[1]:10.3f}\n")
|
f.write(f"{d[0]:10.3f}{-d[1]:10.3f}\n")
|
||||||
else:
|
else:
|
||||||
|
|
@ -430,6 +449,9 @@ class Mage(CommandLineSolver):
|
||||||
if friction.begin_strickler is None:
|
if friction.begin_strickler is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if friction.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
num = f"{id:>3}"
|
num = f"{id:>3}"
|
||||||
brk = f"{friction.begin_rk:>10.3f}"
|
brk = f"{friction.begin_rk:>10.3f}"
|
||||||
erk = f"{friction.end_rk:>10.3f}"
|
erk = f"{friction.end_rk:>10.3f}"
|
||||||
|
|
@ -466,6 +488,9 @@ class Mage(CommandLineSolver):
|
||||||
id = 1
|
id = 1
|
||||||
for reach in reachs:
|
for reach in reachs:
|
||||||
cond = study.river.initial_conditions.get(reach)
|
cond = study.river.initial_conditions.get(reach)
|
||||||
|
if cond.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
data = cond.data
|
data = cond.data
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
@ -474,6 +499,9 @@ class Mage(CommandLineSolver):
|
||||||
|
|
||||||
id_sec = 1
|
id_sec = 1
|
||||||
for d in data:
|
for d in data:
|
||||||
|
if d.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
IR = f"{id}"
|
IR = f"{id}"
|
||||||
IS = f"{id_sec}"
|
IS = f"{id_sec}"
|
||||||
discharge = f"{d['discharge']:>10.5f}"
|
discharge = f"{d['discharge']:>10.5f}"
|
||||||
|
|
@ -490,6 +518,7 @@ class Mage(CommandLineSolver):
|
||||||
|
|
||||||
if has_ini:
|
if has_ini:
|
||||||
files.append(f"{name}.INI")
|
files.append(f"{name}.INI")
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
||||||
def _export_CAS(self, study, repertory, qlog, name="0"):
|
def _export_CAS(self, study, repertory, qlog, name="0"):
|
||||||
|
|
@ -506,7 +535,7 @@ class Mage(CommandLineSolver):
|
||||||
files.append(f"{name}.CAS")
|
files.append(f"{name}.CAS")
|
||||||
|
|
||||||
for reservoir in reservoirs:
|
for reservoir in reservoirs:
|
||||||
if reservoir.node is None:
|
if reservoir.node is None or reservoir.is_deleted():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
reservoir.sort()
|
reservoir.sort()
|
||||||
|
|
@ -561,6 +590,9 @@ class Mage(CommandLineSolver):
|
||||||
if hs.input_section is None:
|
if hs.input_section is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if hs.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
f.write(
|
f.write(
|
||||||
'* ouvrage au pk ' +
|
'* ouvrage au pk ' +
|
||||||
f"{float(hs.input_section.rk):>12.1f}" + ' ' +
|
f"{float(hs.input_section.rk):>12.1f}" + ' ' +
|
||||||
|
|
@ -573,7 +605,12 @@ class Mage(CommandLineSolver):
|
||||||
|
|
||||||
def _export_SIN_bhs(self, study, sin_dict, hs, f):
|
def _export_SIN_bhs(self, study, sin_dict, hs, f):
|
||||||
for bhs in hs.basic_structures:
|
for bhs in hs.basic_structures:
|
||||||
if bhs.enabled:
|
if not bhs.enabled:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if bhs.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
reach_id = study.river.get_edge_id(hs.input_reach) + 1
|
reach_id = study.river.get_edge_id(hs.input_reach) + 1
|
||||||
param_str = ' '.join(
|
param_str = ' '.join(
|
||||||
[
|
[
|
||||||
|
|
@ -667,12 +704,15 @@ class Mage(CommandLineSolver):
|
||||||
if hs.input_reach is None:
|
if hs.input_reach is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not hs.input_reach.is_enable():
|
if not hs.input_reach.is_enable() or hs.input_reach.is_deleted():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not hs.enabled:
|
if not hs.enabled:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if hs.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
for bhs in hs.basic_structures:
|
for bhs in hs.basic_structures:
|
||||||
if bhs.enabled:
|
if bhs.enabled:
|
||||||
logger.info(bhs._type)
|
logger.info(bhs._type)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue