mindelec.geometry.HyperCube

class mindelec.geometry.HyperCube(name, dim, coord_min, coord_max, dtype=np.float32, sampling_config=None)[source]

Definition of HyperCube object.

Parameters
Raises

TypeError – sampling_config is not instance of class SamplingConfig.

Supported Platforms:

Ascend

Examples

>>> from easydict import EasyDict as edict
>>> from mindelec.geometry import create_config_from_edict, HyperCube
>>> hypercube_random = edict({
...      'domain': edict({
...          'random_sampling': True,
...          'size': 1000,
...          'sampler': 'uniform'
...         }),
...      'BC': edict({
...          'random_sampling': True,
...          'size': 200,
...          'sampler': 'uniform',
...          'with_normal': False,
...      }),
...  })
>>> sampling_config = create_config_from_edict(hypercube_random)
>>> hypercube = HyperCube("HyperCube", 3, [-1, 2, 1], [0, 3, 2], sampling_config=sampling_config)
>>> domain = hypercube.sampling(geom_type="domain")
>>> bc = hypercube.sampling(geom_type="BC")
>>> print(domain.shape)
(1000, 3)
sampling(geom_type='domain')[source]

sampling 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.