Skip to content

Commit 4261f94

Browse files
[Hotfix 25.9]: [FXC-6883] fix(): trim boundary lookup names during split matching (#1966)
Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com>
1 parent 93f7165 commit 4261f94

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

flow360/component/simulation/framework/boundary_split.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,15 @@ def _add_zone_boundary_matches(self, volume_mesh_meta_data: dict) -> None:
375375

376376
def get_split_info(self, base_name: str) -> List[BoundarySplitInfo]:
377377
"""Get all split info for a base boundary name."""
378-
return self._mapping.get(base_name, [])
378+
split_infos = self._mapping.get(base_name, [])
379+
if split_infos:
380+
return split_infos
381+
382+
normalized_name = base_name.strip()
383+
if normalized_name != base_name:
384+
return self._mapping.get(normalized_name, [])
385+
386+
return []
379387

380388

381389
# --- Entity update functions (external entry point) ---

tests/simulation/framework/test_boundary_split.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,35 @@ def test_single_zone_lookup(self, single_zone_mesh_metadata):
125125
assert len(split_infos) == 1
126126
assert split_infos[0].full_name == "fluid/wing"
127127

128+
def test_lookup_trims_leading_and_trailing_whitespace(self, single_zone_mesh_metadata):
129+
"""Test that leading/trailing whitespace is ignored during lookup."""
130+
lookup_table = BoundaryNameLookupTable(single_zone_mesh_metadata)
131+
132+
for candidate in (" wing", "wing ", " wing ", " fluid/wing ", "\twing\n"):
133+
split_infos = lookup_table.get_split_info(candidate)
134+
assert len(split_infos) == 1
135+
assert split_infos[0].full_name == "fluid/wing"
136+
137+
def test_lookup_does_not_normalize_internal_whitespace(self):
138+
"""Test that internal whitespace differences do not match."""
139+
mesh_metadata = {
140+
"zones": {
141+
"fluid": {
142+
"boundaryNames": [
143+
"fluid/panel left",
144+
],
145+
},
146+
}
147+
}
148+
lookup_table = BoundaryNameLookupTable(mesh_metadata)
149+
150+
split_infos = lookup_table.get_split_info("panel left")
151+
assert len(split_infos) == 1
152+
assert split_infos[0].full_name == "fluid/panel left"
153+
154+
assert lookup_table.get_split_info("panel left") == []
155+
assert lookup_table.get_split_info("fluid/panel left") == []
156+
128157
def test_empty_metadata(self):
129158
"""Test with empty metadata."""
130159
lookup_table = BoundaryNameLookupTable({})

0 commit comments

Comments
 (0)