mindflow.geometry.Cylinder

View Source On Gitee
class mindflow.geometry.Cylinder(name, centre, radius, h_min, h_max, h_axis, boundary_type='uniform', dtype=numpy.float32, sampling_config=None)[source]

Definition of cylinder object.

Parameters
  • name (str) – name of the cylinder.

  • centre (numpy.ndarray) – origin of the bottom disk.

  • radius (float) – Radius of the cylinder.

  • h_min (float) – Height coordinate of the bottom disk.

  • h_max (float) – Height coordinate of the top disk.

  • h_axis (int) – Axis of the normal vector of the bottom disk.

  • boundary_type (str) –

    this can be 'uniform' or 'unweighted'. Default: 'uniform'.

    • 'uniform', the expected number of samples in each boundary is proportional to the area (length) of the boundary.

    • 'unweighted', the expected number of samples in each boundary is the same.

  • dtype (numpy.dtype) – data type of sampled point data type. Default: numpy.float32.

  • sampling_config (SamplingConfig) – sampling configuration. Default: none.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindflow.geometry import generate_sampling_config, Cylinder
>>> cylinder_mesh = dict({'domain': dict({'random_sampling': True, 'size': 300}),
...                       'BC': dict({'random_sampling': True, 'size': 300, 'with_normal': False,}),})
>>> vertices = np.array([[0., .1, 0.], [.9, .2, .1], [.5, .6, 0.1], [.6, .5, .8]])
>>> centre = np.array([0., 0.5])
>>> radius = 1.5
>>> h_min = -7.
>>> h_max = 7.
>>> h_axis = 2
>>> cylinder = Cylinder("cylinder", centre, radius, h_min, h_max, h_axis,
...                     sampling_config=generate_sampling_config(cylinder_mesh))
>>> domain = cylinder.sampling(geom_type="domain")
>>> bc = cylinder.sampling(geom_type="bc")
>>> print(domain.shape)
(300, 2)