Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Fix float type from fp64 to fp32 for area and sdf #707

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ppsci/geometry/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def sdf_func(self, points: np.ndarray) -> np.ndarray:
import pymesh

sdf, _, _, _ = pymesh.signed_distance_to_mesh(self.py_mesh, points)
sdf = sdf[..., np.newaxis]
sdf = sdf[..., np.newaxis].astype(paddle.get_default_dtype())
return sdf

def is_inside(self, x):
Expand Down Expand Up @@ -478,7 +478,9 @@ def random_points(self, n, random="pseudo", criteria=None):

all_points = np.concatenate(all_points, axis=0)
cuboid_volume = np.prod([b[1] - b[0] for b in self.bounds])
all_areas = np.full((n, 1), cuboid_volume * (_nvalid / _nsample) / n)
all_areas = np.full(
(n, 1), cuboid_volume * (_nvalid / _nsample) / n, paddle.get_default_dtype()
)
return all_points, all_areas

def sample_interior(
Expand Down