mindscience.data.Cuboid

class mindscience.data.Cuboid(name, coord_min, coord_max, dtype=numpy.float32, sampling_config=None)[source]

Definition of Cuboid object.

Parameters
  • name (str) – Name of the cuboid.

  • coord_min (Union[tuple, list, numpy.ndarray]) – Coordinates of the bottom left back corner of cuboid. If the parameter type is tuple or list, each element should be of type int or float, and its length must be 3.

  • coord_max (Union[tuple, list, numpy.ndarray]) – Coordinates of the top right front corner of cuboid. If the parameter type is tuple or list, each element should be of type int or float, and its length must be 3.

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

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

Examples

>>> from mindscience.data import generate_sampling_config, Cuboid
>>> cuboid_mesh = dict({'domain': dict({'random_sampling': False, 'size': [50, 50, 25]}),
...                      'BC': dict({'random_sampling': False, 'size': 1000, 'with_normal': True,}),})
>>> cuboid = Cuboid("cuboid", (-3.0, 1, 0), (1, 2, 1), sampling_config=generate_sampling_config(cuboid_mesh))
>>> domain = cuboid.sampling(geom_type="domain")
>>> bc, bc_normal = cuboid.sampling(geom_type="BC")
>>> print(domain.shape)
(62500, 3)