Coords¶
This manages data points in 1D/2D/3D dimensions, with particular attention in how to distribute particles to the correct slab when using MPI.
Points¶
- fiesta.coords.x2points(x: ndarray) ndarray¶
Column stacks input coordinates.
- Parameters:
x (array) – X coordinates.
- Returns:
points – Column stacked array.
- Return type:
1darray
- fiesta.coords.points2x(points: ndarray) ndarray¶
Unstacks input coordinates.
- Parameters:
points (2darray) – Column stacked array.
- Returns:
x – X coordinates.
- Return type:
array
- fiesta.coords.xy2points(x: ndarray, y: ndarray) ndarray¶
Column stacks input coordinates.
- Parameters:
x (array) – X coordinates.
y (array) – Y coordinates.
- Returns:
points – Column stacked array.
- Return type:
2darray
- fiesta.coords.points2xy(points: ndarray) Tuple[ndarray, ndarray]¶
Unstacks input coordinates.
- Parameters:
points (2darray) – Column stacked array.
- Returns:
x (array) – X coordinates.
y (array) – Y coordinates.
- fiesta.coords.xyz2points(x: ndarray, y: ndarray, z: ndarray) ndarray¶
Column stacks input coordinates.
- Parameters:
x (array) – X coordinates.
y (array) – Y coordinates.
z (array) – Z coordinates.
- Returns:
points – Column stacked array.
- Return type:
2darray
- fiesta.coords.points2xyz(points: ndarray) Tuple[ndarray, ndarray, ndarray]¶
Unstacks input coordinates.
- Parameters:
points (2darray) – Column stacked array.
- Returns:
x (array) – X coordinates.
y (array) – Y coordinates.
z (array) – Z coordinates.
- fiesta.coords.coord2points(xlist: ndarray) ndarray¶
Column stacks input coordinates.
- Parameters:
xlist (array) – List of coordinates and extra informations.
- Returns:
data – Column stacked data array.
- Return type:
2darray
- fiesta.coords.split_limits_by_grid(boxsize: float, origin: float, ngrid: int, MPI: object) List[float]¶
Returns the ranges along one axis for data being split between nodes.
- fiesta.coords.mpi_find_range_2D(fnames: str, freader: object, MPI: object) ndarray¶
Find ranges from each file and returns the ranges to node 0.
- Parameters:
fnames (list str) – List of fname inputs for freader function.
freader (func) – File reader function which returns ndarray with first two columns corresponding to x and y coordinate axis.
MPI (class object) – MPIutils MPI class object.
- Returns:
ranges – Ranges with columns: xmin, xmax, ymin and ymax.
- Return type:
ndarray
- fiesta.coords.mpi_find_range_3D(fnames: str, freader: object, MPI: object) ndarray¶
Find ranges from each file and returns the ranges to node 0.
- Parameters:
fnames (list str) – List of fname inputs for freader function.
freader (func) – File reader function which returns ndarray with first two columns corresponding to x and y coordinate axis.
MPI (class object) – MPIutils MPI class object.
- Returns:
ranges – Ranges with columns: xmin, xmax, ymin, ymax, zmin and zmax.
- Return type:
ndarray
- fiesta.coords.mpi_open_2D(fnames: str, freader: object, ranges: ndarray, limits: List[float]) ndarray¶
Find ranges from each file and returns the ranges to node 0.
- Parameters:
fnames (list str) – List of fname inputs for freader function.
freader (func) – File reader function which returns ndarray with first two columns corresponding to x and y coordinate axis.
ranges (ndarray) – Ranges with columns: xmin, xmax, ymin and ymax.
limits (list) – Ranges for each coordinate axis.
- Returns:
datas – Data within range.
- Return type:
ndarray
- fiesta.coords.mpi_open_3D(fnames: str, freader: object, ranges: ndarray, limits: List[float]) ndarray¶
Find ranges from each file and returns the ranges to node 0.
- Parameters:
fnames (list str) – List of fname inputs for freader function.
freader (func) – File reader function which returns ndarray with first two columns corresponding to x and y coordinate axis.
ranges (ndarray) – Ranges with columns: xmin, xmax, ymin and ymax.
limits (list) – Ranges for each coordinate axis.
MPI (class object) – MPIutils MPI class object.
- Returns:
datas – Data within range.
- Return type:
ndarray
- fiesta.coords.check_coords_at_MPI_0(x: ndarray, MPI: object) bool¶
Check if coordinates are only inputed at the zeroth node.
Parameter¶
- xarray
X-axis coordinates.
- MPIclass object
MPIutils MPI class object.
- returns:
checkatzero – True if points are only at the zeroth node.
- rtype:
bool
- fiesta.coords.distribute_points_by_x(data: ndarray, boxsize: float, ngrid: int, origin: float, MPI: object) ndarray¶
Distributes points along the x-axis based grid-based slab decomposition.
- Parameters:
- Return type:
Distributed data.
- class fiesta.coords.MPI_SortByX(MPI: object)¶
-
- distribute(include_internalbuffer: bool = False) ndarray¶
Distributes points along the x-axis based grid-based slab decomposition.
- Parameters:
include_internalbuffer (bool, optional) – Whether to include internal buffer region. Note, this does not support, periodic boundary conditions.
- Yields:
Distributed data.
- distribute_grid2D(x2d: ndarray, y2d: ndarray, f2d: ndarray) ndarray¶
Distributes a 2D grid data set via slab decomposition.
- Parameters:
x2d (ndarray) – X-coordinates for the 2D grid.
y2d (ndarray) – y-coordinates for the 2D grid.
f2d (ndarray) – Field values for the 2D grid.
- Returns:
f – Distributed 2D field grid.
- Return type:
ndarray
- distribute_grid3D(x3d: ndarray, y3d: ndarray, z3d: ndarray, f3d: ndarray) ndarray¶
Distributes a 3D grid data set via slab decomposition.
- Parameters:
x3d (ndarray) – X-coordinates for the 3D grid.
y3d (ndarray) – y-coordinates for the 3D grid.
z3d (ndarray) – y-coordinates for the 3D grid.
f23 (ndarray) – Field values for the 3D grid.
- Returns:
f – Distributed 3D field grid.
- Return type:
ndarray
- input(data: ndarray) None¶
Input coordinates.
- Parameters:
daata (array) – A 2 dimensional array where the first column is the x-axis coordinate.