mindelec.geometry.Disk
- class mindelec.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, float], list[int, 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
Examples
>>> from easydict import EasyDict as edict >>> from mindelec.geometry import create_config_from_edict, Disk >>> disk_mesh = edict({'domain': edict({'random_sampling': False, 'size' : [100, 180]}), ... 'BC': edict({'random_sampling': False, 'size': 200, 'with_normal' : True,})}) >>> disk = Disk("disk", (-1.0, 0), 2.0, sampling_config=create_config_from_edict(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
- Returns
Numpy.array, 2D numpy array with or without boundary normal vectors
- Raises
ValueError – If config is None.
KeyError – If geom_type is domain but config.domain is None.
KeyError – If geom_type is BC but config.bc is None.
ValueError – If geom_type is neither BC nor domain.