Skip to content

Commit a9978ad

Browse files
committed
Throw error if full_name not present in an entity
1 parent aee57b8 commit a9978ad

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

flow360/component/simulation/outputs/outputs.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,18 +1727,24 @@ def ensure_surfaces_have_wall_bc(self, param_info: ParamsValidationInfo):
17271727
if isinstance(model, Wall) and model.entities is not None:
17281728
expanded_entities = param_info.expand_entity_list(model.entities)
17291729
for entity in expanded_entities:
1730-
if hasattr(entity, "full_name"):
1731-
wall_surface_names.add(entity.full_name)
1732-
elif hasattr(entity, "name"):
1733-
wall_surface_names.add(entity.name)
1730+
if not hasattr(entity, "full_name"):
1731+
raise TypeError(
1732+
f"Unsupported entity type '{type(entity).__name__}' for Wall BC. "
1733+
f"Only Surface entities are supported."
1734+
)
1735+
wall_surface_names.add(entity.full_name)
17341736

17351737
# Check that all specified surfaces have Wall BC
17361738
expanded_entities = param_info.expand_entity_list(self.entities)
17371739
non_wall_surfaces = []
17381740
for entity in expanded_entities:
1739-
entity_name = entity.full_name if hasattr(entity, "full_name") else entity.name
1740-
if entity_name not in wall_surface_names:
1741-
non_wall_surfaces.append(entity_name)
1741+
if not hasattr(entity, "full_name"):
1742+
raise TypeError(
1743+
f"Unsupported entity type '{type(entity).__name__}' for force distribution output. "
1744+
f"Only Surface entities are supported."
1745+
)
1746+
if entity.full_name not in wall_surface_names:
1747+
non_wall_surfaces.append(entity.full_name)
17421748

17431749
if non_wall_surfaces:
17441750
raise ValueError(

flow360/component/simulation/translator/solver_translator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,10 +832,12 @@ def _get_wall_bc_surface_names(input_params) -> list:
832832
if isinstance(bc, Wall) and bc.entities is not None:
833833
expanded_entities = _expand_entity_list(bc.entities, input_params)
834834
for entity in expanded_entities:
835-
if hasattr(entity, "full_name"):
836-
surface_names.append(entity.full_name)
837-
elif hasattr(entity, "name"):
838-
surface_names.append(entity.name)
835+
if not hasattr(entity, "full_name"):
836+
raise TypeError(
837+
f"Unsupported entity type '{type(entity).__name__}' for force distribution output. "
838+
f"Only Surface entities are supported."
839+
)
840+
surface_names.append(entity.full_name)
839841
return surface_names
840842

841843

0 commit comments

Comments
 (0)