Skip to content

【PPSCI Doc No.41-57】 #833

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

Merged
merged 13 commits into from
Apr 7, 2024
Merged

【PPSCI Doc No.41-57】 #833

merged 13 commits into from
Apr 7, 2024

Conversation

wufei2
Copy link
Contributor

@wufei2 wufei2 commented Apr 6, 2024

PR types

Others

PR changes

Others

Describe

对以下文档进行了补全:
ppsci.geometry.Geometry.and
ppsci.geometry.Geometry.or
ppsci.geometry.Geometry.sub
ppsci.geometry.Geometry.str
ppsci.geometry.Geometry.difference
ppsci.geometry.Geometry.intersection
ppsci.geometry.Geometry.is_inside
ppsci.geometry.Geometry.on_boundary
ppsci.geometry.Geometry.periodic_point
ppsci.geometry.Geometry.random_boundary_points
ppsci.geometry.Geometry.random_points
ppsci.geometry.Geometry.sample_boundary
ppsci.geometry.Geometry.sample_interior
ppsci.geometry.Geometry.sdf_derivatives
ppsci.geometry.Geometry.uniform_boundary_points
ppsci.geometry.Geometry.uniform_points
ppsci.geometry.Geometry.union

Copy link

paddle-bot bot commented Apr 6, 2024

Thanks for your contribution!

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢提交PR,修改得很仔细👍。有几处小问题可以按照建议辛苦修改一下。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 函数的参数可以加上和typehint,与docstring保持一(当类型注解为类自身时,建议加上双引号,比如
    geom: "Geometry"
  2. docstring的 Returns 类型外面好像不需要套上小括号?

where D is the number of dimension of geometry.

Returns:
(np.ndarray): Boolean array where x is inside the geometry. The shape is [N, 1].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

实测输出形状应该是[N],下面类似的可以一起改一下

[ 0.25868416]], dtype=float32), 'sdf__y': array([[-0. ],
[ 0.74118376]], dtype=float32)}
>>> cuboid = ppsci.geometry.Cuboid((0, 0, 0), (1, 1, 1))
>>> cuboid.sample_interior(2,"pseudo", None, True, True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参数之间的逗号后面加上空格

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All done

@wufei2 wufei2 requested a review from HydrogenSulfate April 6, 2024 14:53
@wufei2 wufei2 changed the title PPSCI Doc No.41-57 【PPSCI Doc No.41-57】 Apr 7, 2024
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有几处可能漏了的地方,还辛苦修改一下

n,
random="pseudo",
n: int,
random: str = "pseudo",
criteria=None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

criteria的类型注解是Optional[Callable]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认值为None的类型注解需要在原类型外面加上Optional,比如Optional[bool]

def sample_boundary(self, n, random="pseudo", criteria=None, evenly=False):
"""Compute the random points in the geometry and return those meet criteria."""
def sample_boundary(
self, n: int, random: str = "pseudo", criteria=None, evenly=False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

比如,这里可以改为:criteria: Optional[Callable]evenly: bool = False

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Apr 7, 2024
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Apr 7, 2024
@PaddlePaddle PaddlePaddle unlocked this conversation Apr 7, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件开头加一下:
from typing import Callable
from typing import Dict

Comment on lines 137 to 139
np.ndarray: Random points in the geometry. The shape is [N, D].
their signed distance function. The shape is [N].
their derivatives of SDF(optional). The shape is [N].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 返回值是Dict[str, np.ndarray],而不是np.ndarray
  2. their signed distance function. The shape is [N, 1].
  3. their derivatives of SDF(optional). The shape is [N, D].

Comment on lines 227 to 230
Returns:
np.ndarray: Random points in the geometry. The shape is [N, D].
their normal vectors. The shape is [N, D].
their area. The shape is [N].(only if the geometry is a mesh)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

"""Compute the random points in the geometry and return those meet criteria."""
def sample_boundary(
self, n: int, random: str = "pseudo", criteria: Optional[Callable] = None, evenly: bool = False
) -> np.ndarray:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

compute_sdf_derivatives: bool = False,
):
"""Sample random points in the geometry and return those meet criteria."""
) -> np.ndarray:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

返回值类型改为Dict[str, np.ndarray]

Comment on lines 349 to 354
def uniform_boundary_points(self, n: int):
"""Compute the equi-spaced points on the boundary."""
"""Compute the equi-spaced points on the boundary(not implemented).

Warings:
This function is not implemented, please use random_boundary_points instead.
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充一下返回值类型

@wufei2 wufei2 requested a review from HydrogenSulfate April 7, 2024 07:07
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HydrogenSulfate HydrogenSulfate merged commit e004a8c into PaddlePaddle:develop Apr 7, 2024
3 of 4 checks passed
@luotao1
Copy link
Collaborator

luotao1 commented Apr 8, 2024

hi, @wufei2

  • 非常感谢你对飞桨的贡献,我们正在运营一个PFCC组织,会通过定期分享技术知识与发布开发者主导任务的形式持续为飞桨做贡献,详情可见 https://github.com/luotao1 主页说明。
  • 如果你对PFCC有兴趣,请发送邮件至 ext_paddle_oss@baidu.com,我们会邀请你加入~

huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
* fix docs bugs

* fix docs bugs

* fix codestyle bug

* fix codestyle bugs

* fix codestyle bugs

* fix some bugs

* fix codetype error

* fix other bugs

* fix typehint bugs

* fix other bugs

* fix codestyle bug

* fix codestyle bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants