mirror of https://gitlab.com/pamhyr/pamhyr2
speed up internal meshing
parent
315b913fd0
commit
fb09cf254e
|
|
@ -56,15 +56,17 @@ class InternalMeshing(AMeshingTool):
|
|||
step)
|
||||
|
||||
for new_profiles2 in new_profiles:
|
||||
print(f"purge...")
|
||||
for p in new_profiles2:
|
||||
p.purge_aligned_points()
|
||||
p.hard_purge_aligned_points()
|
||||
print(f"fin purge")
|
||||
|
||||
return new_profiles
|
||||
|
||||
def st_to_m(self, reach, limites):
|
||||
|
||||
gl = reach.compute_guidelines()
|
||||
profiles = [reach.profiles[i].copy()
|
||||
profiles = [reach.profile(i).copy()
|
||||
for i in range(limites[0], limites[1]+1)
|
||||
]
|
||||
|
||||
|
|
@ -99,6 +101,7 @@ class InternalMeshing(AMeshingTool):
|
|||
max_values_index[-1] = j
|
||||
|
||||
for i in range(len(max_values)):
|
||||
print(f"compl_sect {i}...")
|
||||
for isect in range(max_values_index[i], len(profiles)-1):
|
||||
self.compl_sect(profiles[isect],
|
||||
profiles[isect+1],
|
||||
|
|
@ -107,6 +110,7 @@ class InternalMeshing(AMeshingTool):
|
|||
self.compl_sect(profiles[isect+1],
|
||||
profiles[isect],
|
||||
gl1[i], gl2[i])
|
||||
print(f"fin compl_sect {i}")
|
||||
return profiles
|
||||
|
||||
def interpolate_transversal_step(self,
|
||||
|
|
@ -122,27 +126,31 @@ class InternalMeshing(AMeshingTool):
|
|||
|
||||
new_profiles = []
|
||||
for i in range(len(profiles)-1):
|
||||
print(f"interpolate sect {i}...")
|
||||
new_profiles2 = []
|
||||
d = 1.0/float(np[i]+1)
|
||||
for j in range(np[i]):
|
||||
p = profiles[i].copy()
|
||||
# RATIO entre les deux sections initiales
|
||||
dj = float(j+1)*d
|
||||
for k in range(len(profiles[i].points)):
|
||||
p.points[k].x = profiles[i].points[k].x + \
|
||||
dj*(profiles[i+1].points[k].x -
|
||||
profiles[i].points[k].x)
|
||||
p.points[k].y = profiles[i].points[k].y + \
|
||||
dj*(profiles[i+1].points[k].y -
|
||||
profiles[i].points[k].y)
|
||||
p.points[k].z = profiles[i].points[k].z + \
|
||||
dj*(profiles[i+1].points[k].z -
|
||||
profiles[i].points[k].z)
|
||||
pt1 = profiles[i].points
|
||||
pt2 = profiles[i+1].points
|
||||
for k in range(len(pt1)):
|
||||
p.points[k].x = pt1[k].x + \
|
||||
dj*(pt2[k].x -
|
||||
pt1[k].x)
|
||||
p.points[k].y = pt1[k].y + \
|
||||
dj*(pt2[k].y -
|
||||
pt1[k].y)
|
||||
p.points[k].z = pt1[k].z + \
|
||||
dj*(pt2[k].z -
|
||||
pt1[k].z)
|
||||
p.rk = profiles[i].rk + \
|
||||
dj*(profiles[i+1].rk -
|
||||
profiles[i].rk)
|
||||
p.name = f'interpol{p.rk}'
|
||||
new_profiles2.append(p)
|
||||
print(f"fin interpolate sect {i}")
|
||||
new_profiles.append(new_profiles2)
|
||||
return new_profiles
|
||||
|
||||
|
|
|
|||
|
|
@ -1132,3 +1132,18 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
align = True
|
||||
self.delete_i([i])
|
||||
break
|
||||
|
||||
def hard_purge_aligned_points(self):
|
||||
align = True
|
||||
points = self.points
|
||||
while (align):
|
||||
align = False
|
||||
for i in range(1, len(points) - 1):
|
||||
d = points[i].dist_from_seg(points[i-1],
|
||||
points[i+1])
|
||||
if d < 0.00001 and points[i].name == "":
|
||||
align = True
|
||||
points.pop(i)
|
||||
break
|
||||
self._points = points
|
||||
self.modified()
|
||||
|
|
|
|||
Loading…
Reference in New Issue