Skip to content

Commit

Permalink
[geom] Fix Mesh.face_shape sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Jan 12, 2025
1 parent 573bc31 commit 9976dbd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions phi/geom/_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ def _build_faces(self):

@property
def face_shape(self) -> Shape:
return instance(self.elements) & dual
if not self.boundary_faces:
return instance(self) & dual
dual_len = max([next(iter(sl.values())).stop for sl in self.boundary_faces.values()])
dim = instance(self)
return dim.as_dual().with_size(dual_len) + dim

@property
def sets(self):
Expand Down Expand Up @@ -156,7 +160,7 @@ def interior_faces(self) -> Dict[str, slice]:
def pad_boundary(self, value: Tensor, widths: Dict[str, Dict[str, slice]] = None, mode: Extrapolation or Tensor or Number = 0, **kwargs) -> Tensor:
mode = as_extrapolation(mode)
if self.face_shape.dual.name not in value.shape:
value = rename_dims(value, instance, self.face_shape.dual)
value = rename_dims(value, instance, self.face_shape.dual.without_sizes())
else:
raise NotImplementedError
if widths is None:
Expand Down

0 comments on commit 9976dbd

Please sign in to comment.