pyrw.RWdomain module

class pyrw.RWdomain.domain(RW, typ='poly')

Domain class for defining random walk domain.

Parameters:
  • RW (pyrw.RWRW) – A pyrw RW.
  • typ (str) – Type of domain
addArc(vstart, vcenter=None, vend=None, angle=None)

Adds arc from vstart to vend around vcenter to domain.

Parameters:
  • vstart (pyrw.geometry.vertex) – Vertex object.
  • vcenter (pyrw.geometry.vertex) – Vertex object.
  • vend (pyrw.geometry.vertex) – Vertex object.
  • angle (float) – Angle.
Returns:

pyrw.geometry.arc – arc object

addCircle(vcenter, radius, BC='')

Adds circle around vcenter with r=radius to domain.

Parameters:
  • vcenter (pyrw.geometry.vertex) – Vertex object.
  • radius (float) – Radius of circle.
Returns:

pyrw.geometry.circle – circle object

addLine(v1, v2)

Adds line from v1 to v2 to domain.

Parameters:
  • v1 (pyrw.geometry.vertex) – Vertex object.
  • v2 (pyrw.geometry.vertex) – Vertex object.
Returns:

pyrw.geometry.line – line object

addRectangle(voffset, lenx, leny)

Adds rectangle with offset voffset and sidelengths lenx,leny to domain.

Parameters:
  • voffset (pyrw.geometry.vertex) – Vertex object.
  • lenx (float) – Sidelength in x direction.
  • leny (float) – Sidelength in y direction.
Returns:

pyrw.geometry.rectangle – rectangle object

addVertex(x)

Adds vertex to domain.

Parameters:x (pyrw.RWRW) – 2D coordinate.
Returns:pyrw.geometry.vertex – vertex object
draw(r=None, color=None, ann=False)

Draw all geometrical elements associated with domain.

Parameters:
  • r (pyrw.RWrun) – pyrw run, if None, picks last run of main pyrw.RWRW object.
  • color (matplotlib color) – color of elements in matplotlib syntax, e.g. ‘r’ or (0.1,1,0.5)
  • ann (bool) – Annotation Flag
edgeByID(ID)

Returns edge given its ID

Parameters:ID (int) – ID of edge.
Returns:pyrw.geometry.edge – edge object
genRandomPoint()

Returns random coordinate inside domain.

Returns:array – coordinate
getExtend()

Returns x-y-extend of domain.

Returns:(float,float,float,float) – (minX,maxX,minY,maxY)
setRW(rw)
verticesCoordsToList()

Returns list with coordinates of all vertices of domain.

Returns:list – list with coordinates