mindelec.geometry.Interval

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

Definition of Interval object.

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

  • coord_min (Union[int, float]) – left of the interval.

  • coord_max (Union[int, float]) – right of the interval.

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

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

Raises

ValueError – If coord_min or coord_max is neither int nor float .

Supported Platforms:

Ascend

Examples

>>> from easydict import EasyDict as edict
>>> from mindelec.geometry import create_config_from_edict, Interval
>>> line_config = edict({'domain': edict({'random_sampling': True, 'size': 100, 'sampler': 'uniform'}),
...                      'BC': edict({'random_sampling': True, 'size': 10, 'sampler': 'uniform',}),})
>>> line = Interval("line", -1.0, 1.0, sampling_config=create_config_from_edict(line_config))
>>> domain = line.sampling(geom_type="domain")
>>> bc = line.sampling(geom_type="BC")
>>> print(bc.shape)
(10, 1)