grids

Module:

This modules operates with grids.

class grids.Boundary(v1, v2)
Represents an edge of an element of grid.
class grids.Element(v1, v2, v3, v4, number)
Represents an element of grid.
class grids.GnuplotPlotter

Plotter based on Gnuplot. Some options can be set:

>>> plotter = GnuplotPlotter() 
>>> plotter.point_lt = '1' #lt parameter used when plotting points
>>> plotter.point_type = '0' #point_type used when plotting points
>>> plotter.line_type = '1' #line_type used when plotting edges
>>> plotter.line_width = '1' #line_width used when plotting edges
class grids.Grid(path)

Represents grids.

>>> grid = Grid('grids/sq1.geo')
export_to_dolfin(path)
Exports to dolfin format and saves into file specified by path.
parse_line(vertices=False, skip_blank=True)
Parses sequence of numbers. See .geo format for further information.
print_summary()
Print summary of grid properties.
read_numbers(skip_blank=True)
Reads a line from the grid file and returns number in the line. If skip_blank=True, empty lines are skipped.
class grids.MatplotlibPlotter

A plotter based on Matplotlib. Options line_width and point_style can be set.

>>> plotter = MatplotlibPlotter()
>>> plotter.line_width = 2.0
>>> plotter.point_style = 'k.'
class grids.Plotter

Base class of plotters.

add_line(x1, y1, x2, y2, color)
View an edge from (x1, y1) to (x2, y2) with given color.
add_point(x, y, color)
View a vertex with coordinatex x and y and given color.
cleanup()
Cleaning.
set_region(minx, miny, maxx, maxy)
Set canvas boundaries.
show()
Show the grid.
class grids.Vertex(x, y, bc, number)
Represents a vertex of a grid.
class grids.Viewer(grid, *args)

This class puts grid into a plotter and views the grid. Boundaries can be colored accoring to boundary conditions.

>>> grid = Grid('grids/sq1.geo')
>>> viewer = Viewer(grid, Equation.items[0])
>>> viewer.show() #show grid
>>> viewer.show(drop_inner=True) #show grid without inner edges
>>> viewer.show(pick_one=-1) #show grid and highlight boundary with index -1
get_bc_color(_b_index)
Returns color which belongs to given boundary index.
show(plotter, drop_inner=False, pick_one='none')
Show the mesh. If drop_inner=True, inner edges are not shown. If you want to show only boundaries of given index, use e.g. pick_one=-1

Previous topic

blobs

Next topic

core

This Page