carputils.mesh.Grid

class carputils.mesh.Grid(lowerleft, upperright, resolution=0.1, fibres=(1.0, 0.0), triangulate=False)

Generate a two dimensional mesh of a regular grid.

The generated mesh is aligned along the x-y plane, with z set to 0. Nodes are arranged on a regularly spaced grid and connected by quad elements. The mesh is defined by the x,y coordinates of the lower left and upper right corners and the mesh resolution, in mm.

To generate a mesh from 0,0 to 10,10, with 0.1mm spacing:

>>> geom = Grid((0,0), (10,10), 0.1)
>>> geom.generate_carp('mesh/grid')

Constant fibre vectors are set by the fibres optional command line argument, which defaults to be aligned with the positive x direction. The mesh may also be triangulated by use of the triangulate argument.

For more information on defining mesh regions etc., please see the mesh_generation section of the documentation.

Args:
lowerleft : array-like
The lower left (x,y) coordinate of the mesh, in mm
upperright : array-like
The upper right (x,y) coordinate of the mesh, in mm
resolution : float or array-like, optional
The resolution of the mesh in mm, either as a scalar for the same in both directions or as a list or array when in 2 directions, defaults to 0.1
fibres : array-like, optional
Specify a fibre vector, defaults to (1.0, 0.0)