mindelec.geometry.Geometry
- class mindelec.geometry.Geometry(name, dim, coord_min, coord_max, dtype=np.float32, sampling_config=None)[source]
Definition of Geometry object.
- Parameters
name (str) – name of the geometry.
dim (int) – number of dimensions.
coord_min (Union[tuple[int, int], tuple[float, float], list[int, int], list[float, float], numpy.ndarray]) – minimal coordinate of the geometry.
coord_max (Union[tuple[int, int], tuple[float, float], list[int, int], list[float, float], numpy.ndarray]) – maximal coordinate of the geometry.
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, Geometry >>> geometry_config = edict({'domain' : edict({'random_sampling' : True, 'size' : 100}), ... 'BC' : edict({'random_sampling' : True, 'size' : 100, 'sampler' : 'uniform',}), ... 'random_merge' : True,}) >>> sampling_config = create_config_from_edict(geometry_config) >>> geom = Geometry("geom", 1, 0.0, 1.0, sampling_config=sampling_config) >>> geom.set_name("geom_name")
- set_name(name)[source]
set geometry instance name.
Examples
>>> from mindelec.geometry import create_config_from_edict, Geometry >>> geom = Geometry("geom", 1, 0.0, 1.0) >>> geom.set_name("geom_name")
- set_sampling_config(sampling_config: SamplingConfig)[source]
set sampling info.
- Parameters
sampling_config (SamplingConfig) – sampling configuration.
- Raises
TypeError – If sampling_config is not instance of SamplingConfig.
Examples
>>> from easydict import EasyDict as edict >>> from mindelec.geometry import create_config_from_edict, Geometry >>> geometry_config = edict({'domain': edict({'random_sampling': True, 'size': 100}), ... 'BC': edict({'random_sampling': True, 'size': 100, 'sampler': 'uniform',}), ... 'random_merge': True,}) >>> sampling_config = create_config_from_edict(geometry_config) >>> geom = Geometry("geom", 1, 0.0, 1.0) >>> geom.set_sampling_config(sampling_config)