mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
No commits in common. "f6e08f203cadfb9939b5c463916129fb4687be59" and "706a900c8ece1d2fba90df0046443201c601948d" have entirely different histories.
f6e08f203c
...
706a900c8e
|
|
@ -60,6 +60,10 @@ dl-mage8-linux:
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- mage8-linux/mage
|
- mage8-linux/mage
|
||||||
|
- mage8-linux/mage_as7
|
||||||
|
- mage8-linux/mage_extraire
|
||||||
|
- mage8-linux/mailleurTT
|
||||||
|
- mage8-linux/libbief.so
|
||||||
|
|
||||||
dl-mage8-windows:
|
dl-mage8-windows:
|
||||||
stage: downloads
|
stage: downloads
|
||||||
|
|
@ -75,6 +79,10 @@ dl-mage8-windows:
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- mage8-windows/mage.exe
|
- mage8-windows/mage.exe
|
||||||
|
- mage8-windows/mage_as7.exe
|
||||||
|
- mage8-windows/mage_extraire.exe
|
||||||
|
- mage8-windows/mailleurTT.exe
|
||||||
|
- mage8-windows/libbief.dll
|
||||||
|
|
||||||
dl-adists-linux:
|
dl-adists-linux:
|
||||||
stage: downloads
|
stage: downloads
|
||||||
|
|
|
||||||
|
|
@ -1,331 +0,0 @@
|
||||||
# Internal.py -- Pamhyr
|
|
||||||
# Copyright (C) 2023-2025 INRAE
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from numpy import sign
|
|
||||||
from copy import deepcopy
|
|
||||||
|
|
||||||
from tools import logger_color_red, logger_color_reset, logger_exception
|
|
||||||
from Meshing.AMeshingTool import AMeshingTool
|
|
||||||
|
|
||||||
from Model.Geometry.ProfileXYZ import ProfileXYZ
|
|
||||||
|
|
||||||
logger = logging.getLogger()
|
|
||||||
|
|
||||||
|
|
||||||
class InternalMeshing(AMeshingTool):
|
|
||||||
def __init__(self):
|
|
||||||
super(InternalMeshing, self).__init__()
|
|
||||||
|
|
||||||
###########
|
|
||||||
# Meshing #
|
|
||||||
###########
|
|
||||||
|
|
||||||
def meshing(self, reach,
|
|
||||||
step: float = 50,
|
|
||||||
limites=[-1, -1],
|
|
||||||
linear: bool = True):
|
|
||||||
if reach is None or len(reach.profiles) == 0:
|
|
||||||
return reach
|
|
||||||
|
|
||||||
if limites[0] > limites[1]:
|
|
||||||
lim = limites[1]
|
|
||||||
limites[1] = limites[0]
|
|
||||||
limites[0] = lim
|
|
||||||
elif limites[0] == limites[1]:
|
|
||||||
return reach
|
|
||||||
|
|
||||||
self.st_to_m(reach, limites)
|
|
||||||
self.interpolate_transversal_step(reach,
|
|
||||||
limites,
|
|
||||||
step)
|
|
||||||
self.purge_aligned_points(reach)
|
|
||||||
|
|
||||||
return reach
|
|
||||||
|
|
||||||
def st_to_m(self, reach, limites):
|
|
||||||
|
|
||||||
gl = reach.compute_guidelines()
|
|
||||||
profiles = reach.profiles[limites[0]:limites[1]+1]
|
|
||||||
|
|
||||||
print(profiles)
|
|
||||||
|
|
||||||
# we make sure that the lines are in the left-to-right order
|
|
||||||
guide_list = [
|
|
||||||
x.name
|
|
||||||
for x in profiles[0].named_points()
|
|
||||||
if x.name in gl[0]
|
|
||||||
]
|
|
||||||
|
|
||||||
gl1 = [""] + guide_list
|
|
||||||
gl2 = guide_list + [""]
|
|
||||||
max_values = [0] * (len(guide_list) + 1)
|
|
||||||
max_values_index = [0] * (len(guide_list) + 1)
|
|
||||||
# we work between each couple of guidelines
|
|
||||||
for j, p in enumerate(profiles):
|
|
||||||
index1 = 0
|
|
||||||
index2 = p.named_point_index(guide_list[0])
|
|
||||||
if index2 - index1 > max_values[0]:
|
|
||||||
max_values[0] = index2 - index1
|
|
||||||
max_values_index[0] = j
|
|
||||||
for i in range(len(guide_list) - 1):
|
|
||||||
index1 = p.named_point_index(guide_list[i])
|
|
||||||
index2 = p.named_point_index(guide_list[i+1])
|
|
||||||
if index2 - index1 > max_values[i + 1]:
|
|
||||||
max_values[i + 1] = index2 - index1
|
|
||||||
max_values_index[i + 1] = j
|
|
||||||
index1 = p.named_point_index(guide_list[-1])
|
|
||||||
index2 = len(p) - 1
|
|
||||||
if index2 - index1 > max_values[-1]:
|
|
||||||
max_values[-1] = index2 - index1
|
|
||||||
max_values_index[-1] = j
|
|
||||||
|
|
||||||
for i in range(len(max_values)):
|
|
||||||
for isect in range(max_values_index[i], len(profiles)-1):
|
|
||||||
self.compl_sect(profiles[isect],
|
|
||||||
profiles[isect+1],
|
|
||||||
gl1[i], gl2[i])
|
|
||||||
for isect in reversed(range(0, max_values_index[i])):
|
|
||||||
self.compl_sect(profiles[isect+1],
|
|
||||||
profiles[isect],
|
|
||||||
gl1[i], gl2[i])
|
|
||||||
|
|
||||||
def interpolate_transversal_step(self,
|
|
||||||
reach,
|
|
||||||
limites,
|
|
||||||
step):
|
|
||||||
# calcul number of intermediate profiles
|
|
||||||
np = []
|
|
||||||
for i in range(limites[0], limites[1]):
|
|
||||||
np.append(int((reach.profiles[i+1].rk -
|
|
||||||
reach.profiles[i].rk) / step) - 1)
|
|
||||||
if np[-1] < 0:
|
|
||||||
np[-1] = 0
|
|
||||||
|
|
||||||
d = [] # ratios
|
|
||||||
p = [] # new profiles
|
|
||||||
ptr = int(limites[0])
|
|
||||||
for i in range(limites[1] - limites[0]):
|
|
||||||
d = 1.0/float(np[i]+1)
|
|
||||||
ptr0 = ptr
|
|
||||||
for j in range(np[i]):
|
|
||||||
p = reach.profiles[ptr0].copy()
|
|
||||||
# RATIO entre les deux sections initiales
|
|
||||||
dj = float(j+1)*d
|
|
||||||
ptr += 1 # next profile, original
|
|
||||||
for k in range(len(reach.profiles[ptr0].points)):
|
|
||||||
p.points[k].x = reach.profiles[ptr0].points[k].x + \
|
|
||||||
dj*(reach.profiles[ptr].points[k].x -
|
|
||||||
reach.profiles[ptr0].points[k].x)
|
|
||||||
p.points[k].y = reach.profiles[ptr0].points[k].y + \
|
|
||||||
dj*(reach.profiles[ptr].points[k].y -
|
|
||||||
reach.profiles[ptr0].points[k].y)
|
|
||||||
p.points[k].z = reach.profiles[ptr0].points[k].z + \
|
|
||||||
dj*(reach.profiles[ptr].points[k].z -
|
|
||||||
reach.profiles[ptr0].points[k].z)
|
|
||||||
p.rk = reach.profiles[ptr0].rk + \
|
|
||||||
dj*(reach.profiles[ptr].rk -
|
|
||||||
reach.profiles[ptr0].rk)
|
|
||||||
p.name = f'interpol{p.rk}'
|
|
||||||
reach.insert_profile(ptr, p)
|
|
||||||
ptr += 1 # next profile, original
|
|
||||||
|
|
||||||
def compl_sect(self, sect1, sect2, tag1, tag2):
|
|
||||||
# sect1: reference section
|
|
||||||
# sect2: section to complete
|
|
||||||
# start1 and 2: indices of the first point of the bed to complete
|
|
||||||
# end = start + len
|
|
||||||
# len1 and 2: number of intervals
|
|
||||||
# len1: target len
|
|
||||||
|
|
||||||
if tag1 == '': # left end point
|
|
||||||
start1 = 0
|
|
||||||
start2 = 0
|
|
||||||
else:
|
|
||||||
start1 = sect1.named_point_index(tag1)
|
|
||||||
start2 = sect2.named_point_index(tag1)
|
|
||||||
|
|
||||||
if tag2 == '': # right end point
|
|
||||||
end1 = sect1.nb_points-1
|
|
||||||
end2 = sect2.nb_points-1
|
|
||||||
else:
|
|
||||||
end1 = sect1.named_point_index(tag2)
|
|
||||||
end2 = sect2.named_point_index(tag2)
|
|
||||||
|
|
||||||
len1 = end1 - start1
|
|
||||||
len2 = end2 - start2
|
|
||||||
|
|
||||||
if len1 < len2:
|
|
||||||
self.compl_sect(sect2, sect1, start2, start1,
|
|
||||||
len2, len1, tag1, tag2)
|
|
||||||
return
|
|
||||||
elif len1 == len2:
|
|
||||||
return
|
|
||||||
|
|
||||||
ltot1 = 0.0
|
|
||||||
ltot2 = 0.0
|
|
||||||
alpha = []
|
|
||||||
beta = []
|
|
||||||
# remove names
|
|
||||||
sect2.points[start2].name = ''
|
|
||||||
sect2.points[end2].name = ''
|
|
||||||
for i in range(len1):
|
|
||||||
ltot1 += sect1.point(start1+i).dist(sect1.point(start1+i+1))
|
|
||||||
alpha.append(ltot1)
|
|
||||||
alpha = list(map(lambda x: x/ltot1, alpha)) # target ratios
|
|
||||||
for i in range(len2):
|
|
||||||
ltot2 += sect2.point(start2+i).dist(sect2.point(start2+i+1))
|
|
||||||
beta.append(ltot2)
|
|
||||||
beta = list(map(lambda x: x/ltot2, beta)) # current ratios
|
|
||||||
for i in range(len1 - len2):
|
|
||||||
beta.append(1.0)
|
|
||||||
beta.append(0.0) # beta[-1]
|
|
||||||
if len2 < 1 or ltot2 < 0.0001:
|
|
||||||
# unique point (copy len1 times)
|
|
||||||
# we are at an edge of the profile
|
|
||||||
for i in range(len1-len2):
|
|
||||||
p = sect2.point(start2).copy()
|
|
||||||
sect2.insert_point(start2, p)
|
|
||||||
if tag1 == '': # left end point
|
|
||||||
sect2.point(start2).name = ''
|
|
||||||
if tag2 == '': # left end point
|
|
||||||
sect2.point(start2+1).name = ''
|
|
||||||
elif ltot1 < 0.0001:
|
|
||||||
sect2.add_npoints(len1-len2)
|
|
||||||
else: # regular case
|
|
||||||
# loop on the points to insert
|
|
||||||
for k in range(len1-len2):
|
|
||||||
trouve = False
|
|
||||||
for j0 in range(len2):
|
|
||||||
if trouve:
|
|
||||||
break
|
|
||||||
undeplus = True
|
|
||||||
for j1 in range(j0, len2):
|
|
||||||
if undeplus:
|
|
||||||
if beta[j1] <= alpha[j1]:
|
|
||||||
undeplus = False
|
|
||||||
break
|
|
||||||
if undeplus:
|
|
||||||
if j0 == len2:
|
|
||||||
trouve = True
|
|
||||||
else:
|
|
||||||
j1 = j0+1
|
|
||||||
if beta[j0]-alpha[j0] > alpha[j1]-beta[j0]:
|
|
||||||
trouve = True
|
|
||||||
|
|
||||||
if trouve:
|
|
||||||
len2 += 1
|
|
||||||
for i in reversed(range(j0, len2)):
|
|
||||||
beta[i+1] = beta[i]
|
|
||||||
if (beta[j0] == beta[j0-1]):
|
|
||||||
# rien
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
ratio = (alpha[j0] - beta[j0-1]) \
|
|
||||||
/ (beta[j0] - beta[j0-1])
|
|
||||||
if ratio < 0.0:
|
|
||||||
print(f"ratio négatif {ratio}")
|
|
||||||
# on double le point a gauche
|
|
||||||
p = sect2.point(start2+j0-1).copy()
|
|
||||||
sect2.insert_point(start2+j0-1, p)
|
|
||||||
sect2.point(start2+j0-1).name = ''
|
|
||||||
beta[j0] = beta[j0-1]
|
|
||||||
else:
|
|
||||||
p = sect2.point(start2+j0).copy()
|
|
||||||
sect2.insert_point(start2+j0, p)
|
|
||||||
sect2.point(start2+j0+1).name = ''
|
|
||||||
sect2.point(start2+j0+1).x = \
|
|
||||||
(1.0-ratio) * sect2.point(start2+j0).x + \
|
|
||||||
ratio * sect2.point(start2+j0+2).x
|
|
||||||
sect2.point(start2+j0+1).y = \
|
|
||||||
(1.0-ratio) * sect2.point(start2+j0).y + \
|
|
||||||
ratio * sect2.point(start2+j0+2).y
|
|
||||||
sect2.point(start2+j0+1).z = \
|
|
||||||
(1.0-ratio) * sect2.point(start2+j0).z + \
|
|
||||||
ratio * sect2.point(start2+j0+2).z
|
|
||||||
beta[j0] = (1.-ratio)*beta[j0-1] \
|
|
||||||
+ ratio*beta[j0+1]
|
|
||||||
|
|
||||||
if len1 > len2:
|
|
||||||
for i in range(len1 - len2):
|
|
||||||
p = sect2.point(start2+len2).copy()
|
|
||||||
sect2.insert_point(start2+len2, p)
|
|
||||||
sect2.point(start2+len2).name = ''
|
|
||||||
sect2.point(start2).name = tag1
|
|
||||||
sect2.point(start2+len2).name = tag2
|
|
||||||
sect2.modified()
|
|
||||||
|
|
||||||
def update_rk(self, reach,
|
|
||||||
step: float = 50,
|
|
||||||
limites=[-1, -1],
|
|
||||||
origin=0,
|
|
||||||
directrices=['un', 'np'],
|
|
||||||
lplan: bool = False,
|
|
||||||
lm: int = 3,
|
|
||||||
linear: bool = False,
|
|
||||||
origin_value=0.0,
|
|
||||||
orientation=0):
|
|
||||||
if reach is None or len(reach.profiles) == 0:
|
|
||||||
return reach
|
|
||||||
|
|
||||||
nprof = reach.number_profiles
|
|
||||||
if origin >= nprof or origin < 0:
|
|
||||||
logger.warning(
|
|
||||||
f"Origin outside reach"
|
|
||||||
)
|
|
||||||
return reach
|
|
||||||
|
|
||||||
# orientation is the orintation of the bief:
|
|
||||||
# 1: up -> downstream
|
|
||||||
# 2: down -> upstream
|
|
||||||
# else: keep current orientation
|
|
||||||
if orientation == 1:
|
|
||||||
sgn = 1.0
|
|
||||||
elif orientation == 2:
|
|
||||||
sgn = -1.0
|
|
||||||
else:
|
|
||||||
sgn = sign(reach.profiles[-1].rk - reach.profiles[0].rk)
|
|
||||||
|
|
||||||
reach.profiles[origin].rk = origin_value
|
|
||||||
|
|
||||||
if origin < nprof - 1:
|
|
||||||
for i in range(origin+1, nprof):
|
|
||||||
# 2D
|
|
||||||
d1 = reach.profiles[i-1].named_point(
|
|
||||||
directrices[0]
|
|
||||||
).dist_2d(reach.profiles[i].named_point(directrices[0]))
|
|
||||||
d2 = reach.profiles[i-1].named_point(
|
|
||||||
directrices[1]
|
|
||||||
).dist_2d(reach.profiles[i].named_point(directrices[1]))
|
|
||||||
reach.profiles[i].rk = reach.profiles[i-1].rk \
|
|
||||||
+ (sgn * (d1 + d2) / 2)
|
|
||||||
if origin > 0:
|
|
||||||
for i in reversed(range(0, origin)):
|
|
||||||
# 2D
|
|
||||||
d1 = reach.profiles[i+1].named_point(
|
|
||||||
directrices[0]
|
|
||||||
).dist_2d(reach.profiles[i].named_point(directrices[0]))
|
|
||||||
d2 = reach.profiles[i+1].named_point(
|
|
||||||
directrices[1]
|
|
||||||
).dist_2d(reach.profiles[i].named_point(directrices[1]))
|
|
||||||
reach.profiles[i].rk = reach.profiles[i+1].rk \
|
|
||||||
- (sgn * (d1 + d2) / 2)
|
|
||||||
|
|
||||||
def purge_aligned_points(self, reach):
|
|
||||||
for p in reach.profiles:
|
|
||||||
p.purge_aligned_points()
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
from numpy import sign
|
|
||||||
|
|
||||||
from ctypes import (
|
from ctypes import (
|
||||||
cdll,
|
cdll,
|
||||||
|
|
|
||||||
|
|
@ -228,25 +228,3 @@ class PointXYZ(Point, SQLSubModel):
|
||||||
c = PointXYZ.distance(p3, p1)
|
c = PointXYZ.distance(p3, p1)
|
||||||
s = (a + b + c) / 2
|
s = (a + b + c) / 2
|
||||||
return (s*(s-a) * (s-b)*(s-c)) ** 0.5
|
return (s*(s-a) * (s-b)*(s-c)) ** 0.5
|
||||||
|
|
||||||
def dist_from_seg(self, p1, p2):
|
|
||||||
a2 = pow(PointXYZ.distance(self, p1), 2)
|
|
||||||
b2 = pow(PointXYZ.distance(self, p2), 2)
|
|
||||||
c2 = pow(PointXYZ.distance(p1, p2), 2)
|
|
||||||
if c2 < 0.00000001:
|
|
||||||
# si les deux points sont confondus
|
|
||||||
d = 0.0
|
|
||||||
else:
|
|
||||||
d = np.sqrt(abs(a2 - pow((c2 - b2 + a2) / (2*np.sqrt(c2)), 2)))
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
def copy(self):
|
|
||||||
p = PointXYZ(self.x,
|
|
||||||
self.y,
|
|
||||||
self.z,
|
|
||||||
self.name,
|
|
||||||
self._profile,
|
|
||||||
self._status)
|
|
||||||
p.sl = self.sl
|
|
||||||
return p
|
|
||||||
|
|
|
||||||
|
|
@ -88,14 +88,6 @@ class Profile(object):
|
||||||
def point(self, index):
|
def point(self, index):
|
||||||
return self.points[index]
|
return self.points[index]
|
||||||
|
|
||||||
def named_point(self, name):
|
|
||||||
return next((p for p in self.points if p.name == name), None)
|
|
||||||
|
|
||||||
def named_point_index(self, name):
|
|
||||||
return next(
|
|
||||||
(p for p in enumerate(self.points) if p[1].name == name), None
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def reach(self):
|
def reach(self):
|
||||||
return self._reach
|
return self._reach
|
||||||
|
|
@ -214,7 +206,7 @@ class Profile(object):
|
||||||
"""Insert point at index.
|
"""Insert point at index.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
index: The index of new point.
|
index: The index of new profile.
|
||||||
point: The point.
|
point: The point.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
|
||||||
|
|
@ -882,46 +882,3 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
def modified(self):
|
def modified(self):
|
||||||
self.tab_up_to_date = False
|
self.tab_up_to_date = False
|
||||||
self.station_up_to_date = False
|
self.station_up_to_date = False
|
||||||
|
|
||||||
def add_npoints(self, npoints):
|
|
||||||
# add npoints in a profile
|
|
||||||
for k in range(npoints):
|
|
||||||
disti = 0.0
|
|
||||||
i = 1
|
|
||||||
for j in range(len(self.points)-1):
|
|
||||||
distj = self.point(j).dist(self.point(j+1))
|
|
||||||
if distj > disti:
|
|
||||||
disti = distj
|
|
||||||
i = j
|
|
||||||
self.insert_point(i, self.point(i).copy())
|
|
||||||
self.point(i+1).name = ''
|
|
||||||
self.point(i+1).x = 0.5 * self.point(i).x + 0.5 * self.point(i+2).x
|
|
||||||
self.point(i+1).y = 0.5 * self.point(i).y + 0.5 * self.point(i+2).y
|
|
||||||
self.point(i+1).z = 0.5 * self.point(i).z + 0.5 * self.point(i+2).z
|
|
||||||
|
|
||||||
def copy(self):
|
|
||||||
p = ProfileXYZ(self.id,
|
|
||||||
self.name,
|
|
||||||
self.rk,
|
|
||||||
self.reach,
|
|
||||||
self.num,
|
|
||||||
0,
|
|
||||||
0, 0,
|
|
||||||
self._status)
|
|
||||||
for i, k in enumerate(self.points):
|
|
||||||
p.insert_point(i, k.copy())
|
|
||||||
|
|
||||||
return p
|
|
||||||
|
|
||||||
def purge_aligned_points(self):
|
|
||||||
|
|
||||||
align = True
|
|
||||||
while (align):
|
|
||||||
align = False
|
|
||||||
for i in range(1, self.number_points - 1):
|
|
||||||
d = self.point(i).dist_from_seg(self.point(i-1),
|
|
||||||
self.point(i+1))
|
|
||||||
if d < 0.00001 and self.point(i).name == "":
|
|
||||||
align = True
|
|
||||||
self.delete_i([i])
|
|
||||||
break
|
|
||||||
|
|
|
||||||
|
|
@ -77,12 +77,6 @@ class Reach(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
self._profile_mask = list(
|
|
||||||
map(
|
|
||||||
lambda p: p.name[0:8] != 'interpol', self._profiles
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self._profiles)
|
return len(self._profiles)
|
||||||
|
|
||||||
|
|
@ -98,10 +92,6 @@ class Reach(object):
|
||||||
def profiles(self):
|
def profiles(self):
|
||||||
return self._profiles.copy()
|
return self._profiles.copy()
|
||||||
|
|
||||||
@property
|
|
||||||
def profile_mask(self):
|
|
||||||
return self._profile_mask
|
|
||||||
|
|
||||||
def profile(self, id):
|
def profile(self, id):
|
||||||
return self._profiles[id]
|
return self._profiles[id]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,10 @@ class Rubar3(CommandLineSolver):
|
||||||
("rubarbe_tf_5", "y"),
|
("rubarbe_tf_5", "y"),
|
||||||
("rubarbe_tf_6", "n"),
|
("rubarbe_tf_6", "n"),
|
||||||
("rubarbe_trased", "y"),
|
("rubarbe_trased", "y"),
|
||||||
# ("rubarbe_optfpc", "0"),
|
#("rubarbe_optfpc", "0"),
|
||||||
# ("rubarbe_ros", "2650.0"),
|
#("rubarbe_ros", "2650.0"),
|
||||||
# ("rubarbe_dm", "0.1"),
|
#("rubarbe_dm", "0.1"),
|
||||||
# ("rubarbe_segma", "1.0"),
|
#("rubarbe_segma", "1.0"),
|
||||||
# Sediment parameters
|
# Sediment parameters
|
||||||
("rubarbe_sediment_ros", "2650.0"),
|
("rubarbe_sediment_ros", "2650.0"),
|
||||||
("rubarbe_sediment_por", "0.4"),
|
("rubarbe_sediment_por", "0.4"),
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ solver_long_name = {
|
||||||
# "mage_fake7": "Mage fake v7",
|
# "mage_fake7": "Mage fake v7",
|
||||||
"adistswc": "Adis-TS_WC",
|
"adistswc": "Adis-TS_WC",
|
||||||
# "rubarbe": "RubarBE",
|
# "rubarbe": "RubarBE",
|
||||||
"rubar3": "Rubar3",
|
# "rubar3": "Rubar3",
|
||||||
}
|
}
|
||||||
|
|
||||||
solver_type_list = {
|
solver_type_list = {
|
||||||
|
|
@ -44,5 +44,5 @@ solver_type_list = {
|
||||||
# "mage_fake7": MageFake7,
|
# "mage_fake7": MageFake7,
|
||||||
"adistswc": AdisTSwc,
|
"adistswc": AdisTSwc,
|
||||||
# "rubarbe": RubarBE,
|
# "rubarbe": RubarBE,
|
||||||
"rubar3": Rubar3,
|
# "rubar3": Rubar3,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ from PyQt5.QtGui import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
Qt, QVariant, QAbstractTableModel, QItemSelectionModel,
|
Qt, QVariant, QAbstractTableModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
|
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
|
||||||
QDoubleSpinBox, QRadioButton,
|
QDoubleSpinBox,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ class MeshingDialog(PamhyrDialog):
|
||||||
self._space_step = 50.0
|
self._space_step = 50.0
|
||||||
self._lplan = False
|
self._lplan = False
|
||||||
self._lm = "3"
|
self._lm = "3"
|
||||||
self._linear = True
|
self._linear = False
|
||||||
self._begin_cs = -1
|
self._begin_cs = -1
|
||||||
self._end_cs = -1
|
self._end_cs = -1
|
||||||
self._begin_dir = "un"
|
self._begin_dir = "un"
|
||||||
|
|
@ -71,7 +71,7 @@ class MeshingDialog(PamhyrDialog):
|
||||||
self._origin = self._reach.profile(0)
|
self._origin = self._reach.profile(0)
|
||||||
|
|
||||||
self._init_default_values_profiles()
|
self._init_default_values_profiles()
|
||||||
# self._init_default_values_guidelines()
|
self._init_default_values_guidelines()
|
||||||
|
|
||||||
self.set_double_spin_box(
|
self.set_double_spin_box(
|
||||||
"doubleSpinBox_space_step",
|
"doubleSpinBox_space_step",
|
||||||
|
|
@ -83,24 +83,14 @@ class MeshingDialog(PamhyrDialog):
|
||||||
else:
|
else:
|
||||||
self.set_radio_button("radioButton_spline", True)
|
self.set_radio_button("radioButton_spline", True)
|
||||||
|
|
||||||
self.find(QRadioButton, "radioButton_spline").setEnabled(False)
|
|
||||||
self.find(QRadioButton, "radioButton_linear").setEnabled(False)
|
|
||||||
|
|
||||||
def _init_default_values_profiles(self):
|
def _init_default_values_profiles(self):
|
||||||
profiles = self.profiles
|
profiles = self.profiles
|
||||||
|
|
||||||
self.combobox_add_items("comboBox_begin_rk", profiles)
|
self.combobox_add_items("comboBox_begin_rk", profiles)
|
||||||
self.combobox_add_items("comboBox_end_rk", profiles)
|
self.combobox_add_items("comboBox_end_rk", profiles)
|
||||||
|
|
||||||
r = self.parent.tableView\
|
self.set_combobox_text("comboBox_begin_rk", profiles[0])
|
||||||
.selectionModel()\
|
self.set_combobox_text("comboBox_end_rk", profiles[-1])
|
||||||
.selectedRows()
|
|
||||||
if len(r) <= 1:
|
|
||||||
self.set_combobox_text("comboBox_begin_rk", profiles[0])
|
|
||||||
self.set_combobox_text("comboBox_end_rk", profiles[-1])
|
|
||||||
else:
|
|
||||||
self.set_combobox_text("comboBox_begin_rk", profiles[r[0].row()])
|
|
||||||
self.set_combobox_text("comboBox_end_rk", profiles[r[-1].row()])
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def profiles(self):
|
def profiles(self):
|
||||||
|
|
@ -177,10 +167,8 @@ class MeshingDialog(PamhyrDialog):
|
||||||
self._begin_cs = self.profiles.index(p1)
|
self._begin_cs = self.profiles.index(p1)
|
||||||
self._end_cs = self.profiles.index(p2)
|
self._end_cs = self.profiles.index(p2)
|
||||||
|
|
||||||
# self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
||||||
# self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
||||||
|
|
||||||
self.parent.tableView.selectionModel().clearSelection()
|
|
||||||
|
|
||||||
super().accept()
|
super().accept()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ from PyQt5.QtWidgets import (
|
||||||
from Model.Geometry import Reach
|
from Model.Geometry import Reach
|
||||||
from Model.Except import exception_message_box
|
from Model.Except import exception_message_box
|
||||||
|
|
||||||
|
from Meshing.Mage import MeshingWithMage
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -238,7 +240,7 @@ class MeshingCommand(QUndoCommand):
|
||||||
self._mesher = mesher
|
self._mesher = mesher
|
||||||
self._command = command
|
self._command = command
|
||||||
|
|
||||||
self._profiles = [p.copy() for p in reach.profiles]
|
self._profiles = reach.profiles.copy()
|
||||||
self._profiles.reverse()
|
self._profiles.reverse()
|
||||||
|
|
||||||
self._new_profiles = None
|
self._new_profiles = None
|
||||||
|
|
@ -262,7 +264,7 @@ class MeshingCommand(QUndoCommand):
|
||||||
**self._data
|
**self._data
|
||||||
)
|
)
|
||||||
|
|
||||||
self._new_profiles = [p.copy() for p in self._reach.profiles]
|
self._new_profiles = self._reach.profiles.copy()
|
||||||
self._new_profiles.reverse()
|
self._new_profiles.reverse()
|
||||||
else:
|
else:
|
||||||
self._reach.purge()
|
self._reach.purge()
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ from View.Tools.Plot.PamhyrCanvas import MplCanvas
|
||||||
|
|
||||||
from View.SelectReach.Window import SelectReachWindow
|
from View.SelectReach.Window import SelectReachWindow
|
||||||
|
|
||||||
from Meshing.Internal import InternalMeshing
|
from Meshing.Mage import (
|
||||||
|
MeshingWithMage, MeshingWithMageMailleurTT
|
||||||
|
)
|
||||||
|
|
||||||
from View.Geometry.Table import GeometryReachTableModel
|
from View.Geometry.Table import GeometryReachTableModel
|
||||||
from View.Geometry.PlotXY import PlotXY
|
from View.Geometry.PlotXY import PlotXY
|
||||||
|
|
@ -296,6 +298,8 @@ class GeometryWindow(PamhyrWindow):
|
||||||
data = {
|
data = {
|
||||||
"step": dlg.space_step,
|
"step": dlg.space_step,
|
||||||
"limites": [dlg.begin_cs, dlg.end_cs],
|
"limites": [dlg.begin_cs, dlg.end_cs],
|
||||||
|
"directrices": [dlg.begin_dir, dlg.end_dir],
|
||||||
|
"lplan": dlg.lplan,
|
||||||
"linear": dlg.linear,
|
"linear": dlg.linear,
|
||||||
}
|
}
|
||||||
self._edit_meshing(data)
|
self._edit_meshing(data)
|
||||||
|
|
@ -305,10 +309,16 @@ class GeometryWindow(PamhyrWindow):
|
||||||
|
|
||||||
def _edit_meshing(self, data):
|
def _edit_meshing(self, data):
|
||||||
try:
|
try:
|
||||||
mesher = InternalMeshing()
|
mesher = MeshingWithMageMailleurTT()
|
||||||
self._table.meshing(mesher, data)
|
self._table.meshing(mesher, data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger_exception(e)
|
logger_exception(e)
|
||||||
|
raise ExternFileMissingError(
|
||||||
|
module="mage",
|
||||||
|
filename="MailleurTT",
|
||||||
|
path=MeshingWithMageMailleurTT._path(),
|
||||||
|
src_except=e
|
||||||
|
)
|
||||||
|
|
||||||
def update_rk(self):
|
def update_rk(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ from numpy import sqrt
|
||||||
|
|
||||||
from tools import timer, trace
|
from tools import timer, trace
|
||||||
|
|
||||||
from itertools import compress
|
|
||||||
|
|
||||||
from PyQt5.QtGui import (
|
from PyQt5.QtGui import (
|
||||||
QKeySequence, QColor
|
QKeySequence, QColor
|
||||||
)
|
)
|
||||||
|
|
@ -53,12 +51,8 @@ class TableModel(PamhyrTableModel):
|
||||||
self._lst = _river.reachs
|
self._lst = _river.reachs
|
||||||
elif self._opt_data == "profile":
|
elif self._opt_data == "profile":
|
||||||
self._lst = _river.reach(0).profiles
|
self._lst = _river.reach(0).profiles
|
||||||
# self._lst = list(filter(lambda x: x.name[0:8] != 'interpol',
|
|
||||||
# _river.reach(0).profiles))
|
|
||||||
elif self._opt_data == "raw_data":
|
elif self._opt_data == "raw_data":
|
||||||
self._lst = _river.reach(0).profiles
|
self._lst = _river.reach(0).profiles
|
||||||
# self._lst = list(filter(lambda x: x.name[0:8] != 'interpol',
|
|
||||||
# _river.reach(0).profiles))
|
|
||||||
elif self._opt_data == "solver":
|
elif self._opt_data == "solver":
|
||||||
self._lst = self._parent._solvers
|
self._lst = self._parent._solvers
|
||||||
|
|
||||||
|
|
@ -156,9 +150,7 @@ class TableModel(PamhyrTableModel):
|
||||||
if self._opt_data == "reach":
|
if self._opt_data == "reach":
|
||||||
self._lst = _river.reachs
|
self._lst = _river.reachs
|
||||||
elif self._opt_data == "profile" or self._opt_data == "raw_data":
|
elif self._opt_data == "profile" or self._opt_data == "raw_data":
|
||||||
# self._lst = _river.reach(reach).profiles
|
self._lst = _river.reach(reach).profiles
|
||||||
self._lst = list(compress(_river.reach(reach).profiles,
|
|
||||||
_river.reach(reach).profile_mask))
|
|
||||||
elif self._opt_data == "solver":
|
elif self._opt_data == "solver":
|
||||||
self._lst = self._parent._solvers
|
self._lst = self._parent._solvers
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,24 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>520</width>
|
<width>520</width>
|
||||||
<height>245</height>
|
<height>341</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="1" column="0">
|
<item row="3" column="0">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Parameters</string>
|
<string>Parameters</string>
|
||||||
|
|
@ -69,7 +79,7 @@
|
||||||
<string>Spline</string>
|
<string>Spline</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -78,9 +88,6 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Linear</string>
|
<string>Linear</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -101,14 +108,47 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="orientation">
|
<property name="title">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>Guideline used for distance computation</string>
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Second guideline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>First guideline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_end_gl">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox_begin_gl">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue