mindelec.geometry.Rectangle
- class mindelec.geometry.Rectangle(name, coord_min, coord_max, dtype=np.float32, sampling_config=None)[source]
Definition of Rectangle object.
- Parameters
name (str) – name of the rectangle.
coord_min (Union[tuple[int, int], tuple[float, float], list[int, int], list[float, float], numpy.ndarray]) – coordinates of the bottom left corner of rectangle.
coord_max (Union[tuple[int, int], tuple[float, float], list[int, int], list[float, float], numpy.ndarray]) – coordinates of the top right corner of rectangle.
dtype (numpy.dtype) – data type of sampled point data type. Default: numpy.float32.
sampling_config (SamplingConfig) – sampling configuration. Default: None.
- Supported Platforms:
Ascend
Examples
>>> from easydict import EasyDict as edict >>> from mindelec.geometry import create_config_from_edict, Rectangle >>> rectangle_mesh = edict({'domain': edict({'random_sampling': False, 'size': [50, 25]}), ... 'BC': edict({'random_sampling': False, 'size': 300, 'with_normal': True,}),}) >>> rectangle = Rectangle("rectangle", (-3.0, 1), (1, 2), ... sampling_config=create_config_from_edict(rectangle_mesh)) >>> domain = rectangle.sampling(geom_type="domain") >>> bc, bc_normal = rectangle.sampling(geom_type="BC") >>> print(domain.shape) (1250, 2)