Returns this field as a PointCloud. This replaces the `Field.geometry` with a `phi.geom.Point` instance while leaving the sample points unchanged. See Also: `Field.as_spheres()`. Args: list_dim: If not `None`, packs spatial, instance and dua
(self, list_dim: Optional[Shape] = instance('elements'))
| 299 | return Field(UniformGrid(resolution, bounds), self, self.boundary) |
| 300 | |
| 301 | def as_points(self, list_dim: Optional[Shape] = instance('elements')) -> 'Field': |
| 302 | """ |
| 303 | Returns this field as a PointCloud. |
| 304 | This replaces the `Field.geometry` with a `phi.geom.Point` instance while leaving the sample points unchanged. |
| 305 | |
| 306 | See Also: |
| 307 | `Field.as_spheres()`. |
| 308 | |
| 309 | Args: |
| 310 | list_dim: If not `None`, packs spatial, instance and dual dims. |
| 311 | Defaults to `instance('elements')`. |
| 312 | |
| 313 | Returns: |
| 314 | `Field` with same values and boundaries but `Point` geometry. |
| 315 | """ |
| 316 | points = self.sampled_elements.center |
| 317 | values = self.values |
| 318 | if list_dim: |
| 319 | dims = non_batch(points).non_channel & non_batch(points).non_channel |
| 320 | points = pack_dims(points, dims, list_dim) |
| 321 | values = pack_dims(values, dims, list_dim) |
| 322 | return Field(Point(points), values, self.boundary) |
| 323 | |
| 324 | def as_spheres(self, list_dim: Optional[Shape] = instance('elements')) -> 'Field': |
| 325 | """ |