Cartesian grid generation

The grids are cartesian grids, all cells have the same size in all directions. The required parameters are the number of points per side for the grid paralellepiped.

_images/square.png

square from a

_images/rectangle.png

rectangle from a,b

Grid generation functions are:

square(i)

rectangle(i, j)

cube(i)

parallelepiped(i, j, k)

Each function returns a numpy [1] array with point coordinates, the whole is a cartesian grid (or mesh). Mesh dimensions are (3,i,j,k), the first dim is x,y,z, then each side of the paralellepiped is i,j and k. Any returned mesh has such a shape

The table hereafter summerize the function results w.r.t. parameters: les dimensions obtenues:

Mesh dimensions

mesh params i j k
square a a a 1
rectangle a,b a b 1
cube a a a a
parallelepiped a,b,c a b c
[1]see http://www.numpy.org

Grid generation

Cython Module

Cython interface to fortran `gen3d`

pyShift.gengrid_stub.E_ZERO_DIM

If one dim is 0 or 1 it fails, ZERO_DIM is returned.

pyShift.gengrid_stub.cube()

Creates `(3,i,i,i)` mesh

see parallelepiped()

pyShift.gengrid_stub.parallelepiped()

Main function for mesh generation.

Functions square(), rectangle(), cube() use this function with specific `(i,j,k)`.

  • Args
    • imax: max points in `i` plane
    • jmax: max points in `j` plane
    • kmax: max points in `k` plane
  • Return
    • a `numpy` array of size `(3,i,j,k)` with first dim for `(x,y,z)` of each point.
  • Exceptions
    • the return E_STATUS_OK comes from the fortran function generate() and indicates no error.
    • E_ZERO_DIM is the returned exception if one dim is zero or 1.
    • MAX_EXCEEDED is raised if the number of points is greater than 65535
pyShift.gengrid_stub.rectangle()

Creates `(3,i,j,1)` mesh

see parallelepiped()

pyShift.gengrid_stub.square()

Creates `(3,i,i,1)` mesh

see parallelepiped()

Fortran Module

gen3d(i,j,k,x,y,z)

int i,j,k: max dims (number of points) along i,j and k axis x,y,z: numpy arrays already allocated, function fills them

Warning

No dimension check

Table Of Contents

Previous topic

pyShift - Rigid Motion for 3D Grids

Next topic

gen3d(i,j,k,x,y,z)

This Page