Skip to content

Conversation

piotrkluba
Copy link
Collaborator

@piotrkluba piotrkluba commented Oct 7, 2025

  • face grouping for snappy
  • two level geometry grouping (snappyBody/region)
  • wildcard support for both levels
  • messages with geometry missing or not found

General idea:
Faces in snappy have "two layers" of groupings - bodies that are the equivalent of a SearchableSurfaceWithGaps entity in OpenFoam and regions which are similar to normal patches. The goal of this changes is to allow to reference both those levels by simple indexing, including wildcards.

name_components = patch.name.split("::")
body_name = name_components[0]
if body_name not in snappy_body_mapping:
snappy_body_mapping[body_name] = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use default dict for initialization.

@property
def snappy_bodies(self):
"""Getter for the snappy registry."""
if hasattr(self, "snappy_body_registry") is False or self.snappy_body_registry is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you changed the constructor to always populate self.snappy_body_registry as None, the first statement will overshadowed?

"""Reset the face grouping"""
# pylint: disable=protected-access,no-member
self.internal_registry = self._entity_info._reset_grouping("face", self.internal_registry)
if hasattr(self, "snappy_body_registry") is True and self.snappy_body_registry:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

"SurfaceGroupedEntityType", frozen=True
)
private_attribute_entity_type_name: Literal["SnappyBody"] = pd.Field("SnappyBody", frozen=True)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please populate private_attribute_id too here.

from flow360.exceptions import Flow360ValueError


class DoubleIndexableList(list):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of this DoubleIndexableList seems redundant? See my other comment.

Get the full list of boundaries.
If attribute_name is supplied then ignore stored face_group_tag and use supplied one.
"""
if self.face_group_tag == GROUPED_SNAPPY and attribute_name is None:
Copy link
Collaborator

@benflexcompute benflexcompute Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add this if the faces are already grouped with faceId? Wouldn't the previous method give correct list of boundaries?


surfaces: List[Surface] = pd.Field()

def __getitem__(self, key: str):
Copy link
Collaborator

@benflexcompute benflexcompute Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we still need to get Surface entities from SnappyBody?
To select a surface with pattern patch* under SnappyBodies with pattern tunne* we can just do:

my_geo["tunne*::patch*"]

Why do user want to instead do:

my_geo.snappy_body["tunne*"]["patch*"]

which is longer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a discussion with @piotrkluba and this is just a syntax candy for snappy user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants