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