PyMSES

Table Of Contents

Previous topic

Dimensional physical constants

This Page

Geometrical region module

pymses.utils.regions — Regions module

class Region

Generic region class

contains(points)
Parameters :

points : float array of 3D points coordinates

Returns :

points : boolean array

True when points coordinates are inside the region

random_points(npoints, ensure_exact_count=True)

Generates a set of randomly distrubuted points in the region

Parameters :

npoints : int

number of points to generate

ensure_exact_count : boolean (default True)

whether the exact required number of random points are generated or not

Returns :

points : array

ramdom points array

class Sphere(center, radius)

Bases: pymses.utils.regions.Region

Spherical region class

Parameters :

center : 3-tuple of float

sphere center coordinates

radius : float

radius of the sphere

Examples

>>> sph = Sphere((0.5, 0.5, 0.5), 1.0)
contains(points)

TODO

get_bounding_box()

TODO

get_volume()
Returns :

V : float

volume of the sphere (radius r) given by V = \frac{4}{3} \pi r^{3}

class SphericalShell(center, radius_in, radius_out)

Bases: pymses.utils.regions.Region

Spherical shell class

Parameters :

center : 3-tuple of float

spherical shell center coordinates

radius_in : float

radius of the innerr sphere

radius_out : float

radius of the outer sphere

Examples

>>> sph_shell = SphericalShell((0.5, 0.5, 0.5), 0.5, 0.6)
contains(points)

TODO

get_bounding_box()

TODO

get_volume()
Returns :

V : float

volume of the spherical shell (r_{in}<r<r_{out}) given by V = \frac{4}{3} \pi (r_{out}^{3}-r_{in}^{3})

class Box(bounds)

Bases: pymses.utils.regions.Region

Box region class

Parameters :

bounds : 2-tuple of list

box region boundary min and max positions as a (min, max) tuple of coordinate arrays

Examples

>>> min_coords = [0.1, 0.2, 0.25]
>>> max_coords = [0.9, 0.8, 0.75]
>>> b = Box((min_coords, max_coords))
get_bounding_box()
Returns :

(min_coords, max_coords) : 2-tuple of list

bounding box limit

get_volume()
Returns :

V : float

volume of the box given by V = \displaystyle\prod_{1 \leq i \leq \text{ndim}} (\text{cmax}_{i}-\text{cmin}_{i})

printout()

Print bounding box limit in console

class Cube(center, width)

Bases: pymses.utils.regions.Box

Cubic region class

Parameters :

center : tuple

cube center coordinates

width : float

size of the cube

Examples

>>> cu = Cube((0.5, 0.5, 0.5), 1.0)
get_volume()
Returns :

V : float

volume of the cube (size L) given by V = L^{\text{ndim}}

class Cylinder(center, axis_vector, radius, height)

Bases: pymses.utils.regions.Region

Cylinder region class

Parameters :

center : 3-tuple of float

cylinder center coordinates

axis_vector : 3-tuple of float

cylinder axis vector coordinates

radius : float

cylinder radius

height : float

cylinder height

Examples

>>> center = (0.5, 0.5, 0.5)
>>> axis = (0.1, 0.9, -0.1)
>>> radius = 0.3
>>> h = 0.05
>>> cyl = Cylinder(center, axis, radius, h)
contains(points)

TODO

get_bounding_box()

TODO

get_volume()
Returns :

V : float

volume of the cylinder (radius r, height h) given by V = \pi r^{2} h