mindelec.geometry.Disk

class mindelec.geometry.Disk(name, center, radius, dtype=np.float32, sampling_config=None)[source]

Definition of Disk object.

Parameters
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: 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 is None.

  • KeyError – If geom_type is BC but config.bc is None.

  • ValueError – If geom_type is neither BC nor domain.