From 025ed39a9eb481249077c3d0f3af3a6b8e2f299c Mon Sep 17 00:00:00 2001 From: Philipp Holl Date: Mon, 3 Jun 2024 21:05:29 +0200 Subject: [PATCH] [field] Fix sampling mesh to grid --- phi/field/_resample.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/phi/field/_resample.py b/phi/field/_resample.py index 3820b8b2e..e6b675332 100644 --- a/phi/field/_resample.py +++ b/phi/field/_resample.py @@ -157,9 +157,7 @@ def sample(field: Union[Field, Geometry, FieldInitializer, Callable], faces = math.unstack(slice_off_constant_faces(geometry.faces, geometry.boundary_faces, boundary), dual) sampled = [sample(field, face, **kwargs) for face in faces] return math.stack(sampled, dual(geometry.face_shape)) - elif field.is_mesh and field.is_centered: - if not field.geometry.shallow_equals(geometry): - raise NotImplementedError("Resampling to different mesh is not yet supported") + elif field.is_mesh and field.is_centered and field.geometry.shallow_equals(geometry): return centroid_to_faces(field, boundary, **kwargs) elif field.is_mesh and field.is_staggered and field.geometry.shallow_equals(geometry): return field.with_boundary(boundary)