mindflow.geometry.Disk
- class mindflow.geometry.Disk(name, center, radius, dtype=np.float32, sampling_config=None)[source]
Definition of Disk object.
- Parameters
name (str) – name of the disk.
center (Union[tuple[int, int], tuple[float, float], list[int, int], list[float, float], numpy.ndarray]) – center coordinates of the disk.
dtype (numpy.dtype) – data type of sampled point data type. Default:
numpy.float32
.sampling_config (SamplingConfig) – sampling configuration. Default:
None
.
- Raises
ValueError – If center is neither list nor tuple of length 2.
ValueError – If radius is negative.
- Supported Platforms:
Ascend
GPU
Examples
>>> from mindflow.geometry import generate_sampling_config, Disk >>> disk_mesh = dict({'domain': dict({'random_sampling': False, 'size' : [100, 180]}), ... 'BC': dict({'random_sampling': False, 'size': 200, 'with_normal' : True,})}) >>> disk = Disk("disk", (-1.0, 0), 2.0, sampling_config=generate_sampling_config(disk_mesh)) >>> domain = disk.sampling(geom_type="domain") >>> bc, bc_normal = disk.sampling(geom_type="BC") >>> print(bc.shape) (200, 2)
- sampling(geom_type='domain')[source]
sampling domain and boundary points
- Parameters
geom_type (str) –
geometry type: can be
'domain'
or'BC'
. Default:'domain'
.'domain'
, feasible domain of the problem.'BC'
, boundary of the problem.
- Returns
Numpy.array. If the with_normal property of boundary configuration is true, returns 2D numpy array with boundary normal vectors. Otherwise, returns 2D numpy array without boundary normal vectors.
- Raises
ValueError – If config is
None
.KeyError – If geom_type is
'domain'
but config.domain isNone
.KeyError – If geom_type is
'BC'
but config.bc isNone
.ValueError – If geom_type is neither
'BC'
nor'domain'
.