Added automatic relabeling when same label splines have different normal vectors

This commit is contained in:
bkapidani 2019-01-30 01:19:46 +01:00
parent 4f40087866
commit fbe4fa4924
2 changed files with 11 additions and 1 deletions

@ -1 +1 @@
Subproject commit 2a150736601bb3113877bb673fb934bb60d46ec5 Subproject commit 085a29436a8c472caaaf7157aa644b571079bcaa

View File

@ -91,6 +91,8 @@ Returned is a dict with information to create the pml layer:
start_ndoms = ndoms = geo.GetNDomains() + 1 start_ndoms = ndoms = geo.GetNDomains() + 1
new_spline_domains = [] new_spline_domains = []
normals = {} normals = {}
duplicate_cnt = 0
for i, spline in enumerate(border): for i, spline in enumerate(border):
if i == 0: if i == 0:
global_start = Start(spline) + pml_size * spline.GetNormal(0) global_start = Start(spline) + pml_size * spline.GetNormal(0)
@ -98,6 +100,14 @@ Returned is a dict with information to create the pml layer:
next_spline = border[(i+1)%len(border)] next_spline = border[(i+1)%len(border)]
new_end = End(spline) + pml_size * spline.GetNormal(1) new_end = End(spline) + pml_size * spline.GetNormal(1)
spline_name = geo.GetBCName(spline.bc) spline_name = geo.GetBCName(spline.bc)
if "pml_" + spline_name in normals \
and normals["pml_" + spline_name] != spline.GetNormal(0):
duplicate_cnt += 1
spline_name = spline_name + "_duplicate_" + str(duplicate_cnt)
# ~ spline.SetBCName(spline_name + "_duplicate_" + str(duplicate_cnt))
# ~ spline_name = geo.GetBCName(spline.bc)
if (new_end - global_start).Norm() < tol: if (new_end - global_start).Norm() < tol:
new_spline_domains.append(ndoms) new_spline_domains.append(ndoms)
geo.Append(["line", current_start, global_start_pnt], bc="outer_" + spline_name, leftdomain = ndoms) geo.Append(["line", current_start, global_start_pnt], bc="outer_" + spline_name, leftdomain = ndoms)