Skip to content

Commit

Permalink
integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
GBenedett committed Dec 1, 2023
1 parent ff4b516 commit 542f968
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions ceasiompy/CPACS2SUMO/cpacs2sumo.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ def convert_cpacs_to_sumo(cpacs_path, cpacs_out_path):

if body_frm_height < 0.01:
body_frm_height = 0.01

body_frm_width = (
prof_size_y
* 2
Expand Down Expand Up @@ -632,19 +631,12 @@ def convert_cpacs_to_sumo(cpacs_path, cpacs_out_path):
# round(prof_vect_z[i],4) == round(prof_vect_z[i-1],4)):
if round(prof_vect_z[i], 4) != round(prof_vect_z[i - 1], 4):
prof_str += (
str(round(prof_vect_x[0], 4))
str(round(prof_vect_x[i], 4))
+ " "
+ str(round(prof_vect_z[0], 4))
+ str(round(prof_vect_z[i], 4))
+ " "
)

for i in range(1, len(prof_vect_x)):
dx_squared = (prof_vect_x[i] - prof_vect_x[i - 1]) ** 2
dz_squared = (prof_vect_z[i] - prof_vect_z[i - 1]) ** 2

if dx_squared + dz_squared > 1e-8:
prof_str += f"{round(prof_vect_x[i], 4)} {round(prof_vect_z[i], 4)} "

sumo.addTextElementAtIndex(wg_sk_xpath, "WingSection", prof_str, wing_sec_index)
wg_sec_xpath = wg_sk_xpath + "/WingSection[" + str(wing_sec_index) + "]"
sumo.addTextAttribute(wg_sec_xpath, "airfoil", prof_uid)
Expand Down Expand Up @@ -891,15 +883,16 @@ def convert_cpacs_to_sumo(cpacs_path, cpacs_out_path):
# then TE(1 0), but not reverse way.

# to avoid double zero, not accepted by SUMO
prof_str += (
str(round(prof_vect_x[0], 4)) + " " + str(round(prof_vect_z[0], 4)) + " "
)
for i in range(1, len(prof_vect_x)):
dx_squared = (prof_vect_x[i] - prof_vect_x[i - 1]) ** 2
dz_squared = (prof_vect_z[i] - prof_vect_z[i - 1]) ** 2

if dx_squared + dz_squared > 1e-6:
prof_str += f"{round(prof_vect_x[i], 4)} {round(prof_vect_z[i], 4)} "
for i, item in enumerate(prof_vect_x):
# if not (prof_vect_x[i] == prof_vect_x[i-1] or \
# round(prof_vect_z[i],4) == round(prof_vect_z[i-1],4)):
if round(prof_vect_z[i], 4) != round(prof_vect_z[i - 1], 4):
prof_str += (
str(round(prof_vect_x[i], 4))
+ " "
+ str(round(prof_vect_z[i], 4))
+ " "
)

sumo.addTextElementAtIndex(wg_sk_xpath, "WingSection", prof_str, wing_sec_index)
wg_sec_xpath = wg_sk_xpath + "/WingSection[" + str(wing_sec_index) + "]"
Expand Down

0 comments on commit 542f968

Please sign in to comment.