two_dimensional
Subpackages:
domains
This file is filled with predefined/common domains for use. For more information on the Domain object (used as a base for all domains), see the documentation in ‘_auxilliaries/abstraction’ for Domain.
- class reyna.polymesher.two_dimensional.domains.CircleCircleDomain
Bases:
Domain- area()
This function returns the area of a domain.
- Returns:
Area of the domain.
- Return type:
float
- distances(points: ndarray) ndarray
The distance function for a domain. This gives some indication of ‘how far’ a given point is from the boundary of the domain. Negative values determine the inside of a domain. This explicitly defines the domain.
- Parameters:
points (np.ndarray) – Points to calculate the distances from.
- Returns:
Distances calculated from the points.
- Return type:
np.ndarray
- pFix() ndarray | None
This function returns a set of fixed points. This ‘getter’ is used if the set of fixed points is in fact dependent on additional domain parameters. If no more points are required, then use ‘return self.fixed_points’.
- Returns:
Array of fixed points.
- Return type:
Optional[np.ndarray]
- class reyna.polymesher.two_dimensional.domains.CircleDomain(bounding_box=array([[-1, 1], [-1, 1]]), fixed_points=None)
Bases:
Domain- area()
This function returns the area of a domain.
- Returns:
Area of the domain.
- Return type:
float
- distances(points: ndarray) ndarray
The distance function for a domain. This gives some indication of ‘how far’ a given point is from the boundary of the domain. Negative values determine the inside of a domain. This explicitly defines the domain.
- Parameters:
points (np.ndarray) – Points to calculate the distances from.
- Returns:
Distances calculated from the points.
- Return type:
np.ndarray
- pFix() ndarray | None
This function returns a set of fixed points. This ‘getter’ is used if the set of fixed points is in fact dependent on additional domain parameters. If no more points are required, then use ‘return self.fixed_points’.
- Returns:
Array of fixed points.
- Return type:
Optional[np.ndarray]
- class reyna.polymesher.two_dimensional.domains.HornDomain
Bases:
Domain- area()
This function returns the area of a domain.
- Returns:
Area of the domain.
- Return type:
float
- distances(points: ndarray) ndarray
The distance function for a domain. This gives some indication of ‘how far’ a given point is from the boundary of the domain. Negative values determine the inside of a domain. This explicitly defines the domain.
- Parameters:
points (np.ndarray) – Points to calculate the distances from.
- Returns:
Distances calculated from the points.
- Return type:
np.ndarray
- pFix() ndarray | None
This function returns a set of fixed points. This ‘getter’ is used if the set of fixed points is in fact dependent on additional domain parameters. If no more points are required, then use ‘return self.fixed_points’.
- Returns:
Array of fixed points.
- Return type:
Optional[np.ndarray]
- class reyna.polymesher.two_dimensional.domains.LShapeDomain
Bases:
Domain- area()
This function returns the area of a domain.
- Returns:
Area of the domain.
- Return type:
float
- distances(points: ndarray) ndarray
The distance function for a domain. This gives some indication of ‘how far’ a given point is from the boundary of the domain. Negative values determine the inside of a domain. This explicitly defines the domain.
- Parameters:
points (np.ndarray) – Points to calculate the distances from.
- Returns:
Distances calculated from the points.
- Return type:
np.ndarray
- pFix() ndarray | None
This function returns a set of fixed points. This ‘getter’ is used if the set of fixed points is in fact dependent on additional domain parameters. If no more points are required, then use ‘return self.fixed_points’.
- Returns:
Array of fixed points.
- Return type:
Optional[np.ndarray]
- class reyna.polymesher.two_dimensional.domains.RectangleCircleDomain
Bases:
Domain- area()
This function returns the area of a domain.
- Returns:
Area of the domain.
- Return type:
float
- distances(points: ndarray) ndarray
The distance function for a domain. This gives some indication of ‘how far’ a given point is from the boundary of the domain. Negative values determine the inside of a domain. This explicitly defines the domain.
- Parameters:
points (np.ndarray) – Points to calculate the distances from.
- Returns:
Distances calculated from the points.
- Return type:
np.ndarray
- pFix() ndarray | None
This function returns a set of fixed points. This ‘getter’ is used if the set of fixed points is in fact dependent on additional domain parameters. If no more points are required, then use ‘return self.fixed_points’.
- Returns:
Array of fixed points.
- Return type:
Optional[np.ndarray]
- class reyna.polymesher.two_dimensional.domains.RectangleDomain(bounding_box, fixed_points=None)
Bases:
Domain- area()
This function returns the area of a domain.
- Returns:
Area of the domain.
- Return type:
float
- distances(points: ndarray) ndarray
The distance function for a domain. This gives some indication of ‘how far’ a given point is from the boundary of the domain. Negative values determine the inside of a domain. This explicitly defines the domain.
- Parameters:
points (np.ndarray) – Points to calculate the distances from.
- Returns:
Distances calculated from the points.
- Return type:
np.ndarray
- pFix() ndarray | None
This function returns a set of fixed points. This ‘getter’ is used if the set of fixed points is in fact dependent on additional domain parameters. If no more points are required, then use ‘return self.fixed_points’.
- Returns:
Array of fixed points.
- Return type:
Optional[np.ndarray]
main
- reyna.polymesher.two_dimensional.main.poly_mesher(domain: Domain, max_iterations: int = 100, **kwargs) PolyMesh
The PolyMesher function. This function generates a bounded Voronoi tesselation of a given domain. The user must initialise the function with either the number of elements they require by submitting the ‘n_points’ keyword argument or initialise with a grid of points by inputting the ‘n_xy’ keyword argument. There is a further verbose argument also.
- Parameters:
domain (Domain) – This is a ‘Domain’ object, be that custom or a pre-defined one.
max_iterations (int) – This is the number of iterations required by the user. Generally, the more iterations, the more uniform the elements are in shape and number of edges etc.
**kwargs – There are several valid inputs here. ‘verbose’ has obvious effects and is a boolean value (default False). ‘cleaned’ cleans up the resulting mesh and removes small numerical artifacts. ‘seed’ sets a seed for the generation of the initial points. There are two options for the initial points. One can either input ‘n_points’ to dictate a given number of points or ‘n_xy’ (of type (int, int)) together to generate a Cartesian mesh.
- Returns:
A PolyMesh object containing all the relevant information to be used in a geometry function.
- Return type:
(PolyMesh)
- Raises:
AttributeError – If the keyword ‘n_points’ or ‘n_xy’ are missed.
Notes
If the ‘cleaned’ keyword is used, the output mesh is not guarenteed to be a Voronoi diagram.
See also
Please see here PolyMesher for more documentation on PolyMesher.
visualisation
- reyna.polymesher.two_dimensional.visualisation.display_mesh(poly_mesh: PolyMesh, **kwargs) None
A function to display the generated PolyMesh.
- Parameters:
poly_mesh (PolyMesh) – A PolyMesh object.
**kwargs – Additional keyword arguments. There are several valid inputs here. ‘figsize’, ‘color_map’ and ‘save_path’ are as expected. Any further keyword arguments are passed as parameters into matplotlib.patches Polygon function.
See also
Please see here matplotlib.patches.Polygon for more documentation on the keyword arguments.