Skip to content

Commit

Permalink
Handle no matches for metric tensor setters.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchapman committed Sep 10, 2024
1 parent d0d5947 commit 8938b40
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/bout_v6_coordinates_upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def use_metric_accessors(original_string):
# find lines like: c->g_11 = x; and c.g_11 = x;
pattern_setting_metric_component = r"(\b.+\-\>|\.)(g_?)(\d\d)\s?\=\s?(.+)(?=;)"
line_matches = re.findall(pattern_setting_metric_component, original_string)

if len(line_matches) == 0:
return lines

metric_components = {
match[1] + match[2]: match[3]
for match in line_matches
Expand Down Expand Up @@ -153,6 +157,7 @@ def replacement_for_division_assignment(match):

# Deal with the basic find-and-replace cases that do not involve multiple lines
def replace_one_line_cases(modified):

metric_component = r"g_?\d\d"
mesh_spacing = r"d[xyz]"

Expand Down

0 comments on commit 8938b40

Please sign in to comment.