-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[field] Fix deprecated Hard/SoftGeometryMask
- Loading branch information
Philipp Holl
committed
Dec 2, 2024
1 parent
539cdc3
commit 5a61173
Showing
2 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from unittest import TestCase | ||
|
||
from phiml import math | ||
from phi.geom import Sphere | ||
from phi.physics._boundaries import Domain | ||
from phi.field import * | ||
|
||
|
||
class TestNoise(TestCase): | ||
|
||
def test_masks(self): | ||
domain = Domain(x=10, y=10) | ||
sphere = Sphere(x=5, y=5, radius=2) | ||
hard_v = domain.staggered_grid(HardGeometryMask(sphere)) | ||
hard_s = domain.grid(HardGeometryMask(sphere)) | ||
soft_v = domain.staggered_grid(SoftGeometryMask(sphere)) | ||
soft_s = domain.grid(SoftGeometryMask(sphere)) | ||
for f in [hard_v, hard_s, soft_v, soft_s]: | ||
math.assert_close(1, f.values.max) | ||
math.assert_close(0, f.values.min) |